webidl2js-wrapper.js 600 B

123456789101112131415
  1. "use strict";
  2. const DOMException = require("./lib/DOMException.js");
  3. // Special install function to make the DOMException inherit from Error.
  4. // https://heycam.github.io/webidl/#es-DOMException-specialness
  5. function installOverride(globalObject) {
  6. if (typeof globalObject.Error !== "function") {
  7. throw new Error("Internal error: Error constructor is not present on the given global object.");
  8. }
  9. DOMException.install(globalObject);
  10. Object.setPrototypeOf(globalObject.DOMException.prototype, globalObject.Error.prototype);
  11. }
  12. module.exports = {...DOMException, install: installOverride };