netwerk/test/unit/test_bug337744.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     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