Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /** |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | const testPageURL = "http://mochi.test:8888/browser/" + |
michael@0 | 7 | "dom/indexedDB/test/browser_permissionsPrompt.html"; |
michael@0 | 8 | const notificationID = "indexedDB-permissions-prompt"; |
michael@0 | 9 | |
michael@0 | 10 | function test() |
michael@0 | 11 | { |
michael@0 | 12 | waitForExplicitFinish(); |
michael@0 | 13 | // We want the prompt. |
michael@0 | 14 | PopupNotifications.transitionsEnabled = false; |
michael@0 | 15 | setPermission(testPageURL, "indexedDB", "allow"); |
michael@0 | 16 | executeSoon(test1); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function test1() |
michael@0 | 20 | { |
michael@0 | 21 | info("creating tab"); |
michael@0 | 22 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 23 | |
michael@0 | 24 | gBrowser.selectedBrowser.addEventListener("load", function () { |
michael@0 | 25 | gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 26 | |
michael@0 | 27 | setFinishedCallback(function(result, exception) { |
michael@0 | 28 | ok(!result, "No database created"); |
michael@0 | 29 | is(exception, "InvalidStateError", "Correct exception"); |
michael@0 | 30 | is(getPermission(testPageURL, "indexedDB"), |
michael@0 | 31 | Components.interfaces.nsIPermissionManager.DENY_ACTION, |
michael@0 | 32 | "Correct permission set"); |
michael@0 | 33 | gBrowser.removeCurrentTab(); |
michael@0 | 34 | executeSoon(test2); |
michael@0 | 35 | }); |
michael@0 | 36 | |
michael@0 | 37 | registerPopupEventHandler("popupshowing", function () { |
michael@0 | 38 | ok(true, "prompt showing"); |
michael@0 | 39 | }); |
michael@0 | 40 | registerPopupEventHandler("popupshown", function () { |
michael@0 | 41 | ok(true, "prompt shown"); |
michael@0 | 42 | triggerSecondaryCommand(this, 0); |
michael@0 | 43 | }); |
michael@0 | 44 | registerPopupEventHandler("popuphidden", function () { |
michael@0 | 45 | ok(true, "prompt hidden"); |
michael@0 | 46 | }); |
michael@0 | 47 | |
michael@0 | 48 | }, true); |
michael@0 | 49 | |
michael@0 | 50 | info("loading test page: " + testPageURL); |
michael@0 | 51 | content.location = testPageURL; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function test2() |
michael@0 | 55 | { |
michael@0 | 56 | info("creating tab"); |
michael@0 | 57 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 58 | gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; |
michael@0 | 59 | |
michael@0 | 60 | gBrowser.selectedBrowser.addEventListener("load", function () { |
michael@0 | 61 | gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 62 | |
michael@0 | 63 | setFinishedCallback(function(result, exception) { |
michael@0 | 64 | ok(!result, "No database created"); |
michael@0 | 65 | is(exception, "InvalidStateError", "Correct exception"); |
michael@0 | 66 | is(getPermission(testPageURL, "indexedDB"), |
michael@0 | 67 | Components.interfaces.nsIPermissionManager.DENY_ACTION, |
michael@0 | 68 | "Correct permission set"); |
michael@0 | 69 | gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false; |
michael@0 | 70 | unregisterAllPopupEventHandlers(); |
michael@0 | 71 | gBrowser.removeCurrentTab(); |
michael@0 | 72 | PopupNotifications.transitionsEnabled = true; |
michael@0 | 73 | executeSoon(test3); |
michael@0 | 74 | }); |
michael@0 | 75 | |
michael@0 | 76 | registerPopupEventHandler("popupshowing", function () { |
michael@0 | 77 | ok(false, "prompt showing"); |
michael@0 | 78 | }); |
michael@0 | 79 | registerPopupEventHandler("popupshown", function () { |
michael@0 | 80 | ok(false, "prompt shown"); |
michael@0 | 81 | }); |
michael@0 | 82 | registerPopupEventHandler("popuphidden", function () { |
michael@0 | 83 | ok(false, "prompt hidden"); |
michael@0 | 84 | }); |
michael@0 | 85 | |
michael@0 | 86 | }, true); |
michael@0 | 87 | |
michael@0 | 88 | info("loading test page: " + testPageURL); |
michael@0 | 89 | content.location = testPageURL; |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | function test3() |
michael@0 | 93 | { |
michael@0 | 94 | info("creating tab"); |
michael@0 | 95 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 96 | |
michael@0 | 97 | gBrowser.selectedBrowser.addEventListener("load", function () { |
michael@0 | 98 | gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 99 | |
michael@0 | 100 | setFinishedCallback(function(result, exception) { |
michael@0 | 101 | ok(!result, "No database created"); |
michael@0 | 102 | is(exception, "InvalidStateError", "Correct exception"); |
michael@0 | 103 | is(getPermission(testPageURL, "indexedDB"), |
michael@0 | 104 | Components.interfaces.nsIPermissionManager.DENY_ACTION, |
michael@0 | 105 | "Correct permission set"); |
michael@0 | 106 | gBrowser.removeCurrentTab(); |
michael@0 | 107 | unregisterAllPopupEventHandlers(); |
michael@0 | 108 | removePermission(testPageURL, "indexedDB"); |
michael@0 | 109 | executeSoon(finish); |
michael@0 | 110 | }); |
michael@0 | 111 | |
michael@0 | 112 | registerPopupEventHandler("popupshowing", function () { |
michael@0 | 113 | ok(false, "Shouldn't show a popup this time"); |
michael@0 | 114 | }); |
michael@0 | 115 | registerPopupEventHandler("popupshown", function () { |
michael@0 | 116 | ok(false, "Shouldn't show a popup this time"); |
michael@0 | 117 | }); |
michael@0 | 118 | registerPopupEventHandler("popuphidden", function () { |
michael@0 | 119 | ok(false, "Shouldn't show a popup this time"); |
michael@0 | 120 | }); |
michael@0 | 121 | |
michael@0 | 122 | }, true); |
michael@0 | 123 | |
michael@0 | 124 | info("loading test page: " + testPageURL); |
michael@0 | 125 | content.location = testPageURL; |
michael@0 | 126 | } |