Skip to content

Commit

Permalink
Do not aggregate a job whose equivalent job's promise has already set…
Browse files Browse the repository at this point in the history
…tled. Fix #853.
  • Loading branch information
jungkees committed Mar 25, 2016
1 parent d09d19a commit ccfa7e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion spec/service_worker/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Else:
<ol>
<li>Let <var>lastJob</var> be the element at the back of the <a href="#dfn-job-queue">job queue</a>.</li>
<li>If <var>job</var> is <a href="#dfn-job-equivalent">equivalent</a> to <var>lastJob</var>, append <var>job</var>'s <a href="#dfn-job-promise">promise</a> to <var>lastJob</var>'s <a href="#dfn-job-list-of-equivalent-job-promises">list of equivalent job promises</a>.</li>
<li>If <var>job</var> is <a href="#dfn-job-equivalent">equivalent</a> to <var>lastJob</var> and <var>lastJob</var>'s <a href="#dfn-job-promise">promise</a> has not settled, append <var>job</var>'s <a href="#dfn-job-promise">promise</a> to <var>lastJob</var>'s <a href="#dfn-job-list-of-equivalent-job-promises">list of equivalent job promises</a>.</li>
<li>Else, push <var>job</var> to the <a href="#dfn-job-queue">job queue</a>.</li>
</ol>
</li>
Expand Down
12 changes: 6 additions & 6 deletions spec/service_worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Service Workers Nightly</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-03-22">22 March 2016</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-03-25">25 March 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down Expand Up @@ -3795,7 +3795,7 @@ <h2 class="heading settled" id="algorithms"><span class="content">Appendix A: Al
<p>A <a href="#dfn-job" id="ref-for-dfn-job-3">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-script-url">script url<span class="dfn-panel"><b><a href="#dfn-job-script-url">#dfn-job-script-url</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-script-url-1">Appendix A: Algorithms</a></span><span><a href="#ref-for-dfn-job-script-url-2">Create Job</a></span><span><a href="#ref-for-dfn-job-script-url-3">Register</a> <a href="#ref-for-dfn-job-script-url-4">(2)</a> <a href="#ref-for-dfn-job-script-url-5">(3)</a></span><span><a href="#ref-for-dfn-job-script-url-6">Update</a> <a href="#ref-for-dfn-job-script-url-7">(2)</a> <a href="#ref-for-dfn-job-script-url-8">(3)</a> <a href="#ref-for-dfn-job-script-url-9">(4)</a> <a href="#ref-for-dfn-job-script-url-10">(5)</a> <a href="#ref-for-dfn-job-script-url-11">(6)</a> <a href="#ref-for-dfn-job-script-url-12">(7)</a></span></span></dfn> (a <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url">URL</a>).</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-4">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-worker-type">worker type<span class="dfn-panel"><b><a href="#dfn-job-worker-type">#dfn-job-worker-type</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-worker-type-1">3.2.5. update()</a></span><span><a href="#ref-for-dfn-job-worker-type-2">3.4.3. register(scriptURL, options)</a></span><span><a href="#ref-for-dfn-job-worker-type-3">Update</a> <a href="#ref-for-dfn-job-worker-type-4">(2)</a></span><span><a href="#ref-for-dfn-job-worker-type-5">Soft Update</a></span></span></dfn> ("<code>classic</code>" or "<code>module</code>").</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-5">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-client">client<span class="dfn-panel"><b><a href="#dfn-job-client">#dfn-job-client</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-client-1">Create Job</a></span><span><a href="#ref-for-dfn-job-client-2">Run Job</a></span><span><a href="#ref-for-dfn-job-client-3">Register</a> <a href="#ref-for-dfn-job-client-4">(2)</a></span><span><a href="#ref-for-dfn-job-client-5">Update</a> <a href="#ref-for-dfn-job-client-6">(2)</a></span><span><a href="#ref-for-dfn-job-client-7">Unregister</a></span></span></dfn> (a <a href="#dfn-service-worker-client" id="ref-for-dfn-service-worker-client-34">service worker client</a>). It is initially null.</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-6">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="job promise" data-noexport="" id="dfn-job-promise">promise<span class="dfn-panel"><b><a href="#dfn-job-promise">#dfn-job-promise</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-promise-1">Create Job</a></span><span><a href="#ref-for-dfn-job-promise-2">Schedule Job</a></span><span><a href="#ref-for-dfn-job-promise-3">Resolve Job Promise</a></span><span><a href="#ref-for-dfn-job-promise-4">Reject Job Promise</a></span><span><a href="#ref-for-dfn-job-promise-5">Install</a></span></span></dfn> (a <a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promise</a>). It is initially null.</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-6">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="job promise" data-noexport="" id="dfn-job-promise">promise<span class="dfn-panel"><b><a href="#dfn-job-promise">#dfn-job-promise</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-promise-1">Create Job</a></span><span><a href="#ref-for-dfn-job-promise-2">Schedule Job</a> <a href="#ref-for-dfn-job-promise-3">(2)</a></span><span><a href="#ref-for-dfn-job-promise-4">Resolve Job Promise</a></span><span><a href="#ref-for-dfn-job-promise-5">Reject Job Promise</a></span><span><a href="#ref-for-dfn-job-promise-6">Install</a></span></span></dfn> (a <a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promise</a>). It is initially null.</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-7">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-list-of-equivalent-job-promises">list of equivalent job promises<span class="dfn-panel"><b><a href="#dfn-job-list-of-equivalent-job-promises">#dfn-job-list-of-equivalent-job-promises</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-list-of-equivalent-job-promises-1">Schedule Job</a></span><span><a href="#ref-for-dfn-job-list-of-equivalent-job-promises-2">Resolve Job Promise</a></span><span><a href="#ref-for-dfn-job-list-of-equivalent-job-promises-3">Reject Job Promise</a></span></span></dfn> (a list of <a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promises</a>). It is initially the empty list.</p>
<p>A <a href="#dfn-job" id="ref-for-dfn-job-8">job</a> has a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-force-bypass-cache-flag">force bypass cache flag<span class="dfn-panel"><b><a href="#dfn-job-force-bypass-cache-flag">#dfn-job-force-bypass-cache-flag</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-force-bypass-cache-flag-1">Soft Update</a></span></span></dfn> It is initially unset.</p>
<p>Two <a href="#dfn-job" id="ref-for-dfn-job-9">jobs</a> are <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="dfn-job-equivalent">equivalent<span class="dfn-panel"><b><a href="#dfn-job-equivalent">#dfn-job-equivalent</a></b><b>Referenced in:</b><span><a href="#ref-for-dfn-job-equivalent-1">Schedule Job</a></span></span></dfn> when their <a href="#dfn-job-type" id="ref-for-dfn-job-type-1">job type</a> is the same and: </p>
Expand Down Expand Up @@ -3845,7 +3845,7 @@ <h3 class="heading settled" id="schedule-job-algorithm"><span class="content">Sc
Else:
<ol>
<li>Let <var>lastJob</var> be the element at the back of the <a href="#dfn-job-queue" id="ref-for-dfn-job-queue-9">job queue</a>.
<li>If <var>job</var> is <a href="#dfn-job-equivalent" id="ref-for-dfn-job-equivalent-1">equivalent</a> to <var>lastJob</var>, append <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-2">promise</a> to <var>lastJob</var>’s <a href="#dfn-job-list-of-equivalent-job-promises" id="ref-for-dfn-job-list-of-equivalent-job-promises-1">list of equivalent job promises</a>.
<li>If <var>job</var> is <a href="#dfn-job-equivalent" id="ref-for-dfn-job-equivalent-1">equivalent</a> to <var>lastJob</var> and <var>lastJob</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-2">promise</a> has not settled, append <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-3">promise</a> to <var>lastJob</var>’s <a href="#dfn-job-list-of-equivalent-job-promises" id="ref-for-dfn-job-list-of-equivalent-job-promises-1">list of equivalent job promises</a>.
<li>Else, push <var>job</var> to the <a href="#dfn-job-queue" id="ref-for-dfn-job-queue-10">job queue</a>.
</ol>
</ol>
Expand Down Expand Up @@ -3892,7 +3892,7 @@ <h3 class="heading settled" id="resolve-job-promise-algorithm"><span class="cont
<dd>none
</dl>
<ol>
<li>Resolve <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-3">promise</a> with <var>value</var>.
<li>Resolve <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-4">promise</a> with <var>value</var>.
<li>
For each <var>promise</var> in <var>job</var>’s <a href="#dfn-job-list-of-equivalent-job-promises" id="ref-for-dfn-job-list-of-equivalent-job-promises-2">list of equivalent job promises</a>:
<ol>
Expand All @@ -3910,7 +3910,7 @@ <h3 class="heading settled" id="reject-job-promise-algorithm"><span class="conte
<dd>none
</dl>
<ol>
<li>Reject <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-4">promise</a> with <var>reason</var>.
<li>Reject <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-5">promise</a> with <var>reason</var>.
<li>
For each <var>promise</var> in <var>job</var>’s <a href="#dfn-job-list-of-equivalent-job-promises" id="ref-for-dfn-job-list-of-equivalent-job-promises-3">list of equivalent job promises</a>:
<ol>
Expand Down Expand Up @@ -4134,7 +4134,7 @@ <h3 class="heading settled" id="installation-algorithm"><span class="content">In
<li>Let <var>newestWorker</var> be the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as its argument.
<li>Set <var>registration</var>’s <a href="#dfn-installing-worker" id="ref-for-dfn-installing-worker-10">installing worker</a> to <var>worker</var>.
<li>Run the <a href="#update-state-algorithm">Update State</a> algorithm passing <var>registration</var>’s <a href="#dfn-installing-worker" id="ref-for-dfn-installing-worker-11">installing worker</a> and <em>installing</em> as the arguments.
<li><a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-algorithm-conventions">Assert</a>: <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-5">promise</a> is not null.
<li><a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-algorithm-conventions">Assert</a>: <var>job</var>’s <a href="#dfn-job-promise" id="ref-for-dfn-job-promise-6">promise</a> is not null.
<li>Invoke <a href="#resolve-job-promise-algorithm">Resolve Job Promise</a> with <var>job</var> and the <code class="idl"><a data-link-type="idl" href="#service-worker-registration-interface" id="ref-for-service-worker-registration-interface-19">ServiceWorkerRegistration</a></code> object which represents <var>registration</var>.
<li><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code>updatefound</code> at all the <code class="idl"><a data-link-type="idl" href="#service-worker-registration-interface" id="ref-for-service-worker-registration-interface-20">ServiceWorkerRegistration</a></code> objects for all the <a href="#dfn-service-worker-client" id="ref-for-dfn-service-worker-client-36">service worker clients</a> whose <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#creation-url">creation url</a> <a href="#scope-match-algorithm">matches</a> <var>registration</var>’s <a href="#dfn-scope-url" id="ref-for-dfn-scope-url-16">scope url</a> and all the <a href="#dfn-service-worker" id="ref-for-dfn-service-worker-110">service workers</a> whose <a href="#dfn-containing-service-worker-registration" id="ref-for-dfn-containing-service-worker-registration-12">containing service worker registration</a> is <var>registration</var>.
<li>Let <var>installingWorker</var> be <var>registration</var>’s <a href="#dfn-installing-worker" id="ref-for-dfn-installing-worker-12">installing worker</a>.
Expand Down
2 changes: 1 addition & 1 deletion spec/service_worker_1/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Else:
<ol>
<li>Let <var>lastJob</var> be the element at the back of the <a href="#dfn-job-queue">job queue</a>.</li>
<li>If <var>job</var> is <a href="#dfn-job-equivalent">equivalent</a> to <var>lastJob</var>, append <var>job</var>'s <a href="#dfn-job-promise">promise</a> to <var>lastJob</var>'s <a href="#dfn-job-list-of-equivalent-job-promises">list of equivalent job promises</a>.</li>
<li>If <var>job</var> is <a href="#dfn-job-equivalent">equivalent</a> to <var>lastJob</var> and <var>lastJob</var>'s <a href="#dfn-job-promise">promise</a> has not settled, append <var>job</var>'s <a href="#dfn-job-promise">promise</a> to <var>lastJob</var>'s <a href="#dfn-job-list-of-equivalent-job-promises">list of equivalent job promises</a>.</li>
<li>Else, push <var>job</var> to the <a href="#dfn-job-queue">job queue</a>.</li>
</ol>
</li>
Expand Down
Loading

0 comments on commit ccfa7e4

Please sign in to comment.