jsm.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * @fileoverview Defines the environment for jsm files.
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. "use strict";
  9. module.exports = {
  10. globals: {
  11. // These globals are hard-coded and available in .jsm scopes.
  12. // https://searchfox.org/mozilla-central/rev/dcb0cfb66e4ed3b9c7fbef1e80572426ff5f3c3a/js/xpconnect/loader/mozJSModuleLoader.cpp#222-223
  13. // Although `debug` is allowed for jsm files, this is non-standard and something
  14. // we don't want to allow in mjs files. Hence it is not included here.
  15. atob: false,
  16. btoa: false,
  17. dump: false,
  18. // The WebAssembly global is available in most (if not all) contexts where
  19. // JS can run. It's definitely available in JSMs. So even if this is not
  20. // the perfect place to add it, it's not wrong, and we can move it later.
  21. WebAssembly: false,
  22. // These are hard-coded and available in .jsm scopes.
  23. // See BackstagePass::Resolve.
  24. fetch: false,
  25. crypto: false,
  26. indexedDB: false,
  27. structuredClone: false,
  28. },
  29. };