mirror of
https://github.com/denoland/deno.git
synced 2024-12-18 05:14:21 -05:00
feat(ext/web): add [[ErrorData]]
slot to DOMException
(#27342)
This commit is contained in:
parent
3ddbea62c2
commit
bf888d942a
3 changed files with 15 additions and 17 deletions
|
@ -9,14 +9,15 @@
|
||||||
|
|
||||||
import { primordials } from "ext:core/mod.js";
|
import { primordials } from "ext:core/mod.js";
|
||||||
const {
|
const {
|
||||||
|
Error,
|
||||||
ErrorPrototype,
|
ErrorPrototype,
|
||||||
ErrorCaptureStackTrace,
|
|
||||||
ObjectDefineProperty,
|
ObjectDefineProperty,
|
||||||
ObjectCreate,
|
ObjectCreate,
|
||||||
ObjectEntries,
|
ObjectEntries,
|
||||||
ObjectHasOwn,
|
ObjectHasOwn,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
|
ReflectConstruct,
|
||||||
Symbol,
|
Symbol,
|
||||||
SymbolFor,
|
SymbolFor,
|
||||||
} = primordials;
|
} = primordials;
|
||||||
|
@ -107,12 +108,14 @@ class DOMException {
|
||||||
);
|
);
|
||||||
const code = nameToCodeMapping[name] ?? 0;
|
const code = nameToCodeMapping[name] ?? 0;
|
||||||
|
|
||||||
this[_message] = message;
|
// execute Error constructor to have stack property and [[ErrorData]] internal slot
|
||||||
this[_name] = name;
|
const error = ReflectConstruct(Error, [], new.target);
|
||||||
this[_code] = code;
|
error[_message] = message;
|
||||||
this[webidl.brand] = webidl.brand;
|
error[_name] = name;
|
||||||
|
error[_code] = code;
|
||||||
|
error[webidl.brand] = webidl.brand;
|
||||||
|
|
||||||
ErrorCaptureStackTrace(this, DOMException);
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
get message() {
|
get message() {
|
||||||
|
|
|
@ -224,7 +224,7 @@ Deno.test({
|
||||||
fn() {
|
fn() {
|
||||||
assert(util.types.isNativeError(new Error()));
|
assert(util.types.isNativeError(new Error()));
|
||||||
assert(util.types.isNativeError(new TypeError()));
|
assert(util.types.isNativeError(new TypeError()));
|
||||||
assert(!util.types.isNativeError(new DOMException()));
|
assert(util.types.isNativeError(new DOMException()));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3594,16 +3594,13 @@
|
||||||
"DOMException-constructor-behavior.any.html": true,
|
"DOMException-constructor-behavior.any.html": true,
|
||||||
"DOMException-constructor-behavior.any.worker.html": true,
|
"DOMException-constructor-behavior.any.worker.html": true,
|
||||||
"DOMException-custom-bindings.any.html": true,
|
"DOMException-custom-bindings.any.html": true,
|
||||||
"DOMException-custom-bindings.any.worker.html": true
|
"DOMException-custom-bindings.any.worker.html": true,
|
||||||
|
"exceptions.html": false
|
||||||
},
|
},
|
||||||
"class-string-interface.any.html": true,
|
"class-string-interface.any.html": true,
|
||||||
"class-string-interface.any.worker.html": true,
|
"class-string-interface.any.worker.html": true,
|
||||||
"class-string-iterator-prototype-object.any.html": [
|
"class-string-iterator-prototype-object.any.html": true,
|
||||||
"Object.prototype.toString applied after deleting @@toStringTag"
|
"class-string-iterator-prototype-object.any.worker.html": true,
|
||||||
],
|
|
||||||
"class-string-iterator-prototype-object.any.worker.html": [
|
|
||||||
"Object.prototype.toString applied after deleting @@toStringTag"
|
|
||||||
],
|
|
||||||
"class-string-named-properties-object.window.html": false,
|
"class-string-named-properties-object.window.html": false,
|
||||||
"global-immutable-prototype.any.html": [
|
"global-immutable-prototype.any.html": [
|
||||||
"Setting to a different prototype"
|
"Setting to a different prototype"
|
||||||
|
@ -9754,7 +9751,6 @@
|
||||||
"structured-cloning-error-stack-optional.sub.window.html": [
|
"structured-cloning-error-stack-optional.sub.window.html": [
|
||||||
"page-created Error (cross-site iframe)",
|
"page-created Error (cross-site iframe)",
|
||||||
"page-created Error (same-origin iframe)",
|
"page-created Error (same-origin iframe)",
|
||||||
"page-created DOMException (structuredClone())",
|
|
||||||
"page-created DOMException (cross-site iframe)",
|
"page-created DOMException (cross-site iframe)",
|
||||||
"page-created DOMException (same-origin iframe)",
|
"page-created DOMException (same-origin iframe)",
|
||||||
"JS-engine-created TypeError (cross-site iframe)",
|
"JS-engine-created TypeError (cross-site iframe)",
|
||||||
|
@ -9762,8 +9758,7 @@
|
||||||
"web API-created TypeError (cross-site iframe)",
|
"web API-created TypeError (cross-site iframe)",
|
||||||
"web API-created TypeError (same-origin iframe)",
|
"web API-created TypeError (same-origin iframe)",
|
||||||
"web API-created DOMException (cross-site iframe)",
|
"web API-created DOMException (cross-site iframe)",
|
||||||
"web API-created DOMException (same-origin iframe)",
|
"web API-created DOMException (same-origin iframe)"
|
||||||
"page-created DOMException (worker)"
|
|
||||||
],
|
],
|
||||||
"transfer-errors.window.html": false,
|
"transfer-errors.window.html": false,
|
||||||
"window-postmessage.window.html": false
|
"window-postmessage.window.html": false
|
||||||
|
|
Loading…
Reference in a new issue