Skip to content

Commit 7a3189e

Browse files
authored
Merge pull request #963 from domenic/no-entry
Parse URLs relative to the relevant settings object, not entry Thanks!
2 parents 855d54f + c565ecf commit 7a3189e

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

spec/service_worker/index.bs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ spec: html; type: dfn
6161
text: browsing context
6262
text: discard a document
6363
text: document base url
64-
text: effective script origin
65-
text: entry settings object
6664
text: environment settings object
6765
text: event handler
6866
text: event handler event type
@@ -212,7 +210,7 @@ spec: html; urlPrefix: https://un5nj90kzk5vf152hgyfw29h1eja2.julianrbryant.com/multipage/
212210
text: origin; for: resource; url: origin-2
213211
text: browsing context is discarded
214212
urlPrefix: infrastructure.html
215-
text: read only array; url: dfn-read-only-array
213+
text: inserted into a document; url: insert-an-element-into-a-document
216214
text: StructuredCloneWithTransfer
217215
urlPrefix: interaction.html
218216
text: has focus steps
@@ -784,9 +782,9 @@ spec: webidl; urlPrefix: https://un5npx12xu4d6vwhy3c869mu.julianrbryant.com/webidl/
784782
<ol>
785783
<li>Let <var>p</var> be a <a>promise</a>.</li>
786784
<li>Let <var>client</var> be the <a>context object</a>'s <a href="#dfn-service-worker-container-interface-client">service worker client</a>.</li>
787-
<li>Let <var>scriptURL</var> be the result of <a for="url">parsing</a> <var>scriptURL</var> with <a>entry settings object</a>'s <a>API base URL</a>.</li>
785+
<li>Let <var>scriptURL</var> be the result of <a for="url">parsing</a> <var>scriptURL</var> with the <a>context object</a>'s <a>relevant settings object</a>'s <a>API base URL</a>.</li>
788786
<li>Let <var>scopeURL</var> be null.</li>
789-
<li>If <var>options</var>.{{RegistrationOptions/scope}} is <a>present</a>, set <var>scopeURL</var> to <var>options</var>.{{RegistrationOptions/scope}}.</li>
787+
<li>If <var>options</var>.{{RegistrationOptions/scope}} is <a>present</a>, set <var>scopeURL</var> to the result of <a for="url">parsing</a> <var>options</var>.{{RegistrationOptions/scope}} with the <a>context object</a>'s <a>relevant settings object</a>'s <a>API base URL</a>.</li>
790788
<li>Invoke [[#start-register-algorithm]] with <var>scopeURL</var>, <var>scriptURL</var>, <var>p</var>, <var>client</var>, <var>client</var>'s <a>creation URL</a> and <var>options</var>.{{RegistrationOptions/type}}.</li>
791789
<li>Return <var>p</var>.</li>
792790
</ol>
@@ -799,7 +797,7 @@ spec: webidl; urlPrefix: https://un5npx12xu4d6vwhy3c869mu.julianrbryant.com/webidl/
799797

800798
<ol>
801799
<li>Let <var>client</var> be the <a>context object</a>'s <a href="#dfn-service-worker-container-interface-client">service worker client</a>.</li>
802-
<li>Let <var>clientURL</var> be the result of <a for="url">parsing</a> <var>clientURL</var> with <a>entry settings object</a>'s <a>API base URL</a>.</li>
800+
<li>Let <var>clientURL</var> be the result of <a for="url">parsing</a> <var>clientURL</var> with the <a>context object</a>'s <a>relevant settings object</a>'s <a>API base URL</a>.</li>
803801
<li>If <var>clientURL</var> is failure, return a <a>promise</a> rejected with a <code>TypeError</code>.</li>
804802
<li>If the <a for="resource">origin</a> of <var>clientURL</var> is not <var>client</var>'s <a for="resource">origin</a>, return a <var>promise</var> rejected with a "{{SecurityError}}" exception.</li>
805803
<li>Let <var>promise</var> be a new <a>promise</a>.</li>
@@ -2125,20 +2123,22 @@ spec: webidl; urlPrefix: https://un5npx12xu4d6vwhy3c869mu.julianrbryant.com/webidl/
21252123
<li>Let <var>request</var> be the <a for="fetch">request</a> for which this header was received in the response.</li>
21262124
<li>If <var>request</var>'s <a for="request">client</a> is not a <a>secure context</a>, abort these steps.</li>
21272125
<li>Let <var>scriptURL</var> be the result of <a for="url">parsing</a> the <a>target IRI</a> of the <code>Link</code> header.</li>
2128-
<li>Let <var>scopeURL</var> be the "<code>scope</code>" <a>target attribute</a> of the <code>Link</code> header, or null if no such attribute is present.</li>
2126+
<li>Let <var>scopeURL</var> be null.
2127+
<li>If the "<code>scope</code>" <a>target attribute</a> of the <code>Link</code> header is present, set <var>scopeURL</var> to the result of <a for="url">parsing</a> the "<code>scope</code>" <a>target attribute</a> with <var>scriptURL</var>.</li>
21292128
<li>Let <var>workerType</var> be the "<code>workertype</code>" <a>target attribute</a> of the <code>Link</code> header, or "<code>classic</code>" if no such attribute is present.</li>
21302129
<li>If <var>workerType</var> is not a valid {{WorkerType}} value, abort these steps.</li>
21312130
<li>Invoke [[#start-register-algorithm]] with <var>scopeURL</var>, <var>scriptURL</var>, a new <a>promise</a>, null, <var>contextURL</var> and <var>workerType</var>.</li>
21322131
</ol>
21332132

2134-
<p>When a <a>serviceworker link</a>'s <{link}> element is <a lt="in a document">inserted into a document</a>, a <a>serviceworker link</a> is created on a <{link}> element that is already <a>in a Document</a>, or the <{link/href}> or <{link/scope}> attributes of the <{link}> element of a <a>serviceworker link</a> is changed, the user agent <em class="rfc2119" title="SHOULD">should</em> run these steps:</p>
2133+
<p>When a <a>serviceworker link</a>'s <{link}> element is <a>inserted into a document</a>, a <a>serviceworker link</a> is created on a <{link}> element that is already <a>in a document tree</a>, or the <{link/href}> or <{link/scope}> attributes of the <{link}> element of a <a>serviceworker link</a> is changed, the user agent <em class="rfc2119" title="SHOULD">should</em> run these steps:</p>
21352134

21362135
<ol>
21372136
<li>If the <{link/href}> attribute is the empty string, abort these steps.</li>
21382137
<li>Let <var>client</var> be the document's <a for="ServiceWorkerContainer">service worker client</a>.</li>
21392138
<li>If <var>client</var> is not a <a>secure context</a>, <a>queue a task</a> to <a>fire a simple event</a> named <code>error</code> at the <{link}> element, and abort these steps.</li>
2140-
<li>Let <var>scriptURL</var> be the result of <a for="url">parsing</a> the <{link/href}> attribute with document's <a>document base URL</a>.</li>
2141-
<li>Let <var>scopeURL</var> be the <{link/scope}> attribute, or null if the <{link/scope}> attribute is omitted.</li>
2139+
<li>Let <var>scriptURL</var> be the result of <a for="url">parsing</a> the <{link/href}> attribute with the <{link}> element's <a>node document</a>'s <a>document base URL</a>.</li>
2140+
<li>Let <var>scopeURL</var> null.
2141+
<li>If the <{link/scope}> attribute is present, set <var>scopeURL</var> to the result of <a for="url">parsing</a> the <{link/scope}> attribute with the <{link}> element's <a>node document</a>'s <a>document base URL</a>.</li>
21422142
<li>Let <var>workerType</var> be the <{link/workertype}> attribute, or "<code>classic</code>" if the <{link/workertype}> attribute is omitted.</li>
21432143
<li>If <var>workerType</var> is not a valid {{WorkerType}} value, <a>queue a task</a> to <a>fire a simple event</a> named <code>error</code> at the <{link}> element, and abort these steps.</li>
21442144
<li>Let <var>promise</var> be a new <a>promise</a>.</li>
@@ -3141,8 +3141,8 @@ spec: webidl; urlPrefix: https://un5npx12xu4d6vwhy3c869mu.julianrbryant.com/webidl/
31413141

31423142
<dl>
31433143
<dt>Input</dt>
3144-
<dd><var>scopeURLString</var>, a string</dd>
3145-
<dd><var>scriptURL</var>, a <a for="url">URL</a></dd>
3144+
<dd><var>scopeURL</var>, a <a for="url">URL</a> or failure or null</dd>
3145+
<dd><var>scriptURL</var>, a <a for="url">URL</a> or failure</dd>
31463146
<dd><var>promise</var>, a <a>promise</a></dd>
31473147
<dd><var>client</var>, a <a href="#dfn-service-worker-client">service worker client</a></dd>
31483148
<dd><var>referrer</var>, a <a for=url>URL</a></dd>
@@ -3154,11 +3154,9 @@ spec: webidl; urlPrefix: https://un5npx12xu4d6vwhy3c869mu.julianrbryant.com/webidl/
31543154
<li>If <var>scriptURL</var> is failure, reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>
31553155
<li>If <var>scriptURL</var>'s <a for="url">scheme</a> is not one of "<code>http</code>" and "<code>https</code>", reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>
31563156
<li>If any of the strings in <var>scriptURL</var>'s <a for="url">path</a> contains either <a>ASCII case-insensitive</a> "<code>%2f</code>" or <a>ASCII case-insensitive</a> "<code>%5c</code>", reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>
3157-
<li>Let <var>scopeURL</var> be null.</li>
3158-
<li>If <var>scopeURLString</var> is null, set <var>scopeURL</var> to the result of <a for="url">parsing</a> a string "<code>./</code>" with <var>scriptURL</var>.
3157+
<li>If <var>scopeURL</var> is null, set <var>scopeURL</var> to the result of <a for="url">parsing</a> the string "<code>./</code>" with <var>scriptURL</var>.
31593158
<p class="note">The scope url for the registration is set to the location of the service worker script by default.</p>
31603159
</li>
3161-
<li>Else, set <var>scopeURL</var> to the result of <a for="url">parsing</a> <var>scopeURLString</var> with <a>entry settings object</a>'s <a>API base URL</a>.</li>
31623160
<li>If <var>scopeURL</var> is failure, reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>
31633161
<li>If <var>scopeURL</var>'s <a for="url">scheme</a> is not one of "<code>http</code>" and "<code>https</code>", reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>
31643162
<li>If any of the strings in <var>scopeURL</var>'s <a for="url">path</a> contains either <a>ASCII case-insensitive</a> "<code>%2f</code>" or <a>ASCII case-insensitive</a> "<code>%5c</code>", reject <var>promise</var> with a <code>TypeError</code> and abort these steps.</li>

0 commit comments

Comments
 (0)