Skip to content

Commit

Permalink
Allow setting a maxScope with Service-Worker_Allowed header
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkees committed Jan 20, 2015
1 parent 8e76892 commit ddb21be
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions spec/service_worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1947,10 +1947,6 @@ <h1>Register</h1>
<li>Return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects">promise</a> rejected with a "<code><a href="http://heycam.github.io/webidl/#securityerror">SecurityError</a></code>" exception.</li>
</ol>
</li>
<li>Let <var>scriptPathname</var> be "<code>/</code>" concatenated with the strings, except the last string that denotes the script's file name, in <var>scriptURL</var>'s <a href="https://url.spec.whatwg.org/#concept-url-path">path</a> (including empty strings), separated from each other by "<code>/</code>".</li>
<li>Let <var>scopePathname</var> be "<code>/</code>" concatenated with the strings in <var>scopeURL</var>'s <a href="https://url.spec.whatwg.org/#concept-url-path">path</a> (including empty strings), separated from each other by "<code>/</code>".</li>
<li>If <var>scopePathname</var> starts with <var>scriptPathname</var>, do nothing.</li>
<li>Else, return a <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects">promise</a> rejected with a "<code><a href="http://heycam.github.io/webidl/#securityerror">SecurityError</a></code>" exception.</li>
<li>Run the following substeps atomically:
<ol>
<li>Let <var>registration</var> be the result of running the <a href="#get-registration-algorithm">Get Registration</a> algorithm passing <var>scopeURL</var> as the argument.</li>
Expand Down Expand Up @@ -2031,7 +2027,7 @@ <h1>Update</h1>
<ol>
<li>Reject <var>p</var> with the exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm is null, then:
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
Expand All @@ -2049,7 +2045,7 @@ <h1>Update</h1>
<ol>
<li>Reject <var>p</var> with a "<code><a href="http://heycam.github.io/webidl/#securityerror">SecurityError</a></code>" exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm is null, then:
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
Expand All @@ -2061,7 +2057,7 @@ <h1>Update</h1>
<ol>
<li>Reject <var>p</var> with a "<code><a href="http://heycam.github.io/webidl/#networkerror">NetworkError</a></code>" exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm is null, then:
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
Expand All @@ -2075,7 +2071,47 @@ <h1>Update</h1>
<ol>
<li>Reject <var>p</var> with a "<code><a href="http://heycam.github.io/webidl/#securityerror">SecurityError</a></code>" exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm is null, then:
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
</li>
<li>Abort these steps.</li>
</ol>
</li>
<li>Let <var>serviceWorkerAllowed</var> be the result of <a href="https://fetch.spec.whatwg.org/#concept-header-parse">parsing</a> `<code>Service-Worker-Allowed</code>` in <var>response</var>'s <a href="https://fetch.spec.whatwg.org/#concept-response-header-list">header list</a>.</li>
<li>If <var>serviceWorkerAllowed</var> is failure, then:
<ol>
<li>Reject <var>p</var> with a "<code><a href="http://heycam.github.io/webidl/#networkerror">NetworkError</a></code>" exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
</li>
<li>Abort these steps.</li>
</ol>
</li>
<li>Let <var>scopeURL</var> be <var>registration</var>'s <a href="#dfn-scope-url">scope url</a>.</li>
<li>Let <var>maxScopeString</var> be null.</li>
<li>If <var>serviceWorkerAllowed</var> is null, then:
<ol>
<li>Set <var>maxScopeString</var> be "<code>/</code>" concatenated with the strings, except the last string that denotes the script's file name, in <var>registration</var>'s <a href="#dfn-registration-script-url">registering script url</a>'s <a href="https://url.spec.whatwg.org/#concept-url-path">path</a> (including empty strings), separated from each other by "<code>/</code>".</li>
</ol>
</li>
<li>Else:
<ol>
<li>Let <var>maxScope</var> be the result of <a href="https://url.spec.whatwg.org/#concept-url-parser">parsing</a> <var>serviceWorkerAllowed</var> with <var>client</var>'s <a href="https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url">API base URL</a>.</li>
<li>Set <var>maxScopeString</var> be "<code>/</code>" concatenated with the strings in <var>maxScope</var>'s <a href="https://url.spec.whatwg.org/#concept-url-path">path</a> (including empty strings), separated from each other by "<code>/</code>".</li>
</ol>
</li>
<li>Let <var>scopeString</var> to "<code>/</code>" concatenated with the strings in <var>scopeURL</var>'s <a href="https://url.spec.whatwg.org/#concept-url-path">path</a> (including empty strings), separated from each other by "<code>/</code>".</li>
<li>If <var>scopeString</var> starts with <var>maxScopeString</var>, do nothing.</li>
<li>Else:
<ol>
<li>Reject <var>p</var> with a "<code><a href="http://heycam.github.io/webidl/#securityerror">SecurityError</a></code>" exception.</li>
<li>Pop the top element from <a href="#dfn-installation-queue-adt">installation queue</a> and <a href="#dfn-installation-result-handle-queue-adt">installation result handle queue</a>.</li>
<li>If the result of running <a href="#get-newest-worker-algorithm">Get Newest Worker</a> algorithm passing <var>registration</var> as the argument is null, then:
<ol>
<li>Invoke <a href="#clear-registration-algorithm">Clear Registration</a> algorithm passing <var>registration</var> as its argument.</li>
</ol>
Expand Down

0 comments on commit ddb21be

Please sign in to comment.