mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 21:28:04 +02:00
Automatic update from web-platform-testsWorker: Separate worker-from-blob-url.window.html to filter out failing tests in a more fine-grained way This test file should be separated into 2 files (one for dedicated workers and the other for shared workers). This is because Edge and Safari don't support shared workers, and Chrome has an issue on shared workers with Blob URL revocation, so some tests are expected to fail on them. By separating the file, browsers can filter out failing tests in a more fine grained way. Bug: 655458, 800898 Change-Id: I9ea6c76dc9b6841bf6aaa98251c81f292dd460cf Reviewed-on: https://chromium-review.googlesource.com/c/1337129 Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#609586} -- wpt-commits: d0a6ed2b3686ac287842e4b8e813b44ee14553ff wpt-pr: 14066
28 lines
954 B
JavaScript
28 lines
954 B
JavaScript
function message_from_port(port) {
|
|
return new Promise(resolve => {
|
|
port.onmessage = e => resolve(e.data);
|
|
});
|
|
}
|
|
|
|
promise_test(async t => {
|
|
const run_result = 'worker_OK';
|
|
const blob_contents = 'self.postMessage("' + run_result + '");';
|
|
const blob = new Blob([blob_contents]);
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
const worker = new Worker(url);
|
|
const reply = await message_from_port(worker);
|
|
assert_equals(reply, run_result);
|
|
}, 'Creating a dedicated worker from a blob URL works.');
|
|
|
|
promise_test(async t => {
|
|
const run_result = 'worker_OK';
|
|
const blob_contents = 'self.postMessage("' + run_result + '");';
|
|
const blob = new Blob([blob_contents]);
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
const worker = new Worker(url);
|
|
URL.revokeObjectURL(url);
|
|
const reply = await message_from_port(worker);
|
|
assert_equals(reply, run_result);
|
|
}, 'Creating a dedicated worker from a blob URL works immediately before revoking.');
|