Summary: | [JSC] Implement Error#cause | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Ross Kirsling <ross.kirsling> | ||||||||
Component: | New Bugs | Assignee: | Ross Kirsling <ross.kirsling> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | ews-watchlist, hi, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
See Also: |
https://bugs.webkit.org/show_bug.cgi?id=223404 https://bugs.webkit.org/show_bug.cgi?id=225535 |
||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 223407 | ||||||||||
Attachments: |
|
Description
Ross Kirsling
2021-03-16 20:15:34 PDT
Created attachment 423427 [details]
Patch
Comment on attachment 423427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423427&action=review > Source/JavaScriptCore/API/JSObjectRef.cpp:236 > JSValue message = argumentCount ? toJS(globalObject, arguments[0]) : jsUndefined(); > + JSValue options = argumentCount > 1 ? toJS(globalObject, arguments[1]) : jsUndefined(); > Structure* errorStructure = globalObject->errorStructure(); > - JSObject* result = ErrorInstance::create(globalObject, errorStructure, message); > + JSObject* result = ErrorInstance::create(globalObject, errorStructure, message, options); Note: We don't need to add support to JSObjectMakeError, but it's literally no extra effort to do so. Comment on attachment 423427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423427&action=review r=me > JSTests/stress/error-cause.js:6 > +const errorConstructors = [Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, AggregateError]; Can we add WebAssembly Errors if `typeof WebAssembly !== "undefined"`? Created attachment 423430 [details]
Patch
(In reply to Yusuke Suzuki from comment #3) > > JSTests/stress/error-cause.js:6 > > +const errorConstructors = [Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, AggregateError]; > > Can we add WebAssembly Errors if `typeof WebAssembly !== "undefined"`? Oops, we actually don't want to test these; their behavior hasn't changed (since they're not part of ECMA-262), it's just that they depend on ErrorInstance, whose interface changed. ChangeLog entry in JSTests/ChangeLog contains OOPS!. Created attachment 423435 [details]
Patch for landing
Committed r274552: <https://commits.webkit.org/r274552> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423435 [details]. Comment on attachment 423435 [details]
Patch for landing
This should probably be behind a JSC flag (it can be on by default though) since it's technically a feature, albeit a simple one.
Out of curiosity what does this look like in Web Inspector? Should it have special treatment there given that one of the motivations for this feature was for developer tooling/debugging/etc.? (In reply to Keith Miller from comment #10) > Comment on attachment 423435 [details] > Patch for landing > > This should probably be behind a JSC flag (it can be on by default though) > since it's technically a feature, albeit a simple one. Alright, I can add that to the WASM-related follow-up patch. (In reply to Devin Rousso from comment #11) > Out of curiosity what does this look like in Web Inspector? Should it have > special treatment there given that one of the motivations for this feature > was for developer tooling/debugging/etc.? It should look the same as before for now. It would make sense to have a helpful display for this information, though of course it's possible to use this information for non-debugging purposes too -- to give better error messages, to do different things based on the first error in the cascade, etc. |