Re: [whatwg/webidl] Should we "check if we can run script" before calling callbacks? (#993)

zcorpan left a comment (whatwg/webidl#993)

I used Claude to help write tentative tests in web-platform-tests/wpt#63315:

> The tests call a callback from an iframe that's been removed or navigated away, and cover invoke, construct, call a user object's operation, and promise jobs. The Web IDL callbacks tested are timers, queueMicrotask, rAF, MutationObserver, event handlers and listeners, custom element constructors and connectedCallback, ReadableStream start, NodeFilter, and XPathNSResolver.
> 
> Current behavior:
> 
> |                                | Chrome Canary                           | Firefox Nightly | Safari TP                                         |
> |--------------------------------|-----------------------------------------|-----------------|---------------------------------------------------|
> | Web IDL callbacks              | not called, except ReadableStream start | not called      | called                                            |
> | Promise jobs, iframe removed   | run                                     | run             | run, except for the iframe's own promise or await |
> | Promise jobs, iframe navigated | don't run                               | don't run       | run                                               |
> 
> So Firefox now matches Chrome for the setTimeout example in the OP, and for promise reactions when the iframe is removed. When Chrome and Firefox don't call a callback from a synchronous API, they seem to throw instead, e.g. createElement() for a custom element constructor.
> 
> The tests expect what Chrome and Firefox mostly do: Web IDL callbacks aren't called, and promise jobs run if the iframe is removed but not if it's navigated. The removed/navigated difference for promise jobs seems odd, though.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/993#issuecomment-6016784440
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/993/6016784440@github.com>

Received on Tuesday, 6 October 2026 12:59:46 UTC