Skip to content

Commit

Permalink
Service workers: enable the client message queue
Browse files Browse the repository at this point in the history
A ServiceWorkerContainer object has a client message queue task source, initially disabled, which holds tasks until the client is ready to get the messages from its service worker. This patch adds a condition that enables the task source:

* when DOMContentLoaded is dispatched
* when a worker client has executed run a worker algorithm

Related issue: w3c/ServiceWorker#728
Related commit: w3c/ServiceWorker@5c0ecae
  • Loading branch information
jungkees authored and Alice Boxhall committed Jan 7, 2019
1 parent 4310582 commit 48b58b7
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,10 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>The following terms are defined in <cite>Service Workers</cite>: <ref spec="SW"></p>

<ul class="brief">
<li><dfn data-noexport="" data-x="dfn-client-message-queue" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-client-message-queue">client message queue</dfn></li>
<li><dfn data-noexport="" data-x="scope-match-algorithm" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm">match service worker registration</dfn></li>
<li><dfn data-noexport="" data-x="service-worker-container-interface" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-container-interface"><code>ServiceWorkerContainer</code></dfn> interface</li>
<li><dfn data-noexport="" data-x="dfn-service-worker-container-interface-client" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-service-worker-container-interface-client">service worker client</dfn></li>
</ul>

</dd>
Expand Down Expand Up @@ -96351,6 +96354,11 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
source</span>, to <span data-x="concept-event-dispatch">dispatch</span> the event at <var>worker
global scope</var>.</p></li>

<li><p>Enable the <span data-x="dfn-client-message-queue">client message queue</span> of the
<span data-x="service-worker-container-interface">ServiceWorkerContainer</span> object whose
associated <span data-x="dfn-service-worker-container-interface-client">service worker
client</span> is <var>worker global scope</var>'s <span>relevant settings object</span>.</p></li>

<li>

<p><strong>Event loop<!-- labeled for ease of discussion --></strong>: Run the <span>responsible
Expand Down Expand Up @@ -107428,8 +107436,21 @@ document.body.appendChild(text);

</li>

<li><p><span>Queue a task</span> to <span>fire a simple event</span> that bubbles named <code
data-x="event-DOMContentLoaded">DOMContentLoaded</code> at the <code>Document</code>.</p></li>
<li>
<p><span>Queue a task</span> to run the following substeps:</p>

<ol>
<li><p><span>Fire a simple event</span> that bubbles named <code
data-x="event-DOMContentLoaded">DOMContentLoaded</code> at the <code>Document</code>
object.</p></li>

<li><p>Enable the <span data-x="dfn-client-message-queue">client message queue</span> of the
<span data-x="service-worker-container-interface">ServiceWorkerContainer</span> object whose
associated <span data-x="dfn-service-worker-container-interface-client">service worker
client</span> is the <code>Document</code> object's <span>relevant settings
object</span>.</p></li>
</ol>
</li>

<li><p><span>Spin the event loop</span> until the <span>set of scripts that will execute as soon
as possible</span> and the <span>list of scripts that will execute in order as soon as
Expand Down

0 comments on commit 48b58b7

Please sign in to comment.