3 var ioService
= Services
.io
;
4 var resProt
= ioService
5 .getProtocolHandler("resource")
6 .QueryInterface(Ci
.nsIResProtocolHandler
);
9 // Define a resource:// alias that points to another resource:// URI.
10 let greModulesURI
= ioService
.newURI("resource://gre/modules/");
11 resProt
.setSubstitution("my-gre-modules", greModulesURI
);
13 // When we ask for the alias, we should not get the resource://
14 // URI that we registered it for but the original file URI.
15 let greFileSpec
= ioService
.newURI(
18 resProt
.getSubstitution("gre")
20 let aliasURI
= resProt
.getSubstitution("my-gre-modules");
21 Assert
.equal(aliasURI
.spec
, greFileSpec
);
23 // Resolving URIs using the original resource path and the alias
24 // should yield the same result.
25 let greNetUtilURI
= ioService
.newURI("resource://gre/modules/NetUtil.jsm");
26 let myNetUtilURI
= ioService
.newURI("resource://my-gre-modules/NetUtil.jsm");
28 resProt
.resolveURI(greNetUtilURI
),
29 resProt
.resolveURI(myNetUtilURI
)