[go: up one dir, main page]

Skip to content
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

"unloading document cleanup steps" run in an unclear order #8906

Open
domenic opened this issue Feb 17, 2023 · 0 comments
Open

"unloading document cleanup steps" run in an unclear order #8906

domenic opened this issue Feb 17, 2023 · 0 comments

Comments

@domenic
Copy link
Member
domenic commented Feb 17, 2023

As noted in https://html.spec.whatwg.org/#unloading-document-cleanup-steps, the "unloading document cleanup steps" run in an unclear order. This is because of their architecture where other specifications can define "unloading document cleanup steps", with no central coordination.

The goal of this issue is to invert the setup, so that HTML defines a single set of "unloading document cleanup steps", which calls out to all possible specs that need to do such cleanup. And, importantly, HTML will do this in a specific order, since in some cases this order will be observable.

I'd split this work into two tasks:

Move "unloading document cleanup steps" into HTML, in unknown order

This consists of sending a series of pull requests to all of the specs listed here, and then to HTML in turn.

A simple example would be Fullscreen. Send a PR to fullscreen deleting that line; then send a PR to HTML adding a new step to https://html.spec.whatwg.org/#unloading-document-cleanup-steps which consists of "fully exit fullscreen given document".

A more complicated example might be Screen Orientation: it has two steps, not just a single algorithm. So probably we'd want to send a PR to Screen Orientation which encapsulates those two steps into some algorithm with a name like "clean up screen orientation when unloading a document". Then, send a PR to HTML which calls Screen Orientation's new "clean up screen orientation when unloading a document" algorithm.

The first PR in this series should make it clear that the order of these steps is not known, by adding something like

<p class="XXX">From here on out, the order of these steps (and whether they happen before or after the previous steps) is not known. <a href="https://github.com/whatwg/html/issues/8906">Issue #8906</a> tracks determining this order.</p>

When no references to "unloading document cleanup steps" remain in the spec ecosystem, we can remove the export from its <dfn> in HTML, and we can remove references to other specifications defining more. That will close this sub-task.

Determine the order of unloading document cleanup steps

This involves writing web platform tests that try to probe the observable consequences of various unloading document cleanup steps.

Not all cleanup steps will be observable. But some definitely are. For example, closing an EventSource object sets its readyState to CLOSED. Exiting fullscreen removes the element from the top layer. Closing down WebAudio rejects some promises.

The goal is to create a test page that uses as many of these features as possible, and then records the results. This will tell us any ordering constraints. We can then encode this into the spec.

For non-observable items, we should explicitly annotate them in the source with comments, so that we know that they have been audited.

This work can be done before moving everything into HTML, as long as we record the results in the spec, e.g. by updating the red box currently in https://html.spec.whatwg.org/#unloading-document-cleanup-steps.

This work can be done incrementally, by only testing e.g. two observable cleanup steps first, locking in our knowledge of their relative order, and then expanding the test to more cleanup steps over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant