fix for bug #408790: URIs that we exclude from history (like about:blank, data:, etc) will appear visited if we check immediately after visiting them. r=dietrich, a=blocking-firefox-3+

This commit is contained in:
sspitzer@mozilla.org 2007-12-19 09:33:50 -08:00
Родитель 7df81a47e7
Коммит f90e83d197
2 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -3066,9 +3066,15 @@ nsNavHistory::AddURI(nsIURI *aURI, PRBool aRedirect,
if (IsHistoryDisabled())
return NS_OK;
// filter out any unwanted URIs
PRBool canAdd = PR_FALSE;
nsresult rv = CanAddURI(aURI, &canAdd);
NS_ENSURE_SUCCESS(rv, rv);
if (!canAdd)
return NS_OK;
PRTime now = PR_Now();
nsresult rv;
#ifdef LAZY_ADD
LazyMessage message;
rv = message.Init(LazyMessage::Type_AddURI, aURI);

Просмотреть файл

@ -76,12 +76,20 @@ function run_test() {
var uri4 = uri("http://foobarcheese.com");
do_check_false(gh.isVisited(uri4));
// will fail until we fix bug #408790
// check that certain schemes never show up as visited
// even if we visit them
//var cantAddUri = uri("about:config");
//add_uri_to_history(cantAddUri);
//do_check_false(gh.isVisited(cantAddUri));
//todo, test imap, news, mailbox, moz-anno, view-source, chrome, data
//see CanAddURI() in nsNavHistory.cpp
// even if we attempt to add them to history
// see CanAddURI() in nsNavHistory.cpp
var urlsToIgnore = ["about:config",
"data:,Hello%2C%20World!",
"imap://cyrus.andrew.cmu.edu/archive.imap",
"news://news.mozilla.org/mozilla.dev.apps.firefox",
"moz-anno:favicon:http://www.mozilla.org/2005/made-up-favicon/84-1321",
"chrome://browser/content/browser.xul",
"view-source:http://www.google.com/"];
for each (var currentURL in urlsToIgnore) {
var cantAddUri = uri(currentURL);
add_uri_to_history(cantAddUri);
do_check_false(gh.isVisited(cantAddUri));
}
}