Skip to content

Commit

Permalink
Fix mishandled URL parsing error in resolution spec
Browse files Browse the repository at this point in the history
URL parsing "failure" signal needs to be converted into import maps spec "null" signal.
  • Loading branch information
hiroshige-g authored and domenic committed Jun 25, 2019
1 parent 24103e1 commit a7f9cdd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec.bs
Expand Up @@ -295,7 +295,11 @@ To <dfn>register an import map</dfn> given a [=string=] or a null |source text|,
<div algorithm>
To <dfn lt="parse a URL-like import specifier|parsing a URL-like import specifier">parse a URL-like import specifier</dfn>, given a [=string=] |specifier| and a [=URL=] |baseURL|:

1. If |specifier| [=/starts with=] "`/`", "`./`", or "`../`", then return the result of [=URL parser|parsing=] |specifier| with |baseURL| as the base URL.
1. If |specifier| [=/starts with=] "`/`", "`./`", or "`../`", then:
1. Let |url| be the result of [=URL parser|parsing=] |specifier| with |baseURL| as the base URL.
1. If |url| is failure, then return null.
<p class="example" id="example-bad-urllike-import-specifier">One way this could happen is if |specifier| is "`../foo`" and |baseURL| is a `data:` URL.</p>
1. Return |url|.
1. Let |url| be the result of [=URL parser|parsing=] |specifier| (with no base URL).
1. If |url| is failure, then return null.
1. If |url|'s [=url/scheme=] is either a [=fetch scheme=] or "`std`", then return |url|.
Expand Down Expand Up @@ -334,7 +338,7 @@ To <dfn>register an import map</dfn> given a [=string=] or a null |source text|,

All call sites of HTML's existing <a spec="html">resolve a module specifier</a> will need to be updated to pass the appropriate [=script=], not just its [=script/base URL=].

They will also need to be updated to account for it now throwing exceptions, instead of returning failure. (Previously they just turned failures into {{TypeError}}s manually, so this is straightforward.)
They will also need to be updated to account for it now throwing exceptions, instead of returning failure. (Previously most call sites just turned failures into {{TypeError}}s manually, so this is straightforward.)

<div algorithm>
To <dfn lt="resolve an imports match|resolving an imports match">resolve an imports match</dfn>, given a [=string=] |normalizedSpecifier|, a [=specifier map=] |specifierMap|, and a [=module map=] |moduleMap|:
Expand Down

0 comments on commit a7f9cdd

Please sign in to comment.