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 geolocation prompt does not show a remember |
michael@0 | 6 | // control inside the private browsing mode. |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | const testPageURL = "http://mochi.test:8888/browser/" + |
michael@0 | 10 | "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html"; |
michael@0 | 11 | waitForExplicitFinish(); |
michael@0 | 12 | |
michael@0 | 13 | function checkGeolocation(aPrivateMode, aWindow, aCallback) { |
michael@0 | 14 | executeSoon(function() { |
michael@0 | 15 | aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab(); |
michael@0 | 16 | aWindow.gBrowser.selectedBrowser.addEventListener("load", function () { |
michael@0 | 17 | if (aWindow.content.location != testPageURL) { |
michael@0 | 18 | aWindow.content.location = testPageURL; |
michael@0 | 19 | return; |
michael@0 | 20 | } |
michael@0 | 21 | aWindow.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 22 | |
michael@0 | 23 | function runTest() { |
michael@0 | 24 | let notification = aWindow.PopupNotifications.getNotification("geolocation"); |
michael@0 | 25 | if (!notification) { |
michael@0 | 26 | // Wait until the notification is available |
michael@0 | 27 | executeSoon(runTest); |
michael@0 | 28 | return; |
michael@0 | 29 | } |
michael@0 | 30 | if (aPrivateMode) { |
michael@0 | 31 | // Make sure the notification is correctly displayed without a remember control |
michael@0 | 32 | is(notification.secondaryActions.length, 0, "Secondary actions shouldn't exist (always/never remember)"); |
michael@0 | 33 | } else { |
michael@0 | 34 | ok(notification.secondaryActions.length > 1, "Secondary actions should exist (always/never remember)"); |
michael@0 | 35 | } |
michael@0 | 36 | notification.remove(); |
michael@0 | 37 | |
michael@0 | 38 | aWindow.gBrowser.removeCurrentTab(); |
michael@0 | 39 | aCallback(); |
michael@0 | 40 | } |
michael@0 | 41 | runTest(); |
michael@0 | 42 | }, true); |
michael@0 | 43 | }); |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | let windowsToClose = []; |
michael@0 | 47 | function testOnWindow(options, callback) { |
michael@0 | 48 | let win = OpenBrowserWindow(options); |
michael@0 | 49 | win.addEventListener("load", function onLoad() { |
michael@0 | 50 | win.removeEventListener("load", onLoad, false); |
michael@0 | 51 | windowsToClose.push(win); |
michael@0 | 52 | callback(win); |
michael@0 | 53 | }, false); |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | registerCleanupFunction(function() { |
michael@0 | 57 | windowsToClose.forEach(function(win) { |
michael@0 | 58 | win.close(); |
michael@0 | 59 | }); |
michael@0 | 60 | }); |
michael@0 | 61 | |
michael@0 | 62 | testOnWindow({private: false}, function(win) { |
michael@0 | 63 | checkGeolocation(false, win, function() { |
michael@0 | 64 | testOnWindow({private: true}, function(win) { |
michael@0 | 65 | checkGeolocation(true, win, finish); |
michael@0 | 66 | }); |
michael@0 | 67 | }); |
michael@0 | 68 | }); |
michael@0 | 69 | } |