xpcshell.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @fileoverview Defines the environment for xpcshell test 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. var { getScriptGlobals } = require("./utils");
  10. const extraGlobals = [
  11. // Defined in XPCShellImpl.cpp
  12. "print",
  13. "readline",
  14. "load",
  15. "quit",
  16. "dumpXPC",
  17. "dump",
  18. "gc",
  19. "gczeal",
  20. "options",
  21. "sendCommand",
  22. "atob",
  23. "btoa",
  24. "setInterruptCallback",
  25. "simulateNoScriptActivity",
  26. "registerXPCTestComponents",
  27. // Assert.sys.mjs globals.
  28. "setReporter",
  29. "report",
  30. "ok",
  31. "equal",
  32. "notEqual",
  33. "deepEqual",
  34. "notDeepEqual",
  35. "strictEqual",
  36. "notStrictEqual",
  37. "throws",
  38. "rejects",
  39. "greater",
  40. "greaterOrEqual",
  41. "less",
  42. "lessOrEqual",
  43. // TestingFunctions.cpp globals
  44. "allocationMarker",
  45. "byteSize",
  46. "saveStack",
  47. ];
  48. module.exports = getScriptGlobals(
  49. "xpcshell",
  50. ["testing/xpcshell/head.js"],
  51. extraGlobals.map(g => {
  52. return { name: g, writable: false };
  53. })
  54. );