html
html copied to clipboard
Don't always consume user activation for close watchers
Closes #10046.
- [ ] At least two implementers are interested (and none opposed):
- Chromium
- @zcorpan or @lukewarlow, able to speak for Gecko or WebKit on this one?
- [ ] Tests are written and can be reviewed and commented upon at:
- TODO
- [x] Implementation bugs are filed:
- Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1512224
- Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=1859702 (general close request/close watcher bug)
- WebKit: https://bugs.webkit.org/show_bug.cgi?id=263305 (general close request/close watcher bug)
- Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): N/A
- Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): N/A
- [x] MDN issue is filed: Not necessary for this edge-case change
- [x] The top of this comment includes a clear commit message to use.
(See WHATWG Working Mode: Changes for more details.)
I'm implementing this in WebKit in a personal capacity there's no official standards position from WebKit yet.
Fwiw this change makes sense to me
My understanding is that this is bug fix to make CloseWatcher work as intended. OK for Mozilla.
https://github.com/web-platform-tests/wpt/pull/44024
Implementing this in Chromium has uncovered some significant bugs in the anti-abuse logic of close watchers. The new proposed spec allows infinite back-trapping, and the existing spec didn't have enough test coverage. A more significant overhaul will be needed. I think I have something almost working...
@domenic is there a PR for your overhaul so I can take a look through it? Just wondering how much I'll need to change the draft WebKit implementation
I have a work in progress Chromium CL. This version is passing all the tests but is ugly bad code; this version is my attempt at refactoring but it's now failing some of the tests, so we shouldn't trust it yet. But, it can give you an idea of what I expect the changes to look like:
- More first-class tracking of close watcher groups, instead of using "is grouped with previous" / "created with user activation".
- Tracking the amount of allowed groups, in a way that increments / decrements at appropriate points in time.
- Using those to figure out (a) when creating a new close watcher, whether it goes into the topmost existing group or a new group; (b) whether we can fire the cancel event.
Superseded by https://github.com/whatwg/html/pull/10168; any review over there is appreciated!