Re: [ServiceWorker] Foreign fetch (#751)

> +      <h1><code>event.registerForeignFetchScopes(<var>subScopes</var>, <var>origins</var>)</code></h1>
> +
> +      <p><code><a href="#install-event-register-foreign-fetch-scopes-method">registerForeignFetchScopes(<var>subScopes</var>, <var>origins</var>)</a></code> registers this service worker to handle foreign fetches from certain origins for certain sub scopes.</p>
> +
> +      <p><dfn id="install-event-register-foreign-fetch-scopes-method"><code>registerForeignFetchScopes(<var>subScopes</var>, <var>origins</var>)</code></dfn> method <em class="rfc2119" title="MUST">must</em> run these steps or their <a href="#dfn-processing-equivalence">equivalent</a>:</p>
> +      <spec-algorithm>
> +      <ol>
> +        <li>If the <a href="https://dom.spec.whatwg.org/#dispatch-flag">dispatch flag</a> is unset, then:
> +          <ol>
> +            <li><a href="http://heycam.github.io/webidl/#dfn-throw">Throw</a> an "<code><a href="http://heycam.github.io/webidl/#invalidstateerror">InvalidStateError</a></code>" exception.</li>
> +            <li>Abort these steps.</li>
> +          </ol>
> +        </li>
> +        <li>If <var>origins</var> is empty <a href="http://heycam.github.io/webidl/#dfn-throw">throw</a> a <code>TypeError</code> and abort these steps.</li>
> +        <li>Let <var>originURLs</var> be an empty list of <a href="https://url.spec.whatwg.org/#concept-url">URLs</a>.</li>
> +        <li>If the value of <var>origins</var> is not a single string equal to a single U+002A ASTERISK character (*):

When you already have two arguments and will likely add more in the future it seems better to just have a dictionary from the start since the eventual code will become more readable.

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

Received on Friday, 5 February 2016 09:05:43 UTC