gecko-dev/testing/web-platform/tests/FileAPI/url/resources/revoke-helper.js
Marijn Kruisselbrink a6502a8fc7 Bug 1468348 [wpt PR 11477] - Fix test flakiness around multi-threaded blob URL revocation., a=testonly
Automatic update from web-platform-testsFix test flakiness around multi-threaded blob URL revocation.

Registering a new blob URL in the worker will ensure (at least in chrome)
that the revocation has been fully processed before the main thread
tries to fetch the now revoked URL.

Bug: 851942
Change-Id: I12e794682dbb5b34dc08fe2a7d398e3ba02aaffa
Reviewed-on: https://chromium-review.googlesource.com/1097230
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566460}

--

wpt-commits: 98530fb94412077886e8df96e25bfdcd3ce460d3
wpt-pr: 11477
2018-07-11 07:49:29 +01:00

9 lines
408 B
JavaScript

self.addEventListener('message', e => {
URL.revokeObjectURL(e.data.url);
// Registering a new object URL will make absolutely sure that the revocation
// has propagated. Without this at least in chrome it is possible for the
// below postMessage to arrive at its destination before the revocation has
// been fully processed.
URL.createObjectURL(new Blob([]));
self.postMessage('revoked');
});