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.
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 button from about:sessionrestore |
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("about:sessionrestore"); |
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.gBrowser.contentWindow.location != "about:sessionrestore") { |
michael@0 | 22 | win.gBrowser.selectedBrowser.loadURI("about:sessionrestore"); |
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:sessionrestore got loaded"); |
michael@0 | 28 | let restoreButton = win.gBrowser.contentDocument |
michael@0 | 29 | .getElementById("errorTryAgain"); |
michael@0 | 30 | ok(restoreButton.disabled, |
michael@0 | 31 | "The Restore about:sessionrestore button should be disabled"); |
michael@0 | 32 | win.close(); |
michael@0 | 33 | finish(); |
michael@0 | 34 | }); |
michael@0 | 35 | }, true); |
michael@0 | 36 | }); |
michael@0 | 37 | }, false); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | let win = OpenBrowserWindow({private: true}); |
michael@0 | 41 | win.addEventListener("load", function onload() { |
michael@0 | 42 | win.removeEventListener("load", onload, false); |
michael@0 | 43 | executeSoon(function() { |
michael@0 | 44 | info("The first private window got loaded"); |
michael@0 | 45 | win.close(); |
michael@0 | 46 | testNoSessionRestoreButton(); |
michael@0 | 47 | }); |
michael@0 | 48 | }, false); |
michael@0 | 49 | } |