Bug 724239 - Loading a page in a new tab enables the back button; r=gavin,bz

This commit is contained in:
Tim Taubert 2012-07-10 17:54:41 +02:00
parent a8587dc0f1
commit dea70acc5b
3 changed files with 38 additions and 2 deletions

View File

@ -148,6 +148,7 @@ _BROWSER_FILES = \
browser_bug664672.js \
browser_bug710878.js \
browser_bug719271.js \
browser_bug724239.js \
browser_bug735471.js \
browser_bug743421.js \
browser_bug749738.js \

View File

@ -0,0 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
BrowserOpenTab();
let tab = gBrowser.selectedTab;
let browser = tab.linkedBrowser;
registerCleanupFunction(function () { gBrowser.removeTab(tab); });
whenBrowserLoaded(browser, function () {
browser.loadURI("http://example.com/");
whenBrowserLoaded(browser, function () {
ok(!gBrowser.canGoBack, "about:newtab wasn't added to the session history");
finish();
});
});
}
function whenBrowserLoaded(aBrowser, aCallback) {
aBrowser.addEventListener("load", function onLoad() {
aBrowser.removeEventListener("load", onLoad, true);
executeSoon(aCallback);
}, true);
}

View File

@ -10018,7 +10018,7 @@ nsDocShell::ShouldAddToSessionHistory(nsIURI * aURI)
// should just do a spec compare, rather than two gets of the scheme and
// then the path. -Gagan
nsresult rv;
nsCAutoString buf;
nsCAutoString buf, pref;
rv = aURI->GetScheme(buf);
if (NS_FAILED(rv))
@ -10033,7 +10033,14 @@ nsDocShell::ShouldAddToSessionHistory(nsIURI * aURI)
return false;
}
}
return true;
rv = aURI->GetSpec(buf);
NS_ENSURE_SUCCESS(rv, true);
rv = Preferences::GetDefaultCString("browser.newtab.url", &pref);
NS_ENSURE_SUCCESS(rv, true);
return !buf.Equals(pref);
}
nsresult