Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Use fetch infrastructure to fetch source maps
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jan 18, 2024
1 parent cbbc033 commit 58c0ba0
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions source-map.bs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ spec:html; type:element;
text:style
text:title
text:link

spec:bikeshed-1; type:dfn; for:railroad; text:optional

spec:fetch; type:dfn; for:/; text:request
spec:fetch; type:dfn; for:/; text:response

spec:url; type:dfn; for:/; text:url
</pre>

<pre class="biblio">
Expand Down Expand Up @@ -245,17 +251,19 @@ Resolving Sources {#resolving-sources}
If the sources are not absolute URLs after prepending the [=sourceRoot=], the sources are
resolved relative to the SourceMap (like resolving the script `src` attribute in an HTML document).

Encoding {#encoding}
--------------------

For simplicity, the character set encoding is always UTF-8.
Fetching Source Maps {#fetching-source-maps}
--------------------------------------------

Compression {#compression}
--------------------------
To fetch a source map, given a [=URL=] |url|, run the following steps:

The file is allowed to be GZIP compressed. It is not expected that in-browser consumers of
the source map will support GZIP compression directly but that they will consume an
uncompressed map that may be GZIP'd for transport.
1. Let |promise| be [=a new promise=].
1. Let |request| be a new [=request=] whose [=request/URL=] is |url|.
1. [=Fetch=] |request| with [=processResponseConsumeBody=] set to the following steps given [=response=] <var ignore>response</var> and null, failure, or a [=byte sequence=] |bodyBytes|:
1. If |bodyBytes| is null or failure, [=reject=] |promise| with a {{TypeError}} and abort these steps.
1. Let |sourceMap| be the result of [=parsing JSON bytes to a JavaScript value=] given |bodyBytes|.
1. If the previous step threw an error, [=reject=] |promise| with that error.
1. Otherwise, [=resolve=] |promise| with |sourceMap|.
1. Return |promise|.

Extensions {#extensions}
------------------------
Expand Down

0 comments on commit 58c0ba0

Please sign in to comment.