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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:a80f32b420c4
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 const XULRUNTIME_CONTRACTID = "@mozilla.org/xre/runtime;1";
5 const XULRUNTIME_CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
6
7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
8
9 let gAppInfo = null;
10
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",
21
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 },
31
32 // nsICrashReporter
33 annotations: {
34 },
35
36 annotateCrashReport: function(key, data) {
37 this.annotations[key] = data;
38 },
39
40 QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
41 Ci.nsIXULRuntime,
42 Ci.nsICrashReporter,
43 Ci.nsISupports])
44 };
45
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);
56
57 }

mercurial