Re: [whatwg/streams] Roll WPT for abort reason (PR #1189)

Never mind, it's *worse*. 😛

1. jsdom fires a `load` event on `window`. ([source](https://github.com/jsdom/jsdom/blob/18.1.1/lib/jsdom/browser/Window.js#L912))
2. testharness.js has a `load` event listener, which calls `tests.complete()`. ([source](https://github.com/web-platform-tests/wpt/blob/71c864f8bd7f855f12c81bfc7a1fc3ebf18657f3/resources/testharness.js#L3359-L3363))
3. testharness.js eventually calls `tests.notify_complete()`, which runs all done callbacks. ([source](https://github.com/web-platform-tests/wpt/blob/71c864f8bd7f855f12c81bfc7a1fc3ebf18657f3/resources/testharness.js#L3672))
4. wpt-runner has a done callback, which calls `window.close()`. ([source](https://github.com/domenic/wpt-runner/blob/v4.0.0/lib/wpt-runner.js#L203))
5. jsdom's `Window.close()` deletes the window's document. ([source](https://github.com/jsdom/jsdom/blob/18.1.1/lib/jsdom/browser/Window.js#L773))
6. Finally we unwind the stack and come back to jsdom's `load` event listener. We now try to retrieve the wrapper of `window._document`, but it's already `undefined`. ([source](https://github.com/jsdom/jsdom/blob/18.1.1/lib/jsdom/browser/Window.js#L914))

In other words, while dispatching the `load` event, the window is closed *synchronously*. jsdom doesn't expect this, and I'm not entirely sure if the HTML spec even covers this? 😕

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1189#issuecomment-978419971

Received on Wednesday, 24 November 2021 23:08:00 UTC