xpcom/tests/unit/test_bug478086.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.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/licenses/publicdomain/ */
michael@0 3
michael@0 4 function run_test() {
michael@0 5 var nsILocalFile = Components.interfaces.nsILocalFile;
michael@0 6 var root = Components.classes["@mozilla.org/file/local;1"].
michael@0 7 createInstance(nsILocalFile);
michael@0 8
michael@0 9 // copied from http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js#135
michael@0 10 // nsIXULRuntime.OS doesn't seem to be available in xpcshell, so we'll use
michael@0 11 // this as a kludgy way to figure out if we're running on Windows.
michael@0 12 var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
michael@0 13 if (isWindows) {
michael@0 14 root.initWithPath("\\\\.");
michael@0 15 } else {
michael@0 16 return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369).
michael@0 17 root.initWithPath("/");
michael@0 18 }
michael@0 19 var drives = root.directoryEntries;
michael@0 20 do_check_true(drives.hasMoreElements());
michael@0 21 while (drives.hasMoreElements()) {
michael@0 22 var newPath = drives.getNext().QueryInterface(nsILocalFile).path;
michael@0 23 do_check_eq(newPath.indexOf("\0"), -1);
michael@0 24 }
michael@0 25 }

mercurial