gecko/browser/base/content/test/browser_bug882977.js
Dão Gottwald 26b2b3d7aa Bug 893424 - Replace XULBrowserWindow's broken _hostChanged logic. r=jaws
--HG--
extra : rebase_source : b91d7affbca2e7f8df688c158ab75665abe43c14
2013-07-15 17:58:09 +02:00

40 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.startup.homepage");
Services.prefs.clearUserPref("browser.startup.page");
win.close();
});
let homepage = "about:home";
Services.prefs.setCharPref("browser.startup.homepage", homepage);
Services.prefs.setIntPref("browser.startup.page", 1);
let win = OpenBrowserWindow();
whenDelayedStartupFinished(win, function() {
let browser = win.gBrowser.selectedBrowser;
if (browser.contentDocument.readyState == "complete" &&
browser.currentURI.spec == homepage) {
checkIdentityMode(win);
return;
}
browser.addEventListener("load", function onLoad() {
if (browser.currentURI.spec != homepage)
return;
browser.removeEventListener("load", onLoad, true);
checkIdentityMode(win);
}, true);
});
}
function checkIdentityMode(win) {
let identityMode = win.document.getElementById("identity-box").className;
is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
finish();
}