-
Notifications
You must be signed in to change notification settings - Fork 143
Long running scripts #236
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
In particular, painting proceeds while a slow script thing is up. So using a slow script thing for something that blocks painting is broken by design. |
We've discussed this previously at a F2F... there is a bit of context here / reasons for this. (1) A long running paint worklet script (on the main thread), isn't different to a long running script in the main js environment. Hence should put up a slow script dialog thing. (fundementally people can still do (2) We don't want to force implementors to explicitly run the paint worklet on a separate thread, just so that they can kill it if there is a (3) There is debate as to whether we want paint to explicitly block the frame, and I think the rough consensus at the moment is that we do; but to add an option later to skip a paint function if it is running too long. E.g. registerPaint('foo', class {
static get mayBeAsync() { return true; } // Implies can skip this if not enough time in a frame.
}); We haven't placed this in yet, as we want to see how authors actually use this initially before speccing something like this. There is some debate as to whether the UA can "intervene" and place known bad painters on a background thread and be async (i think this might be a good compromise), but again need more real world experience here. |
A long running paint worklet is different from a main JS script in one simple way: putting up a slow script thing does NOT require reentry into main JS script (and in fact, not reentering it is preferable). But you do want to keep painting the page instead of having stuff freeze up, for better UX. And that's what all this is about, really: this spec is trying to dictate UX, which is not really what it should be doing.
Why would that require having it on a separate thread? It totally doesn't, at least in the implemetations I'm familiar with. For example, the Firefox slow script dialog has a "kill script" option right there, which does just that. For a slow paint function we would just do that without bothering to ask the user and treat it just like we would treat the paint function throwing an exception. Which would produce an invalid image, per text already in the spec. |
Oh, just if you mandate it should produce an invalid image. In that case you imply that the pipeline can keep running and you need to place everything off in a separate thread, just in case you need to kill it. Anyway... so what we should actually be saying is something along the lines of: """ |
I'm still a bit confused by the "place everything off in a separate thread" bits and why that would be needed, but your proposed phrasing sounds fine as long as we make it clear that the UA is free to terminate the script and produce an invalid-image, not just leave the script running and produce an invalid-image. |
Sounds good. |
@bzbarsky
The text was updated successfully, but these errors were encountered: