toolkit/components/telemetry/tests/unit/head.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/ */
     5 // copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js
     6 const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
     7 const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
     9 function createAppInfo(id, name, version, platformVersion) {
    10   gAppInfo = {
    11     // nsIXULAppInfo
    12     vendor: "Mozilla",
    13     name: name,
    14     ID: id,
    15     version: version,
    16     appBuildID: "2007010101",
    17     platformVersion: platformVersion,
    18     platformBuildID: "2007010101",
    20     // nsIXULRuntime
    21     inSafeMode: false,
    22     logConsoleErrors: true,
    23     OS: "XPCShell",
    24     XPCOMABI: "noarch-spidermonkey",
    25     invalidateCachesOnRestart: function invalidateCachesOnRestart() {
    26       // Do nothing
    27     },
    29     // nsICrashReporter
    30     annotations: {},
    32     annotateCrashReport: function(key, data) {
    33       this.annotations[key] = data;
    34     },
    36     QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
    37                                            Ci.nsIXULRuntime,
    38                                            Ci.nsICrashReporter,
    39                                            Ci.nsISupports])
    40   };
    42   var XULAppInfoFactory = {
    43     createInstance: function (outer, iid) {
    44       if (outer != null)
    45         throw Components.results.NS_ERROR_NO_AGGREGATION;
    46       return gAppInfo.QueryInterface(iid);
    47     }
    48   };
    49   var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
    50   registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
    51                             XULAPPINFO_CONTRACTID, XULAppInfoFactory);
    52 }

mercurial