mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 19:09:49 +00:00
Bug 722176 - Inline autocomplete becomes inactive after deleting an entry in location bar history.
r=dietrich
This commit is contained in:
parent
c86e46764b
commit
ad87cc26c2
@ -1690,7 +1690,8 @@ Database::MigrateV17Up()
|
||||
"INSERT OR IGNORE INTO moz_hosts (host, frecency) "
|
||||
"SELECT fixup_url(get_unreversed_host(h.rev_host)) AS host, "
|
||||
"(SELECT MAX(frecency) FROM moz_places "
|
||||
"WHERE rev_host = h.rev_host OR rev_host = h.rev_host || 'www.'"
|
||||
"WHERE rev_host = get_unreversed_host(host || '.') || '.' "
|
||||
"OR rev_host = get_unreversed_host(host || '.') || '.www.') "
|
||||
") AS frecency "
|
||||
"FROM moz_places h "
|
||||
"WHERE LENGTH(h.rev_host) > 1 "
|
||||
|
@ -103,7 +103,11 @@
|
||||
"BEGIN " \
|
||||
"DELETE FROM moz_hosts " \
|
||||
"WHERE host = fixup_url(get_unreversed_host(OLD.rev_host)) " \
|
||||
"AND NOT EXISTS(SELECT 1 FROM moz_places WHERE rev_host = OLD.rev_host); " \
|
||||
"AND NOT EXISTS(" \
|
||||
"SELECT 1 FROM moz_places " \
|
||||
"WHERE rev_host = get_unreversed_host(host || '.') || '.' " \
|
||||
"OR rev_host = get_unreversed_host(host || '.') || '.www.' " \
|
||||
"); " \
|
||||
"END" \
|
||||
)
|
||||
|
||||
@ -122,8 +126,8 @@
|
||||
"BEGIN " \
|
||||
"UPDATE moz_hosts " \
|
||||
"SET frecency = (SELECT MAX(frecency) FROM moz_places " \
|
||||
"WHERE rev_host = NEW.rev_host " \
|
||||
"OR rev_host = NEW.rev_host || 'www.') " \
|
||||
"WHERE rev_host = get_unreversed_host(host || '.') || '.' " \
|
||||
"OR rev_host = get_unreversed_host(host || '.') || '.www.') " \
|
||||
"WHERE host = fixup_url(get_unreversed_host(NEW.rev_host)); " \
|
||||
"END" \
|
||||
)
|
||||
|
@ -37,18 +37,15 @@ function isHostInMozHosts(aURI, aTyped)
|
||||
let stmt = DBConn().createStatement(
|
||||
"SELECT host, typed "
|
||||
+ "FROM moz_hosts "
|
||||
+ "WHERE host = :host"
|
||||
+ "WHERE host = fixup_url(:host)"
|
||||
);
|
||||
let result = false;
|
||||
stmt.params.host = aURI.host;
|
||||
while(stmt.executeStep()) {
|
||||
if (stmt.row.host == aURI.host) {
|
||||
if (aTyped != null)
|
||||
result = aTyped == stmt.row.typed;
|
||||
else
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
if (stmt.executeStep()) {
|
||||
if (aTyped != null)
|
||||
result = aTyped == stmt.row.typed;
|
||||
else
|
||||
result = true;
|
||||
}
|
||||
stmt.finalize();
|
||||
return result;
|
||||
@ -100,9 +97,7 @@ function test_moz_hosts_update()
|
||||
handleCompletion: function () {
|
||||
do_check_true(isHostInMozHosts(urls[0].uri, urls[0].typed));
|
||||
do_check_true(isHostInMozHosts(urls[1].uri, urls[1].typed));
|
||||
// strip the WWW from the url before testing...
|
||||
do_check_true(isHostInMozHosts(NetUtil.newURI("http://foo.mozilla.org"),
|
||||
urls[2].typed));
|
||||
do_check_true(isHostInMozHosts(urls[2].uri, urls[2].typed));
|
||||
run_next_test();
|
||||
}
|
||||
});
|
||||
@ -180,6 +175,41 @@ function test_moz_hosts_typed_update()
|
||||
});
|
||||
}
|
||||
|
||||
function test_moz_hosts_www_remove()
|
||||
{
|
||||
function test_removal(aURIToRemove, aURIToKeep, aCallback) {
|
||||
let places = [{ uri: aURIToRemove
|
||||
, title: "test for " + aURIToRemove.spec
|
||||
, visits: [ new VisitInfo() ]
|
||||
},
|
||||
{ uri: aURIToKeep
|
||||
, title: "test for " + aURIToKeep.spec
|
||||
, visits: [ new VisitInfo() ]
|
||||
}];
|
||||
|
||||
gHistory.updatePlaces(places, {
|
||||
handleResult: function () {
|
||||
},
|
||||
handleError: function () {
|
||||
do_throw("gHistory.updatePlaces() failed");
|
||||
},
|
||||
handleCompletion: function () {
|
||||
PlacesUtils.history.removePage(aURIToRemove);
|
||||
do_check_true(isHostInMozHosts(aURIToKeep));
|
||||
waitForClearHistory(aCallback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const TEST_URI = NetUtil.newURI("http://rem.mozilla.com");
|
||||
const TEST_WWW_URI = NetUtil.newURI("http://www.rem.mozilla.com");
|
||||
test_removal(TEST_URI, TEST_WWW_URI, function() {
|
||||
test_removal(TEST_WWW_URI, TEST_URI, function() {
|
||||
waitForClearHistory(run_next_test);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Test Runner
|
||||
|
||||
@ -189,6 +219,7 @@ function test_moz_hosts_typed_update()
|
||||
test_bookmark_changes,
|
||||
test_bookmark_removal,
|
||||
test_moz_hosts_typed_update,
|
||||
test_moz_hosts_www_remove,
|
||||
].forEach(add_test);
|
||||
|
||||
function run_test()
|
||||
|
Loading…
x
Reference in New Issue
Block a user