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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | var MockFilePicker = SpecialPowers.MockFilePicker; |
michael@0 | 5 | MockFilePicker.init(window); |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * TestCase for bug 564387 |
michael@0 | 9 | * <https://bugzilla.mozilla.org/show_bug.cgi?id=564387> |
michael@0 | 10 | */ |
michael@0 | 11 | function test() { |
michael@0 | 12 | waitForExplicitFinish(); |
michael@0 | 13 | var fileName; |
michael@0 | 14 | |
michael@0 | 15 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 16 | |
michael@0 | 17 | gBrowser.loadURI("data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7"); |
michael@0 | 18 | |
michael@0 | 19 | registerCleanupFunction(function () { |
michael@0 | 20 | gBrowser.removeCurrentTab(); |
michael@0 | 21 | }); |
michael@0 | 22 | |
michael@0 | 23 | gBrowser.addEventListener("pageshow", function pageShown(event) { |
michael@0 | 24 | if (event.target.location == "about:blank") |
michael@0 | 25 | return; |
michael@0 | 26 | gBrowser.removeEventListener("pageshow", pageShown); |
michael@0 | 27 | |
michael@0 | 28 | executeSoon(function () { |
michael@0 | 29 | document.addEventListener("popupshown", contextMenuOpened); |
michael@0 | 30 | |
michael@0 | 31 | var img = gBrowser.contentDocument.getElementsByClassName("decoded")[0]; |
michael@0 | 32 | EventUtils.synthesizeMouseAtCenter(img, |
michael@0 | 33 | { type: "contextmenu", button: 2 }, |
michael@0 | 34 | gBrowser.contentWindow); |
michael@0 | 35 | }); |
michael@0 | 36 | }); |
michael@0 | 37 | |
michael@0 | 38 | function contextMenuOpened(event) { |
michael@0 | 39 | event.currentTarget.removeEventListener("popupshown", contextMenuOpened); |
michael@0 | 40 | |
michael@0 | 41 | MockFilePicker.showCallback = function(fp) { |
michael@0 | 42 | is(fp.defaultString, "index.gif"); |
michael@0 | 43 | executeSoon(finish); |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | registerCleanupFunction(function () { |
michael@0 | 47 | MockFilePicker.cleanup(); |
michael@0 | 48 | }); |
michael@0 | 49 | |
michael@0 | 50 | // Select "Save Image As" option from context menu |
michael@0 | 51 | var saveImageAsCommand = document.getElementById("context-saveimage"); |
michael@0 | 52 | saveImageAsCommand.doCommand(); |
michael@0 | 53 | |
michael@0 | 54 | event.target.hidePopup(); |
michael@0 | 55 | } |
michael@0 | 56 | } |