runtime.js 834 B

123456789101112131415161718192021222324252627
  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/. */
  4. "use strict";
  5. module.metadata = {
  6. "stability": "unstable"
  7. };
  8. const { Cc, Ci } = require("chrome");
  9. const runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
  10. exports.inSafeMode = runtime.inSafeMode;
  11. exports.OS = runtime.OS;
  12. exports.processType = runtime.processType;
  13. exports.widgetToolkit = runtime.widgetToolkit;
  14. // Attempt to access `XPCOMABI` may throw exception, in which case exported
  15. // `XPCOMABI` will be set to `null`.
  16. // https://mxr.mozilla.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp#732
  17. try {
  18. exports.XPCOMABI = runtime.XPCOMABI;
  19. }
  20. catch (error) {
  21. exports.XPCOMABI = null;
  22. }