1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/common/tests/unit/head_global.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = Components; 1.8 + 1.9 +let gSyncProfile = do_get_profile(); 1.10 + 1.11 +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.12 + 1.13 +let XULAppInfo = { 1.14 + vendor: "Mozilla", 1.15 + name: "XPCShell", 1.16 + ID: "xpcshell@tests.mozilla.org", 1.17 + version: "1", 1.18 + appBuildID: "20100621", 1.19 + platformVersion: "", 1.20 + platformBuildID: "20100621", 1.21 + inSafeMode: false, 1.22 + logConsoleErrors: true, 1.23 + OS: "XPCShell", 1.24 + XPCOMABI: "noarch-spidermonkey", 1.25 + QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]), 1.26 + invalidateCachesOnRestart: function invalidateCachesOnRestart() { } 1.27 +}; 1.28 + 1.29 +let XULAppInfoFactory = { 1.30 + createInstance: function (outer, iid) { 1.31 + if (outer != null) 1.32 + throw Cr.NS_ERROR_NO_AGGREGATION; 1.33 + return XULAppInfo.QueryInterface(iid); 1.34 + } 1.35 +}; 1.36 + 1.37 +let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); 1.38 +registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), 1.39 + "XULAppInfo", "@mozilla.org/xre/app-info;1", 1.40 + XULAppInfoFactory); 1.41 + 1.42 +function addResourceAlias() { 1.43 + Cu.import("resource://gre/modules/Services.jsm"); 1.44 + const handler = Services.io.getProtocolHandler("resource") 1.45 + .QueryInterface(Ci.nsIResProtocolHandler); 1.46 + 1.47 + let modules = ["common", "crypto"]; 1.48 + for each (let module in modules) { 1.49 + let uri = Services.io.newURI("resource://gre/modules/services-" + module + "/", 1.50 + null, null); 1.51 + handler.setSubstitution("services-" + module, uri); 1.52 + } 1.53 +} 1.54 +addResourceAlias();