You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
585 B

  1. "use strict";
  2. const legacyErrorCodes = require("./legacy-error-codes.json");
  3. const idlUtils = require("./utils.js");
  4. exports.implementation = class DOMExceptionImpl {
  5. constructor(globalObject, [message, name]) {
  6. this.name = name;
  7. this.message = message;
  8. }
  9. get code() {
  10. return legacyErrorCodes[this.name] || 0;
  11. }
  12. };
  13. // A proprietary V8 extension that causes the stack property to appear.
  14. exports.init = impl => {
  15. if (Error.captureStackTrace) {
  16. const wrapper = idlUtils.wrapperForImpl(impl);
  17. Error.captureStackTrace(wrapper, wrapper.constructor);
  18. }
  19. };