toolkit/components/startup/tests/unit/head_startup.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const XULRUNTIME_CONTRACTID = "@mozilla.org/xre/runtime;1";
     5 const XULRUNTIME_CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
     7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     9 let gAppInfo = null;
    11 function createAppInfo(id, name, version, platformVersion) {
    12   gAppInfo = {
    13     // nsIXULAppInfo
    14     vendor: "Mozilla",
    15     name: name,
    16     ID: id,
    17     version: version,
    18     appBuildID: "2007010101",
    19     platformVersion: platformVersion ? platformVersion : "1.0",
    20     platformBuildID: "2007010101",
    22     // nsIXULRuntime
    23     inSafeMode: false,
    24     logConsoleErrors: true,
    25     OS: "XPCShell",
    26     replacedLockTime: 0,
    27     XPCOMABI: "noarch-spidermonkey",
    28     invalidateCachesOnRestart: function invalidateCachesOnRestart() {
    29       // Do nothing
    30     },
    32     // nsICrashReporter
    33     annotations: {
    34     },
    36     annotateCrashReport: function(key, data) {
    37       this.annotations[key] = data;
    38     },
    40     QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
    41                                            Ci.nsIXULRuntime,
    42                                            Ci.nsICrashReporter,
    43                                            Ci.nsISupports])
    44   };
    46   let XULAppInfoFactory = {
    47     createInstance: function (outer, iid) {
    48       if (outer != null)
    49         throw Components.results.NS_ERROR_NO_AGGREGATION;
    50       return gAppInfo.QueryInterface(iid);
    51     }
    52   };
    53   let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
    54   registrar.registerFactory(XULRUNTIME_CID, "XULRuntime",
    55                             XULRUNTIME_CONTRACTID, XULAppInfoFactory);
    57 }

mercurial