Thu, 15 Jan 2015 21:13:52 +0100
Remove forgotten relic of ABI crash risk averse overloaded method change.
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 makes sure that the Clear Recent History menu item and command |
michael@0 | 6 | // is disabled inside the private browsing mode. |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | waitForExplicitFinish(); |
michael@0 | 10 | |
michael@0 | 11 | function checkDisableOption(aPrivateMode, aWindow, aCallback) { |
michael@0 | 12 | executeSoon(function() { |
michael@0 | 13 | let crhCommand = aWindow.document.getElementById("Tools:Sanitize"); |
michael@0 | 14 | ok(crhCommand, "The clear recent history command should exist"); |
michael@0 | 15 | |
michael@0 | 16 | is(PrivateBrowsingUtils.isWindowPrivate(aWindow), aPrivateMode, |
michael@0 | 17 | "PrivateBrowsingUtils should report the correct per-window private browsing status"); |
michael@0 | 18 | is(crhCommand.hasAttribute("disabled"), aPrivateMode, |
michael@0 | 19 | "Clear Recent History command should be disabled according to the private browsing mode"); |
michael@0 | 20 | |
michael@0 | 21 | executeSoon(aCallback); |
michael@0 | 22 | }); |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | let windowsToClose = []; |
michael@0 | 26 | let testURI = "http://mochi.test:8888/"; |
michael@0 | 27 | |
michael@0 | 28 | function testOnWindow(aIsPrivate, aCallback) { |
michael@0 | 29 | whenNewWindowLoaded({private: aIsPrivate}, function(aWin) { |
michael@0 | 30 | windowsToClose.push(aWin); |
michael@0 | 31 | aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
michael@0 | 32 | if (aWin.content.location.href != testURI) { |
michael@0 | 33 | aWin.gBrowser.loadURI(testURI); |
michael@0 | 34 | return; |
michael@0 | 35 | } |
michael@0 | 36 | aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
michael@0 | 37 | executeSoon(function() aCallback(aWin)); |
michael@0 | 38 | }, true); |
michael@0 | 39 | |
michael@0 | 40 | aWin.gBrowser.loadURI(testURI); |
michael@0 | 41 | }); |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | registerCleanupFunction(function() { |
michael@0 | 45 | windowsToClose.forEach(function(aWin) { |
michael@0 | 46 | aWin.close(); |
michael@0 | 47 | }); |
michael@0 | 48 | }); |
michael@0 | 49 | |
michael@0 | 50 | testOnWindow(true, function(aWin) { |
michael@0 | 51 | info("Test on private window"); |
michael@0 | 52 | checkDisableOption(true, aWin, function() { |
michael@0 | 53 | testOnWindow(false, function(aPrivWin) { |
michael@0 | 54 | info("Test on public window"); |
michael@0 | 55 | checkDisableOption(false, aPrivWin, finish); |
michael@0 | 56 | }); |
michael@0 | 57 | }); |
michael@0 | 58 | }); |
michael@0 | 59 | } |