Skip to content

Commit be3724d

Browse files
committed
fix: also clear listeners on opaque responses
1 parent 90d7f33 commit be3724d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/browser/sources/service-worker-source.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
330330

331331
async #handleResponse(event: WorkerChannelResponseEvent): Promise<void> {
332332
const { request, response, isMockedResponse } = event.data
333+
const frame = this.#frames.get(request.id)
333334

334335
/**
335336
* CORS requests with `mode: "no-cors"` result in "opaque" responses.
@@ -340,10 +341,10 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
340341
*/
341342
if (response.type?.includes('opaque')) {
342343
this.#frames.delete(request.id)
344+
frame?.events.removeAllListeners()
343345
return
344346
}
345347

346-
const frame = this.#frames.get(request.id)
347348
this.#frames.delete(request.id)
348349

349350
/**

0 commit comments

Comments
 (0)