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.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = Components;
     6 let gSyncProfile = do_get_profile();
     8 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    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 };
    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 };
    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);
    39 function addResourceAlias() {
    40   Cu.import("resource://gre/modules/Services.jsm");
    41   const handler = Services.io.getProtocolHandler("resource")
    42                   .QueryInterface(Ci.nsIResProtocolHandler);
    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();

mercurial