1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 this.EXPORTED_SYMBOLS = [
13 const {interfaces: Ci, results: Cr, utils: Cu} = Components;
15 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
20 ID: "xpcshell@tests.mozilla.org",
22 appBuildID: "20121107",
23 platformVersion: "p-ver",
24 platformBuildID: "20121106",
26 logConsoleErrors: true,
28 XPCOMABI: "noarch-spidermonkey",
29 QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]),
30 invalidateCachesOnRestart: function() {},
35 * Obtain a reference to the current object used to define XULAppInfo.
37 this.getAppInfo = function () { return APP_INFO; }
40 * Update the current application info.
42 * If the argument is defined, it will be the object used. Else, APP_INFO is
45 * To change the current XULAppInfo, simply call this function. If there was
46 * a previously registered app info object, it will be unloaded and replaced.
48 this.updateAppInfo = function (obj) {
49 obj = obj || APP_INFO;
52 let id = Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}");
53 let cid = "@mozilla.org/xre/app-info;1";
54 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
56 // Unregister an existing factory if one exists.
58 let existing = Components.manager.getClassObjectByContractID(cid, Ci.nsIFactory);
59 registrar.unregisterFactory(id, existing);
63 createInstance: function (outer, iid) {
65 throw Cr.NS_ERROR_NO_AGGREGATION;
68 return obj.QueryInterface(iid);
72 registrar.registerFactory(id, "XULAppInfo", cid, factory);