toolkit/content/tests/chrome/test_bug437844.xul

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet 
     4   href="chrome://mochikit/content/tests/SimpleTest/test.css"
     5   type="text/css"?>
     6 <!--
     7 https://bugzilla.mozilla.org/show_bug.cgi?id=437844
     8 https://bugzilla.mozilla.org/show_bug.cgi?id=348233
     9 -->
    10 <window title="Mozilla Bug 437844 and Bug 348233"
    11   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    13   <script type="application/javascript" 
    14           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    15   <script type="application/javascript" 
    16           src="chrome://mochikit/content/chrome-harness.js"></script>
    17   <script type="application/javascript"
    18           src="RegisterUnregisterChrome.js"></script>
    20   <body  xmlns="http://www.w3.org/1999/xhtml">
    21     <a target="_blank" 
    22        href="https://bugzilla.mozilla.org/show_bug.cgi?id=437844">
    23       Mozilla Bug 437844
    24     </a>
    25     <a target="_blank" 
    26        href="https://bugzilla.mozilla.org/show_bug.cgi?id=348233">
    27       Mozilla Bug 348233
    28     </a>
    30     <p id="display"></p>
    31     <div id="content" style="display: none">
    32     </div>
    33     <pre id="test">
    34     </pre>
    35   </body>
    37   <script class="testbody" type="application/javascript">
    38     <![CDATA[
    40       SimpleTest.expectAssertions(19, 20);
    42       /** Test for Bug 437844 and Bug 348233 **/
    43       SimpleTest.waitForExplicitFinish();
    45       let prefs = Components.classes["@mozilla.org/preferences-service;1"]
    46                             .getService(Components.interfaces.nsIPrefBranch);
    47       prefs.setCharPref("intl.uidirection.en-US", "rtl");
    49       let rootDir = getRootDirectory(window.location.href);
    50       let manifest = rootDir + "rtlchrome/rtl.manifest";
    52       //copy rtlchrome to profile/rtlchrome and generate .manifest
    53       let filePath = chromeURIToFile(manifest);
    54       let tempProfileDir = copyDirToTempProfile(filePath.path, 'rtlchrome');
    55       if (tempProfileDir.path.lastIndexOf('\\') >= 0) {
    56         manifest = "content rtlchrome /" + tempProfileDir.path.replace(/\\/g, '/') + "\n";
    57       } else {
    58         manifest = "content rtlchrome " + tempProfileDir.path + "\n";
    59       }
    60       manifest += "override chrome://global/locale/intl.css chrome://rtlchrome/content/rtlchrome/rtl.css\n";
    61       manifest += "override chrome://global/locale/global.dtd chrome://rtlchrome/content/rtlchrome/rtl.dtd\n";
    63       let cleanupFunc = createManifestTemporarily(tempProfileDir, manifest);
    65       // Load about:plugins in an iframe
    66       let frame = document.createElement("iframe");
    67       frame.setAttribute("src", "about:plugins");
    68       frame.addEventListener("load", function () {
    69           frame.removeEventListener("load", arguments.callee, false);
    70           is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales");
    72           let gDirSvc    = Components.classes["@mozilla.org/file/directory_service;1"].
    73                                       getService(Components.interfaces.nsIDirectoryService).
    74                                       QueryInterface(Components.interfaces.nsIProperties);
    75           let tmpd = gDirSvc.get("ProfD", Components.interfaces.nsIFile);
    77           frame = document.createElement("iframe");
    78           frame.setAttribute("src", "file://" + tmpd.path); // a file:// URI, bug 348233
    79           frame.addEventListener("load", function () {
    80               frame.removeEventListener("load", arguments.callee, false);
    82               is(frame.contentDocument.body.dir, "rtl", "file:// listings should be RTL in RTL locales");
    84               cleanupFunc();
    85               prefs.clearUserPref("intl.uidirection.en-US");
    86               SimpleTest.finish();
    87             }, false);
    88           document.documentElement.appendChild(frame);
    89         }, false);
    90       document.documentElement.appendChild(frame);
    92     ]]>
    93   </script>
    95 </window>

mercurial