- From: Daniel Ehrenberg <notifications@github.com>
- Date: Tue, 25 Jun 2019 20:05:41 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1444/review/254361237@github.com>
littledan commented on this pull request. This patch has the semantics I was imagining. It's probably worth including a note about the unfortunate compatibility situation leading to the synchronous check of the promise (which is generally a design anti-pattern). Or, to the folks here more familiar with ServiceWorker usage: would it be OK to skip the synchronous error check, and just rely on the error being reported a bit later, and letting the rest of the initialization algorithm complete as if the module loaded successfully? > @@ -2801,8 +2803,21 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Set |workerGlobalScope|'s [=ServiceWorkerGlobalScope/force bypass cache for import scripts flag=] if |forceBypassCache| is true. 1. Create a new {{WorkerLocation}} object and associate it with |workerGlobalScope|. 1. If |serviceWorker| is an <a>active worker</a>, and there are any <a>tasks</a> queued in |serviceWorker|'s <a>containing service worker registration</a>'s [=service worker registration/task queues=], <a lt="queue a task">queue</a> them to |serviceWorker|'s <a>event loop</a>'s [=/task queues=] in the same order using their original <a>task sources</a>. - 1. Let |evaluationStatus| be the result of <a lt="run a classic script">running the classic script</a> |script| if |script| is a <a>classic script</a>, otherwise, the result of <a lt="run a module script">running the module script</a> |script| if |script| is a [=module script=]. - 1. If |evaluationStatus|.\[[Value]] is empty, this means the script was not evaluated. Set |startFailed| to true and abort these steps. + 1. Let |evaluationStatus| be null. + 1. If |script| is a <a>classic script</a>, then: + 1. Set |evaluationStatus| to the result of <a lt="run a classic script">running the classic script</a> |script|. + 1. If |evaluationStatus|.\[[Value]] is empty, this means the script was not evaluated. Set |startFailed| to true and abort these steps. + 1. Otherwise, if |script| is a [=module script=], then: + 1. Let |evaluationPromise| be the result of <a lt="run a module script">running the module script</a> |script|, with report errors set to false. + 1. If |evaluationPromise|.\[[PromiseState]] is "fulfilled": + 1. Set |evaluationStatus| to [$NormalCompletion$](|evaluationPromise|.\[[PromiseResult]]). I'm not sure why we need this synchronous check for "fulfilled"; isn't this path handled just as well by line 2816? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/pull/1444#pullrequestreview-254361237
Received on Wednesday, 26 June 2019 03:06:03 UTC