Bug 1523562 [wpt PR 15061] - Worker: Fix wpt/workers/semantics/run-a-worker/003.html for shared workers, a=testonly

Automatic update from web-platform-tests
Worker: Fix wpt/workers/semantics/run-a-worker/003.html for shared workers

Before this CL, the test expects that a 404 failure on shared worker script
fetch doesn't fire an error event. However, this doesn't obey the HTML spec
(see below), and actually Chrome and Firefox fail the test [1]. Note that
Edge and Safari haven't been implemented shared workers.

This CL changes the test to expect that the failure fires an error event.

<HTML spec from [2]>
12. Obtain script by switching on the value of options's type member:
  - "classic": Fetch a classic worker script given url, outside settings,
    destination, and inside settings.
  (...snip...)
  If the algorithm asynchronously completes with null, then:
    - Queue a task to fire an event named error at worker.
    - Run the environment discarding steps for inside settings.
    - Return.
</HTML spec>

<Fetch spec from [3]>
To fetch a classic worker script given a url, a fetch client settings
object, a destination, and a script settings object, run these steps.
The algorithm will asynchronously complete with either null (on failure) or
a new classic script (on success).
  (...snip...)
  4. If response's type is "error", or response's status is not an ok
     status, asynchronously complete this algorithm with null, and abort
     these steps.
</Fetch spec>

[1] https://wpt.fyi/results/workers/semantics/run-a-worker/003.html?run_id=5697959937179648&run_id=5733815918002176&run_id=5135009983758336&run_id=5639735062036480
[2] https://html.spec.whatwg.org/multipage/workers.html#run-a-worker
[3] https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-script

Bug: 655458, 924041
Change-Id: Ia4dc694e5bff5daed9a80a963e6316293c86c8bc
Reviewed-on: https://chromium-review.googlesource.com/c/1436276
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626059}

--

wpt-commits: 67d4f2347351f94e5b5faf411e59471189fedd3b
wpt-pr: 15061
This commit is contained in:
Hiroki Nakagawa 2019-02-01 11:39:38 +00:00 коммит произвёл James Graham
Родитель 84012a8632
Коммит 2be4ad81dd
1 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -2,20 +2,14 @@
<title>handling for 404 response</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
setup({allow_uncaught_exception: true});
async_test(function() {
var worker = new Worker('404_worker');
worker.onerror = this.step_func(function(e) { this.done(); });
async_test(t => {
const worker = new Worker('404_worker');
worker.onerror = e => t.done();
}, 'worker');
async_test(function() {
var shared = new SharedWorker('404_shared');
// NOTE: this handler will not fire, as runtime scripting errors
// are not forwarded to SharedWorker objects, but instead reported to the user directly.
shared.onerror = this.step_func(function(e) { assert_unreached(); }, shared, 'error');
step_timeout(this.step_func(function() { this.done(); }), 5000);
async_test(t => {
const shared = new SharedWorker('404_shared');
shared.onerror = e => t.done();
}, 'shared');
</script>