-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
How does CEReactions interact with thrown exceptions? #3217
Comments
The intent is to rethrow, if I recall. I will clarify this. |
I thought we settled on report the exception, similar to events. As the callbacks are invoked the moment just before you return from IDL, at which point it doesn't make sense for the algorithm to throw. |
For exceptions thrown by the reaction callbacks, yes. This issue is about exceptions thrown from the IDL actions defined for the setter or operation. So in my
|
Yeah, report an exception is not right; that would essentially mean adding [CEReactions] to APIs causes them to stop throwing exceptions despite their spec text. My thinking is that it should essentially do try {
runAlgorithm();
} finally {
runReactions(); // never throws, only reports exceptions
} That's what I intend to spec when I have a spare moment, although TPAC makes that a bit tricky. |
Assuming because TPAC is still underway and topics being discussed? |
@bzbarsky per https://dom.spec.whatwg.org/#dom-childnode-before it should throw before step 2. |
@domenic hmm, how many algorithms do we have that queue reactions and then throw? Range operations? |
Why? Any of the DOM append/insert methods can queue and then throw when passed a document fragment, I would think.... |
Hmm, sorry, that's not right. So I need to look carefully through the fuzzer testcase that caught this in Firefox to see what's throwing and what's queuing the callback. It's at view-source:https://bug1415761.bmoattachments.org/attachment.cgi?id=8926677 for what it's worth. |
The fuzzer testcase in https://bugzilla.mozilla.org/show_bug.cgi?id=1415761 is something like, customElements.define('custom-element', class extends HTMLElement {
disconnectedCallback() {}
});
var text = document.createTextNode('');
document.documentElement.appendChild(text);
var element = document.createElement('custom-element');
document.documentElement.appendChild(element);
text.before('', document.documentElement); The sequence of
So 3.3.) enqueues the callback and 4.2) throws the excpetion. |
Ah okay, so there are side effects before throwing. That's unfortunate, but I guess that's how it is. I think that's also the case for range APIs, but I haven't verified. #3217 (comment) seems reasonable. |
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k --HG-- extra : rebase_source : 107d331203d0d16062fa061569e822d3c6d5f2c9
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k
…ctions; The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k Upstreamed from https://bugzilla.mozilla.org/show_bug.cgi?id=1415761 [ci skip]
…ctions; The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. bugzilla-url: https://bugzilla-dev.allizom.org/show_bug.cgi?id=Bug 1415761 gecko-commit: df3695afb47e0598e3fb1425a7e2a0d16adf35ee gecko-integration-branch: central gecko-reviewers: bz
…ctions; The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. bugzilla-url: https://bugzilla-dev.allizom.org/show_bug.cgi?id=Bug 1415761 gecko-commit: df3695afb47e0598e3fb1425a7e2a0d16adf35ee gecko-integration-branch: central gecko-reviewers: bz
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k UltraBlame original commit: df3695afb47e0598e3fb1425a7e2a0d16adf35ee
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k UltraBlame original commit: df3695afb47e0598e3fb1425a7e2a0d16adf35ee
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k UltraBlame original commit: df3695afb47e0598e3fb1425a7e2a0d16adf35ee
…m elements reactions; The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. Tag UXP Issue #1344
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k --HG-- extra : rebase_source : 107d331203d0d16062fa061569e822d3c6d5f2c9
…m elements reactions; r=bz The spec was unclear on how CEReactions interact with thrown exceptions; see whatwg/html#3217. The spec is now being clarified in whatwg/html#3235. MozReview-Commit-ID: 521HprTRS7k --HG-- extra : rebase_source : 107d331203d0d16062fa061569e822d3c6d5f2c9
The spec says:
etc. What does that mean in cases when the actions throw an exception. Is the exception caught, the CEReactions run, then the exception rethrown? Do the CEReactions run while JS execution is in some bizarre "in the middle of trying to throw an exception" state? Do the "After executing the listed actions" bits not run?
A naive reading would suggest that the "After executing the listed actions" bits don't run, but that would fail to pop the element queue.
What Firefox apparently implemented is "CEReactions run while JS execution is in some bizarre state", which is bogus and we're going to need to change that.
Note that this situation can be triggered if the algorithm steps have side-effects that happen before throwing. The testcase that triggered the problem in Firefox uses something along the lines of:
which inserts a textnode and then throws...
@domenic @annevk
The text was updated successfully, but these errors were encountered: