browser/base/content/test/general/browser_bug882977.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug882977.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +function test() {
     1.9 +  waitForExplicitFinish();
    1.10 +
    1.11 +  registerCleanupFunction(function() {
    1.12 +    Services.prefs.clearUserPref("browser.startup.homepage");
    1.13 +    Services.prefs.clearUserPref("browser.startup.page");
    1.14 +    win.close();
    1.15 +  });
    1.16 +
    1.17 +  let homepage = "about:home";
    1.18 +  Services.prefs.setCharPref("browser.startup.homepage", homepage);
    1.19 +  Services.prefs.setIntPref("browser.startup.page", 1);
    1.20 +  let win = OpenBrowserWindow();
    1.21 +  whenDelayedStartupFinished(win, function() {
    1.22 +    let browser = win.gBrowser.selectedBrowser;
    1.23 +    if (browser.contentDocument.readyState == "complete" &&
    1.24 +        browser.currentURI.spec == homepage) {
    1.25 +      checkIdentityMode(win);
    1.26 +      return;
    1.27 +    }
    1.28 +
    1.29 +    browser.addEventListener("load", function onLoad() {
    1.30 +      if (browser.currentURI.spec != homepage)
    1.31 +        return;
    1.32 +      browser.removeEventListener("load", onLoad, true);
    1.33 +      checkIdentityMode(win);
    1.34 +    }, true);
    1.35 +  });
    1.36 +}
    1.37 +
    1.38 +function checkIdentityMode(win) {
    1.39 +  let identityMode = win.document.getElementById("identity-box").className;
    1.40 +  is(identityMode, "chromeUI", "Identity state should be chromeUI for about:home in a new window");
    1.41 +  finish();
    1.42 +}

mercurial