|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = Components; |
|
5 |
|
6 let gSyncProfile = do_get_profile(); |
|
7 |
|
8 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
|
9 |
|
10 let XULAppInfo = { |
|
11 vendor: "Mozilla", |
|
12 name: "XPCShell", |
|
13 ID: "xpcshell@tests.mozilla.org", |
|
14 version: "1", |
|
15 appBuildID: "20100621", |
|
16 platformVersion: "", |
|
17 platformBuildID: "20100621", |
|
18 inSafeMode: false, |
|
19 logConsoleErrors: true, |
|
20 OS: "XPCShell", |
|
21 XPCOMABI: "noarch-spidermonkey", |
|
22 QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]), |
|
23 invalidateCachesOnRestart: function invalidateCachesOnRestart() { } |
|
24 }; |
|
25 |
|
26 let XULAppInfoFactory = { |
|
27 createInstance: function (outer, iid) { |
|
28 if (outer != null) |
|
29 throw Cr.NS_ERROR_NO_AGGREGATION; |
|
30 return XULAppInfo.QueryInterface(iid); |
|
31 } |
|
32 }; |
|
33 |
|
34 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
|
35 registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), |
|
36 "XULAppInfo", "@mozilla.org/xre/app-info;1", |
|
37 XULAppInfoFactory); |
|
38 |
|
39 function addResourceAlias() { |
|
40 Cu.import("resource://gre/modules/Services.jsm"); |
|
41 const handler = Services.io.getProtocolHandler("resource") |
|
42 .QueryInterface(Ci.nsIResProtocolHandler); |
|
43 |
|
44 let modules = ["common", "crypto"]; |
|
45 for each (let module in modules) { |
|
46 let uri = Services.io.newURI("resource://gre/modules/services-" + module + "/", |
|
47 null, null); |
|
48 handler.setSubstitution("services-" + module, uri); |
|
49 } |
|
50 } |
|
51 addResourceAlias(); |