services/common/tests/unit/head_global.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.

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

mercurial