[Webkit-unassigned] [Bug 250569] Terminated worker memory leak
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 19 14:10:19 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=250569
Sam Denty <samddenty at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |samddenty at gmail.com
--- Comment #7 from Sam Denty <samddenty at gmail.com> ---
Until a fix for this lands, this can be worked around by doing the following:
1. Create a cloudflare worker with the following:
```js
export default {
async fetch(request, env) {
let url
try {
url = new URL(decodeURIComponent(new URL(request.url).search.slice(1)))
} catch {
return new Response("must provide a url", { status: 404 })
}
url.searchParams.set('memory-freed', 1)
return Response.redirect(url, 302);
}
}
```
2. Server-side: On the page using WASM & Workers, if the URL doesn't contain the query string `memory-freed` do a 302 redirect to `https://WORKER_NAME.USER.workers.dev/?${url_with_query_string}`
3. Worker with above code will redirect back to page with `memory-freed=1` in the URL
4. Server-side: use middleware that detects the `memory-freed=1` in requests, and inject at the top of the document the following:
```
<script>{ const url = new URL(location.href); url.searchParams.delete('memory-freed'); history.replaceState(null, '', url) }</script>
```
5. TADA, this bug is worked around!
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230419/2a97d47e/attachment.htm>
More information about the webkit-unassigned
mailing list