netwerk/test/unit/test_bug580508.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 let ioService = Cc["@mozilla.org/network/io-service;1"]
     2                 .getService(Ci.nsIIOService);
     3 let resProt = ioService.getProtocolHandler("resource")
     4               .QueryInterface(Ci.nsIResProtocolHandler);
     6 function run_test() {
     7     // Define a resource:// alias that points to another resource:// URI.
     8     let greModulesURI = ioService.newURI("resource://gre/modules/", null, null);
     9     resProt.setSubstitution("my-gre-modules", greModulesURI);
    11     // When we ask for the alias, we should not get the resource://
    12     // URI that we registered it for but the original file URI.
    13     let greFileSpec = ioService.newURI("modules/", null,
    14                                        resProt.getSubstitution("gre")).spec;
    15     let aliasURI = resProt.getSubstitution("my-gre-modules");
    16     do_check_eq(aliasURI.spec, greFileSpec);
    18     // Resolving URIs using the original resource path and the alias
    19     // should yield the same result.
    20     let greNetUtilURI = ioService.newURI("resource://gre/modules/NetUtil.jsm",
    21                                          null, null);
    22     let myNetUtilURI = ioService.newURI("resource://my-gre-modules/NetUtil.jsm",
    23                                         null, null);
    24     do_check_eq(resProt.resolveURI(greNetUtilURI),
    25                 resProt.resolveURI(myNetUtilURI));
    26 }

mercurial