testing/modules/AppInfo.jsm
author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Mon, 17 Nov 2014 03:16:00 -0800
changeset 216081 c258debff3dab0196b2f442ff125f17a7ede9c3d
parent 120614 d7b65369292acf21eb8392413dd18067c3ff271d
child 239566 2f8060bb3f9417055bb2b701fde82ea02beb8918
permissions -rw-r--r--
Bumping gaia.json for 6 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/82204d99a4c4 Author: Dominic Kuo <dkuo@mozilla.com> Desc: Merge pull request #26146 from dominickuo/bug-1082938 Bug 1082938 - [Music] set play status to playing when play event fires, r=jimporter ======== https://hg.mozilla.org/integration/gaia-central/rev/958e4dddc74f Author: Dominic Kuo <dkuo@mozilla.com> Desc: Bug 1082938 - [Music] set play status to playing when play event fires ======== https://hg.mozilla.org/integration/gaia-central/rev/0ebefae658f4 Author: RickyChien <RickyChien@users.noreply.github.com> Desc: Merge pull request #26188 from RickyChien/bug-1022728 Bug 1022728 - Prevent building gaia when running ./build.sh gecko r=@cctuan ======== https://hg.mozilla.org/integration/gaia-central/rev/366a14e421f4 Author: Ricky Chien <ricky060709@gmail.com> Desc: Bug 1022728 - Prevent building gaia when running ./build.sh gecko ======== https://hg.mozilla.org/integration/gaia-central/rev/f386379f0d8d Author: Etienne Segonzac <etienne@segonzac.info> Desc: Merge pull request #25938 from etiennesegonzac/bug-1088166 Bug 1088166 - Adding sanity marionette JS tests for the TaskManager r=sfoster ======== https://hg.mozilla.org/integration/gaia-central/rev/082e9a35b762 Author: Etienne Segonzac <etienne@segonzac.info> Desc: Bug 1088166 - Adding sanity marionette JS tests for the TaskManager

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

this.EXPORTED_SYMBOLS = [
  "getAppInfo",
  "updateAppInfo",
];


const {interfaces: Ci, results: Cr, utils: Cu} = Components;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");

let APP_INFO = {
  vendor: "Mozilla",
  name: "xpcshell",
  ID: "xpcshell@tests.mozilla.org",
  version: "1",
  appBuildID: "20121107",
  platformVersion: "p-ver",
  platformBuildID: "20121106",
  inSafeMode: false,
  logConsoleErrors: true,
  OS: "XPCShell",
  XPCOMABI: "noarch-spidermonkey",
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]),
  invalidateCachesOnRestart: function() {},
};


/**
 * Obtain a reference to the current object used to define XULAppInfo.
 */
this.getAppInfo = function () { return APP_INFO; }

/**
 * Update the current application info.
 *
 * If the argument is defined, it will be the object used. Else, APP_INFO is
 * used.
 *
 * To change the current XULAppInfo, simply call this function. If there was
 * a previously registered app info object, it will be unloaded and replaced.
 */
this.updateAppInfo = function (obj) {
  obj = obj || APP_INFO;
  APP_INFO = obj;

  let id = Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}");
  let cid = "@mozilla.org/xre/app-info;1";
  let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);

  // Unregister an existing factory if one exists.
  try {
    let existing = Components.manager.getClassObjectByContractID(cid, Ci.nsIFactory);
    registrar.unregisterFactory(id, existing);
  } catch (ex) {}

  let factory = {
    createInstance: function (outer, iid) {
      if (outer != null) {
        throw Cr.NS_ERROR_NO_AGGREGATION;
      }

      return obj.QueryInterface(iid);
    },
  };

  registrar.registerFactory(id, "XULAppInfo", cid, factory);
};