-
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
Mutating the close watcher stack during a close request #10240
Comments
That's not what I see in https://html.spec.whatwg.org/#close-watcher-destroy ? Can you quote the line you're referring to? |
Sorry you're right I meant the Process steps: https://html.spec.whatwg.org/#process-close-watchers |
I see. So I think the ultimate problem here is whatwg/infra#396. I think there are two possible patches. Make a cloneMake a clone of group between steps 2.1 and 2.2. After that, I think everything works relatively fine. If you destroy a close watcher in group then "requesting to close" will just bail. If you add a new close watcher, then we'll just ignore it, which seems OK-ish? Switch to poppingChange step 2 to something like "While group is not empty, let closeWatcher be the last item in group." This again works fine with deletes. And if you add a new close watcher to the group, we'll process it. I think of these I prefer "switch to popping". I also considered reevaluating "let group be the last item in window's close watcher manager's groups" each time. But that seems bad. Processing half of one group then switching to another is weird. We could force all close watchers created inside of close watcher callbacks to be grouped, which would prevent that situation from happening. I'm not sure it buys us much. The hardest part of fixing this will be adding WPTs, because with this sort of edge case behavior there are a lot of them. Some suggestions:
Not all would be mandatory to land a fix here but they'd certainly be appreciated :) |
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/interaction.html#close-watcher-destroyhttps://html.spec.whatwg.org/#process-close-watchers
I'm trying to implement
CloseWatcher
in gecko. For thedestroyprocess steps, the spec states that todestroyprocess a close watcher the last group is iterated over and for each itemRequestClose()
is called, until the list is either empty or acancel
event prevents default. However if in a cancel event, anew CloseWatcher()
is created, or an existingCloseWatcher
is destroyed, then it seems the list is altered?Are there any mitigations in place to cover this? What happens in these scenarios?
/cc @domenic @lukewarlow @emilio
(Meta: should we add a
topic: closewatcher
label?)The text was updated successfully, but these errors were encountered: