Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 // This test checks that the session restore button from about:sessionrestore
6 // is disabled in private mode
8 function test() {
9 waitForExplicitFinish();
11 function testNoSessionRestoreButton() {
12 let win = OpenBrowserWindow({private: true});
13 win.addEventListener("load", function onLoad() {
14 win.removeEventListener("load", onLoad, false);
15 executeSoon(function() {
16 info("The second private window got loaded");
17 let newTab = win.gBrowser.addTab("about:sessionrestore");
18 win.gBrowser.selectedTab = newTab;
19 let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
20 tabBrowser.addEventListener("load", function tabLoadListener() {
21 if (win.gBrowser.contentWindow.location != "about:sessionrestore") {
22 win.gBrowser.selectedBrowser.loadURI("about:sessionrestore");
23 return;
24 }
25 tabBrowser.removeEventListener("load", tabLoadListener, true);
26 executeSoon(function() {
27 info("about:sessionrestore got loaded");
28 let restoreButton = win.gBrowser.contentDocument
29 .getElementById("errorTryAgain");
30 ok(restoreButton.disabled,
31 "The Restore about:sessionrestore button should be disabled");
32 win.close();
33 finish();
34 });
35 }, true);
36 });
37 }, false);
38 }
40 let win = OpenBrowserWindow({private: true});
41 win.addEventListener("load", function onload() {
42 win.removeEventListener("load", onload, false);
43 executeSoon(function() {
44 info("The first private window got loaded");
45 win.close();
46 testNoSessionRestoreButton();
47 });
48 }, false);
49 }