services/sync/tests/unit/head_appinfo.js

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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} = Components;
     6 let gSyncProfile;
     8 gSyncProfile = do_get_profile();
    10 // Init FormHistoryStartup and pretend we opened a profile.
    11 let fhs = Cc["@mozilla.org/satchel/form-history-startup;1"]
    12             .getService(Ci.nsIObserver);
    13 fhs.observe(null, "profile-after-change", null);
    16 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    18 // Make sure to provide the right OS so crypto loads the right binaries
    19 let OS = "XPCShell";
    20 if ("@mozilla.org/windows-registry-key;1" in Cc)
    21   OS = "WINNT";
    22 else if ("nsILocalFileMac" in Ci)
    23   OS = "Darwin";
    24 else
    25   OS = "Linux";
    27 let XULAppInfo = {
    28   vendor: "Mozilla",
    29   name: "XPCShell",
    30   ID: "xpcshell@tests.mozilla.org",
    31   version: "1",
    32   appBuildID: "20100621",
    33   platformVersion: "",
    34   platformBuildID: "20100621",
    35   inSafeMode: false,
    36   logConsoleErrors: true,
    37   OS: OS,
    38   XPCOMABI: "noarch-spidermonkey",
    39   QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]),
    40   invalidateCachesOnRestart: function invalidateCachesOnRestart() { }
    41 };
    43 let XULAppInfoFactory = {
    44   createInstance: function (outer, iid) {
    45     if (outer != null)
    46       throw Cr.NS_ERROR_NO_AGGREGATION;
    47     return XULAppInfo.QueryInterface(iid);
    48   }
    49 };
    51 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
    52 registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
    53                           "XULAppInfo", "@mozilla.org/xre/app-info;1",
    54                           XULAppInfoFactory);
    57 // Register resource aliases. Normally done in SyncComponents.manifest.
    58 function addResourceAlias() {
    59   Cu.import("resource://gre/modules/Services.jsm");
    60   const resProt = Services.io.getProtocolHandler("resource")
    61                           .QueryInterface(Ci.nsIResProtocolHandler);
    62   for each (let s in ["common", "sync", "crypto"]) {
    63     let uri = Services.io.newURI("resource://gre/modules/services-" + s + "/", null,
    64                                  null);
    65     resProt.setSubstitution("services-" + s, uri);
    66   }
    67 }
    68 addResourceAlias();

mercurial