michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: michael@0: // copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js michael@0: const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1"; michael@0: const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}"); michael@0: michael@0: function createAppInfo(id, name, version, platformVersion) { michael@0: gAppInfo = { michael@0: // nsIXULAppInfo michael@0: vendor: "Mozilla", michael@0: name: name, michael@0: ID: id, michael@0: version: version, michael@0: appBuildID: "2007010101", michael@0: platformVersion: platformVersion, michael@0: platformBuildID: "2007010101", michael@0: michael@0: // nsIXULRuntime michael@0: inSafeMode: false, michael@0: logConsoleErrors: true, michael@0: OS: "XPCShell", michael@0: XPCOMABI: "noarch-spidermonkey", michael@0: invalidateCachesOnRestart: function invalidateCachesOnRestart() { michael@0: // Do nothing michael@0: }, michael@0: michael@0: // nsICrashReporter michael@0: annotations: {}, michael@0: michael@0: annotateCrashReport: function(key, data) { michael@0: this.annotations[key] = data; michael@0: }, michael@0: michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, michael@0: Ci.nsIXULRuntime, michael@0: Ci.nsICrashReporter, michael@0: Ci.nsISupports]) michael@0: }; michael@0: michael@0: var XULAppInfoFactory = { michael@0: createInstance: function (outer, iid) { michael@0: if (outer != null) michael@0: throw Components.results.NS_ERROR_NO_AGGREGATION; michael@0: return gAppInfo.QueryInterface(iid); michael@0: } michael@0: }; michael@0: var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); michael@0: registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo", michael@0: XULAPPINFO_CONTRACTID, XULAppInfoFactory); michael@0: }