netwerk/test/unit/test_bug337744.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 /* verify that certain invalid URIs are not parsed by the resource
     2    protocol handler */
     4 const specs = [
     5   "resource:////",
     6   "resource:///http://www.mozilla.org/",
     7   "resource:///file:///",
     8   "resource:///..\\",
     9   "resource:///..\\..\\",
    10   "resource:///..%5C",
    11   "resource:///..%5c"
    12 ];
    14 function check_for_exception(spec)
    15 {
    16   var ios =
    17     Cc["@mozilla.org/network/io-service;1"].
    18     getService(Ci.nsIIOService);
    20   try {
    21     var channel = ios.newChannel(spec, null, null);
    22   }
    23   catch (e) {
    24     return;
    25   }
    27   do_throw("Successfully opened invalid URI: '" + spec + "'");
    28 }
    30 function run_test() {
    31   for each (spec in specs) {
    32     check_for_exception(spec);
    33   }
    34 }

mercurial