Bug 292727
| Summary: | Error.isError() should also support DOMException | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Tetsuharu Ohzeki [UTC+9] <tetsuharu.ohzeki> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | webkit-bug-importer, woodlxf00 |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 292728 | ||
| Bug Blocks: | |||
Tetsuharu Ohzeki [UTC+9]
`Error.isError(new DOMException)` should be `true`, but it's not on https://github.com/WebKit/WebKit/tree/b6e7f29ea5831ff7f0c67baf36d5820969181eba
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Tetsuharu Ohzeki [UTC+9]
Pull request: https://github.com/WebKit/WebKit/pull/45113
Tetsuharu Ohzeki [UTC+9]
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
<rdar://problem/151390471>