toolkit/content/tests/browser/browser_default_image_filename.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

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

mercurial