browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 // This test checks that the Session Restore about:home button
michael@0 6 // is disabled in private mode
michael@0 7
michael@0 8 function test() {
michael@0 9 waitForExplicitFinish();
michael@0 10
michael@0 11 function testNoSessionRestoreButton() {
michael@0 12 let win = OpenBrowserWindow({private: true});
michael@0 13 win.addEventListener("load", function onLoad() {
michael@0 14 win.removeEventListener("load", onLoad, false);
michael@0 15 executeSoon(function() {
michael@0 16 info("The second private window got loaded");
michael@0 17 let newTab = win.gBrowser.addTab();
michael@0 18 win.gBrowser.selectedTab = newTab;
michael@0 19 let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
michael@0 20 tabBrowser.addEventListener("load", function tabLoadListener() {
michael@0 21 if (win.content.location != "about:home") {
michael@0 22 win.content.location = "about:home";
michael@0 23 return;
michael@0 24 }
michael@0 25 tabBrowser.removeEventListener("load", tabLoadListener, true);
michael@0 26 executeSoon(function() {
michael@0 27 info("about:home got loaded");
michael@0 28 let sessionRestoreButton = win.gBrowser
michael@0 29 .contentDocument
michael@0 30 .getElementById("restorePreviousSession");
michael@0 31 is(win.getComputedStyle(sessionRestoreButton).display,
michael@0 32 "none", "The Session Restore about:home button should be disabled");
michael@0 33 win.close();
michael@0 34 finish();
michael@0 35 });
michael@0 36 }, true);
michael@0 37 });
michael@0 38 }, false);
michael@0 39 }
michael@0 40
michael@0 41 let win = OpenBrowserWindow({private: true});
michael@0 42 win.addEventListener("load", function onload() {
michael@0 43 win.removeEventListener("load", onload, false);
michael@0 44 executeSoon(function() {
michael@0 45 info("The first private window got loaded");
michael@0 46 win.close();
michael@0 47 testNoSessionRestoreButton();
michael@0 48 });
michael@0 49 }, false);
michael@0 50 }

mercurial