Re: [ServiceWorker] Foreign fetch (#751)

> +        <li>Let <var>scopeString</var> be the <a href="https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object">incumbent settings object</a>'s <a href="https://html.spec.whatwg.org/multipage/webappapis.html#global-object">global object</a>'s <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>'s <a href="#dfn-scope-url">scope url</a>, <a href="https://url.spec.whatwg.org/#concept-url-serializer">serialized</a>.</li>
> +        <li>Let <var>subScopeURLs</var> be an empty list of <a href="https://url.spec.whatwg.org/#concept-url">URLs</a>.</li>
> +        <li>For each <var>subScope</var> in <var>subScopes</var>:
> +          <ol>
> +            <li>Let <var>subScopeURL</var> be the result of <a href="https://url.spec.whatwg.org/#concept-url-parser">parsing</a> <var>subScope</var> with <a href="https://html.spec.whatwg.org/multipage/webappapis.html#entry-settings-object">entry settings object</a>'s <a href="https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url">API base URL</a>.</li>
> +            <li>If <var>subScopeURL</var> is failure, throw a <code>TypeError</code> and abort these steps.</li>
> +            <li>Let <var>subScopeString</var> be the <a href="https://url.spec.whatwg.org/#concept-url-serializer">serialized</a> <var>subScopeURL</var>.</li>
> +            <li>If <var>subScopeString</var> does not start with <var>scopeString</var>, throw a <code>TypeError</code> and abort these steps.</li>
> +            <li>Add <var>subScopeURL</var> to <var>subScopeURLs</var>.</li>
> +          </ol>
> +        </li>
> +        <li>Set this <a href="#dfn-service-worker">service worker</a>'s <a href="#dfn-foreign-fetch-scopes">list of foreign fetch scopes</a> to <var>subScopeURLs</var>.</li>
> +      </ol>
> +      </spec-algorithm>
> +
> +      <p class="fixme">Maybe subscopes should be parsed using the registrations scope URL instead of the workers API base url. Although that might actually be more surprising/confusing.</p>

Any opinions on this? Since we require foreign fetch scopes to be "inside" the scope of the service worker it superficially seems to maybe make sense to parse relative urls relative to the scope. But parsing relative urls relative to the location of the sw script also seems like it would make sense, and might be less surprising.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/pull/751/files#r40384025

Received on Thursday, 24 September 2015 23:03:36 UTC