lino-levan / astral

A high-level puppeteer/playwright-like library for Deno
https://jsr.io/@astral/astral
MIT License
177 stars 7 forks source link

fix: possible leaks due to websocket closing delay #27

Closed lowlighter closed 9 months ago

lowlighter commented 9 months ago

TheWebsocket.close() may not actually closed the websocket instantly, depending if its busy or not, it may stay sometime into ws.CLOSING state before switching toWebsocket.CLOSED.

While not causing any major issues, the deno test may file because the websockets from previous test may close into another test which cause failing steps without disable sanitizeOps/sanitizeResources

This currently use a deferred polyfill to track the actual state of the socket, which can be replaced by native code once https://github.com/tc39/proposal-promise-with-resolvers lands