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.

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

mercurial