Skip to content

Commit

Permalink
Correct handling of ExtendableEvent's extend lifetime promises
Browse files Browse the repository at this point in the history
Before this patch, the algorithm used Promise's wait for all language
to wait for the event's extend lifetime promises to settle. This
wasn't correct as it actually intends to wait for all the promises in
the event's extend lifetime promises to settle before allowing the UA
to terminate the SW. This patch fixes the step by replacing "wait for
all" with "wait until all the promise".

Fixes #936.
  • Loading branch information
jungkees committed Aug 11, 2016
1 parent cb05733 commit 4d9fb9b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spec/service_worker/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Run the following substeps <a>in parallel</a>:
<ol>
<li><em>SetupPromiseArray</em>: Set <var>extendLifetimePromises</var> to a copy of <var>e</var>'s <a>extend lifetime promises</a>.</li>
<li>Wait until the result of <a>waiting for all</a> of <var>extendLifetimePromises</var> settles.</li>
<li>Wait until all the <a>promises</a> in <var>extendLifetimePromises</var> settle.</li>
<li>If the length of <var>extendLifetimePromises</var> does not equal the length of <var>e</var>'s <a>extend lifetime promises</a>, jump to the step labeled <em>SetupPromiseArray</em>.</li>
<li>Unset <var>e</var>'s <a>extensions allowed flag</a>.</li>
</ol>
Expand Down
4 changes: 2 additions & 2 deletions spec/service_worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,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/StyleSheets/TR/2016/logos/W3C" 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-08-10">10 August 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-08-11">11 August 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down Expand Up @@ -2779,7 +2779,7 @@ <h3 class="heading settled" data-level="4.4" id="extendable-event"><span class="
Run the following substeps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>:
<ol>
<li><em>SetupPromiseArray</em>: Set <var>extendLifetimePromises</var> to a copy of <var>e</var>’s <a data-link-type="dfn" href="#dfn-extend-lifetime-promises" id="ref-for-dfn-extend-lifetime-promises-2">extend lifetime promises</a>.
<li>Wait until the result of <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide#waiting-for-all">waiting for all</a> of <var>extendLifetimePromises</var> settles.
<li>Wait until all the <a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promises</a> in <var>extendLifetimePromises</var> settle.
<li>If the length of <var>extendLifetimePromises</var> does not equal the length of <var>e</var>’s <a data-link-type="dfn" href="#dfn-extend-lifetime-promises" id="ref-for-dfn-extend-lifetime-promises-3">extend lifetime promises</a>, jump to the step labeled <em>SetupPromiseArray</em>.
<li>Unset <var>e</var>’s <a data-link-type="dfn" href="#extensions-allowed-flag" id="ref-for-extensions-allowed-flag-2">extensions allowed flag</a>.
</ol>
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 @@ -1599,7 +1599,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Run the following substeps <a>in parallel</a>:
<ol>
<li><em>SetupPromiseArray</em>: Set <var>extendLifetimePromises</var> to a copy of <var>e</var>'s <a>extend lifetime promises</a>.</li>
<li>Wait until the result of <a>waiting for all</a> of <var>extendLifetimePromises</var> settles.</li>
<li>Wait until all the <a>promises</a> in <var>extendLifetimePromises</var> settle.</li>
<li>If the length of <var>extendLifetimePromises</var> does not equal the length of <var>e</var>'s <a>extend lifetime promises</a>, jump to the step labeled <em>SetupPromiseArray</em>.</li>
<li>Unset <var>e</var>'s <a>extensions allowed flag</a>.</li>
</ol>
Expand Down
4 changes: 2 additions & 2 deletions spec/service_worker_1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,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/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Service Workers 1</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-08-10">10 August 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-08-11">11 August 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down Expand Up @@ -2761,7 +2761,7 @@ <h3 class="heading settled" data-level="4.4" id="extendable-event"><span class="
Run the following substeps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>:
<ol>
<li><em>SetupPromiseArray</em>: Set <var>extendLifetimePromises</var> to a copy of <var>e</var>’s <a data-link-type="dfn" href="#dfn-extend-lifetime-promises" id="ref-for-dfn-extend-lifetime-promises-2">extend lifetime promises</a>.
<li>Wait until the result of <a data-link-type="dfn" href="https://www.w3.org/2001/tag/doc/promises-guide#waiting-for-all">waiting for all</a> of <var>extendLifetimePromises</var> settles.
<li>Wait until all the <a data-link-type="dfn" href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promises</a> in <var>extendLifetimePromises</var> settle.
<li>If the length of <var>extendLifetimePromises</var> does not equal the length of <var>e</var>’s <a data-link-type="dfn" href="#dfn-extend-lifetime-promises" id="ref-for-dfn-extend-lifetime-promises-3">extend lifetime promises</a>, jump to the step labeled <em>SetupPromiseArray</em>.
<li>Unset <var>e</var>’s <a data-link-type="dfn" href="#extensions-allowed-flag" id="ref-for-extensions-allowed-flag-2">extensions allowed flag</a>.
</ol>
Expand Down

0 comments on commit 4d9fb9b

Please sign in to comment.