-
Notifications
You must be signed in to change notification settings - Fork 142
[worklets] addModule() should reject a promise with a more specific exception #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Filed an issue in crbug: https://bugs.chromium.org/p/chromium/issues/detail?id=782066 |
How about using module script's error to rethrow? (If the module script is non-null) |
@hiroshige-g Sounds good. @bfgeek Would it be possible to change the worklet spec based on hiroshige's suggestion? According to the feedback on chromium's bug tracker, this makes it difficult for developers to use worklets. |
@nhiroki I won't have time to make the spec change until later, but it sounds good, and you should make the change in chrome. If you cc me on the patch I can make sure it'll work with the spec. If you like you can always submit a PR to the spec! Ian |
@bfgeek Thanks! I'll make a patch for chrome and try to change the spec. |
It turned out that Error objects are not cloneable (see crbug.com/82066#c10 for details) and cannot be passed between threads. It may be necessary to re-construct an Error object on the document side. |
Related WebAudio/web-audio-api#1846. A |
Error objects can now be cloned. See whatwg/html#4268 |
…parse worklet script and don't suppress SyntaxErrors r=baku https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script requires that the addModule() promise is rejected with an "AbortError" DOMException. w3c/css-houdini-drafts#509 proposes a more specific error, but that has not been implemented in another browser. StealExceptionFromJSContext() set ErrorCode to NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION if there was a pending exception (or NS_ERROR_OUT_OF_MEMORY on failure to record the JS exception) or NS_ERROR_UNCATCHABLE_EXCEPTION if there was no pending exception. StealNSResult() converted NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION to NS_ERROR_DOM_INVALID_STATE_ERR. Information about the error is lost on conversion of a SyntaxError to the promise rejection, so allow the SyntaxError to be reported the console. Depends on D44601 Differential Revision: https://phabricator.services.mozilla.com/D44602 --HG-- extra : moz-landing-system : lando
…parse worklet script and don't suppress SyntaxErrors r=baku https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script requires that the addModule() promise is rejected with an "AbortError" DOMException. w3c/css-houdini-drafts#509 proposes a more specific error, but that has not been implemented in another browser. StealExceptionFromJSContext() set ErrorCode to NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION if there was a pending exception (or NS_ERROR_OUT_OF_MEMORY on failure to record the JS exception) or NS_ERROR_UNCATCHABLE_EXCEPTION if there was no pending exception. StealNSResult() converted NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION to NS_ERROR_DOM_INVALID_STATE_ERR. Information about the error is lost on conversion of a SyntaxError to the promise rejection, so allow the SyntaxError to be reported the console. Depends on D44601 Differential Revision: https://phabricator.services.mozilla.com/D44602
…parse worklet script and don't suppress SyntaxErrors r=baku https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script requires that the addModule() promise is rejected with an "AbortError" DOMException. w3c/css-houdini-drafts#509 proposes a more specific error, but that has not been implemented in another browser. StealExceptionFromJSContext() set ErrorCode to NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION if there was a pending exception (or NS_ERROR_OUT_OF_MEMORY on failure to record the JS exception) or NS_ERROR_UNCATCHABLE_EXCEPTION if there was no pending exception. StealNSResult() converted NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION to NS_ERROR_DOM_INVALID_STATE_ERR. Information about the error is lost on conversion of a SyntaxError to the promise rejection, so allow the SyntaxError to be reported the console. Depends on D44601 Differential Revision: https://phabricator.services.mozilla.com/D44602 UltraBlame original commit: 509d3ab24880efa860a15cd10d8dccd68ba17508
…parse worklet script and don't suppress SyntaxErrors r=baku https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script requires that the addModule() promise is rejected with an "AbortError" DOMException. w3c/css-houdini-drafts#509 proposes a more specific error, but that has not been implemented in another browser. StealExceptionFromJSContext() set ErrorCode to NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION if there was a pending exception (or NS_ERROR_OUT_OF_MEMORY on failure to record the JS exception) or NS_ERROR_UNCATCHABLE_EXCEPTION if there was no pending exception. StealNSResult() converted NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION to NS_ERROR_DOM_INVALID_STATE_ERR. Information about the error is lost on conversion of a SyntaxError to the promise rejection, so allow the SyntaxError to be reported the console. Depends on D44601 Differential Revision: https://phabricator.services.mozilla.com/D44602 UltraBlame original commit: 509d3ab24880efa860a15cd10d8dccd68ba17508
…parse worklet script and don't suppress SyntaxErrors r=baku https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script requires that the addModule() promise is rejected with an "AbortError" DOMException. w3c/css-houdini-drafts#509 proposes a more specific error, but that has not been implemented in another browser. StealExceptionFromJSContext() set ErrorCode to NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION if there was a pending exception (or NS_ERROR_OUT_OF_MEMORY on failure to record the JS exception) or NS_ERROR_UNCATCHABLE_EXCEPTION if there was no pending exception. StealNSResult() converted NS_ERROR_INTERNAL_ERRORRESULT_JS_EXCEPTION to NS_ERROR_DOM_INVALID_STATE_ERR. Information about the error is lost on conversion of a SyntaxError to the promise rejection, so allow the SyntaxError to be reported the console. Depends on D44601 Differential Revision: https://phabricator.services.mozilla.com/D44602 UltraBlame original commit: 509d3ab24880efa860a15cd10d8dccd68ba17508
The current spec defines that
addModule()
rejects a promise with "AbortError" DOMException in any case:This obfuscates the reason why
addModule()
failed and makes it hard to debug. It would be nice to reject it with a more specific exception like "NetworkError" and "SyntaxError".The text was updated successfully, but these errors were encountered: