NEW292727
Error.isError() should also support DOMException
https://bugs.webkit.org/show_bug.cgi?id=292727
Summary Error.isError() should also support DOMException
Tetsuharu Ohzeki [UTC+9]
Reported 2025-05-08 09:19:06 PDT
`Error.isError(new DOMException)` should be `true`, but it's not on https://github.com/WebKit/WebKit/tree/b6e7f29ea5831ff7f0c67baf36d5820969181eba
Attachments
Tetsuharu Ohzeki [UTC+9]
Comment 1 2025-05-08 09:21:47 PDT
Tetsuharu Ohzeki [UTC+9]
Comment 2 2025-05-08 09:51:54 PDT
By the spec, `Error.isError(new DOMException)` should be `true`: 1. Error.isError see whether the given object has `[[ErrorData]]` internal slot. https://tc39.es/proposal-is-error/#sec-abstract-operations-for-error-objects 2. DOMException would also has `[[ErrorData]]` internal slot. https://webidl.spec.whatwg.org/#js-DOMException-specialness ---- Our implementations of Error.isError uses `JSC::JSObject::isErrorInstance()` internally and checks whether the `JSCell::type()` is `JSC::JSType::ErrorInstanceType`. But `WebCore::JSDOMException::createStructure()` passes `JSC::TypeInfo(JSC::ObjectType, StructureFlags)` for the `typeInfo` 3rd arguments of `JSC::Structure::create()`. This causes `Error.isError(new DOMException) === false`.
Radar WebKit Bug Importer
Comment 3 2025-05-15 09:25:13 PDT
Note You need to log in before you can comment on or make changes to this bug.