toolkit/components/telemetry/tests/unit/head.js

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:b78b6503e96e
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4
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}");
8
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",
19
20 // nsIXULRuntime
21 inSafeMode: false,
22 logConsoleErrors: true,
23 OS: "XPCShell",
24 XPCOMABI: "noarch-spidermonkey",
25 invalidateCachesOnRestart: function invalidateCachesOnRestart() {
26 // Do nothing
27 },
28
29 // nsICrashReporter
30 annotations: {},
31
32 annotateCrashReport: function(key, data) {
33 this.annotations[key] = data;
34 },
35
36 QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
37 Ci.nsIXULRuntime,
38 Ci.nsICrashReporter,
39 Ci.nsISupports])
40 };
41
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