-
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
Need to be clearer about how aborted/terminated script evaluations are handled #715
Comments
These have always been done in a very hand-wavey way by the spec. E.g. in #terminate-a-worker, "Abort the script currently running in the worker" is the best we get, and in #run-a-worker, we have the note
(this note was there before my recent changes). But yeah, let's try to clean this up a bit. I think what would work is:
An alternate approach would be to try to make aborting a ScriptEvaluation a more first-class thing in ES, similar to your uncatchable abrupt completion. But that could be done later, IMO. |
That plan sounds fine to me. |
@bzbarsky do these uncatchable exceptions trigger |
Good question. They do not. |
Previously it wasn't clear exactly which parts of the processing model the vague phrase "abort the script" impacted. This gives us a specific term that at least outlines the concept, and makes all other places that are impacted by script abortion reference that term.
In https://html.spec.whatwg.org/multipage/webappapis.html#run-a-classic-script we have:
and then the assertion is that if
evaluationStatus
is an abrupt completion then its[[value]]
is "an error object". Ignoring for the moment that it might not be an object at all (c.f.throw 5
), the problem is what happens ifScriptEvaluation
gets aborted by something like worker termination or the slow script detection in browsers. In that situation we do NOT want to end up in step 10 at all, I believe. We should instead end up in step 11, but callers should be able to detect the abort condition somehow.As a data point, the way this is implemented in Gecko right now is that
ScriptEvaluation
returns an abrupt completion with no[[value]]
when script is aborted. Callers then know that this situation means an abort happened. Of course that state needs to be propagated back out as needed, but ourErrorResult
struct has an explicit representation for this case (which we call an "uncatchable exception").The text was updated successfully, but these errors were encountered: