[csswg-drafts] [css-view-transitions-1] Reacting to promise causes assertion failures (#11990)

Psychpsyo has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-1] Reacting to promise causes assertion failures ==
The spec [reacts] to promises in multiple places that I don't think it can do that in.

This is because
[reacting](https://webidl.spec.whatwg.org/#dfn-perform-steps-once-promise-is-settled) to a promise performs
[PerformPromiseThen](https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-performpromisethen), which, in step 4.a, calls
[HostMakeJobCallback](https://whatpr.org/html/9893/webappapis.html#hostmakejobcallback), which then accesses the
[incumbent realm](https://whatpr.org/html/9893/webappapis.html#concept-incumbent-realm), which then fails an assertion in step 2.1.

As the comment there says, the incumbent realm concept can only be used from inside algorithms that were triggered by [calling scripts](https://whatpr.org/html/9893/webappapis.html#calling-scripts) or by Web IDL [invoking](https://webidl.spec.whatwg.org/#invoke-a-callback-function) a callback.
But the promise reactions here ultimately come from [updating the rendering](https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering) and from [updating the visibility state](https://html.spec.whatwg.org/multipage/interaction.html#update-the-visibility-state) in the HTML spec.
Neither of those are scripts or a WebIDL callback.

Both the reaction in [skip the view transition](https://drafts.csswg.org/css-view-transitions-1/#skip-the-view-transition), step 8 and the one in [call the update callback](https://drafts.csswg.org/css-view-transitions-1/#call-the-update-callback), also step 8 managed to run into this in my testing.
Note that the latter only ran into this before I implemented the update callback queue, which I'm still a bit confused by.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11990 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 23 March 2025 10:25:51 UTC