html icon indicating copy to clipboard operation
html copied to clipboard

Don't always consume user activation for close watchers

Open domenic opened this issue 1 year ago • 6 comments
trafficstars

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.)


/interaction.html ( diff )

domenic avatar Jan 11 '24 02:01 domenic

I'm implementing this in WebKit in a personal capacity there's no official standards position from WebKit yet.

lukewarlow avatar Jan 11 '24 09:01 lukewarlow

Fwiw this change makes sense to me

lukewarlow avatar Jan 11 '24 10:01 lukewarlow

My understanding is that this is bug fix to make CloseWatcher work as intended. OK for Mozilla.

zcorpan avatar Jan 16 '24 14:01 zcorpan

https://github.com/web-platform-tests/wpt/pull/44024

josepharhar avatar Jan 17 '24 00:01 josepharhar

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 avatar Jan 24 '24 12:01 domenic

@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

lukewarlow avatar Feb 18 '24 21:02 lukewarlow

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.

domenic avatar Feb 26 '24 08:02 domenic

Superseded by https://github.com/whatwg/html/pull/10168; any review over there is appreciated!

domenic avatar Feb 28 '24 06:02 domenic