netwerk/test/unit/test_bug337744.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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