mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix: align DOMException to webidl spec (#11259)
This commit is contained in:
parent
5addba2abc
commit
3c0267dbb5
2 changed files with 35 additions and 7 deletions
|
@ -10,8 +10,12 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
((window) => {
|
((window) => {
|
||||||
const { ObjectDefineProperty, ObjectEntries } =
|
const {
|
||||||
window.__bootstrap.primordials;
|
Error,
|
||||||
|
ObjectDefineProperty,
|
||||||
|
ObjectEntries,
|
||||||
|
ObjectSetPrototypeOf,
|
||||||
|
} = window.__bootstrap.primordials;
|
||||||
const webidl = window.__bootstrap.webidl;
|
const webidl = window.__bootstrap.webidl;
|
||||||
|
|
||||||
// Defined in WebIDL 4.3.
|
// Defined in WebIDL 4.3.
|
||||||
|
@ -72,13 +76,12 @@
|
||||||
|
|
||||||
// Defined in WebIDL 4.3.
|
// Defined in WebIDL 4.3.
|
||||||
// https://heycam.github.io/webidl/#idl-DOMException
|
// https://heycam.github.io/webidl/#idl-DOMException
|
||||||
class DOMException extends Error {
|
class DOMException {
|
||||||
#message = "";
|
#message = "";
|
||||||
#name = "";
|
#name = "";
|
||||||
#code = 0;
|
#code = 0;
|
||||||
|
|
||||||
constructor(message = "", name = "Error") {
|
constructor(message = "", name = "Error") {
|
||||||
super();
|
|
||||||
this.#message = webidl.converters.DOMString(message, {
|
this.#message = webidl.converters.DOMString(message, {
|
||||||
prefix: "Failed to construct 'DOMException'",
|
prefix: "Failed to construct 'DOMException'",
|
||||||
context: "Argument 1",
|
context: "Argument 1",
|
||||||
|
@ -105,8 +108,14 @@
|
||||||
get [Symbol.toStringTag]() {
|
get [Symbol.toStringTag]() {
|
||||||
return "DOMException";
|
return "DOMException";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Symbol.for("Deno.customInspect")]() {
|
||||||
|
return `DOMException: ${this.#message}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectSetPrototypeOf(DOMException.prototype, Error.prototype);
|
||||||
|
|
||||||
webidl.configurePrototype(DOMException);
|
webidl.configurePrototype(DOMException);
|
||||||
|
|
||||||
for (
|
for (
|
||||||
|
|
|
@ -629,10 +629,29 @@
|
||||||
"DOMException-constructor-and-prototype.any.html": true,
|
"DOMException-constructor-and-prototype.any.html": true,
|
||||||
"DOMException-constructor-behavior.any.html": true,
|
"DOMException-constructor-behavior.any.html": true,
|
||||||
"DOMException-custom-bindings.any.html": [
|
"DOMException-custom-bindings.any.html": [
|
||||||
"does not inherit from Error: class-side"
|
"If the implementation has a stack property on normal errors, it also does on DOMExceptions"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
}
|
"class-string-interface.any.html": [
|
||||||
|
"@@toStringTag exists on the prototype with the appropriate descriptor"
|
||||||
|
],
|
||||||
|
"class-string-iterator-prototype-object.any.html": true,
|
||||||
|
"global-immutable-prototype.any.html": [
|
||||||
|
"Setting to a different prototype"
|
||||||
|
],
|
||||||
|
"global-object-implicit-this-value.any.html": [
|
||||||
|
"Global object's getter throws when called on incompatible object",
|
||||||
|
"Global object's setter throws when called on incompatible object",
|
||||||
|
"Global object's operation throws when called on incompatible object",
|
||||||
|
"Global object's getter works when called on null / undefined",
|
||||||
|
"Global object's setter works when called on null / undefined"
|
||||||
|
],
|
||||||
|
"legacy-factor-function-subclass.window.html": false,
|
||||||
|
"no-regexp-special-casing.any.html": [
|
||||||
|
"Conversion to a sequence works"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"idlharness.any.html": true
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"historical.any.html": [
|
"historical.any.html": [
|
||||||
|
|
Loading…
Add table
Reference in a new issue