You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
If the sources are not absolute URLs after prepending the [=sourceRoot=], the sources are
246
252
resolved relative to the SourceMap (like resolving the script `src` attribute in an HTML document).
247
253
248
-
Encoding {#encoding}
249
-
--------------------
250
-
251
-
For simplicity, the character set encoding is always UTF-8.
252
-
253
-
Compression {#compression}
254
-
--------------------------
255
-
256
-
The file is allowed to be GZIP compressed. It is not expected that in-browser consumers of
257
-
the source map will support GZIP compression directly but that they will consume an
258
-
uncompressed map that may be GZIP'd for transport.
259
-
260
254
Extensions {#extensions}
261
255
------------------------
262
256
@@ -434,21 +428,35 @@ However, It is unclear what a "source map reference" looks like in anything othe
434
428
More specifically, what a source map reference looks like in a language that doesn't support
435
429
JavaScript-style single-line comments.
436
430
437
-
JSON over HTTP Transport
438
-
========================
439
-
440
-
For historic reasons, when delivering source maps over HTTP, servers may prepend a line
441
-
starting with the string `)]}'` to the source map. A client fetching a source map via
442
-
HTTP thus should check if the response starts with this string and then ignore the
443
-
first line.
444
-
445
-
```
446
-
)]}'garbage here
447
-
{"version": 3, ...}
448
-
```
449
-
450
-
Is to be interpreted as
451
-
452
-
```
453
-
{"version": 3, ...}
454
-
```
431
+
Fetching Source Maps {#fetching-source-maps}
432
+
============================================
433
+
434
+
To fetch a source map given a [=URL=] |url|, run the following steps:
435
+
436
+
1. Let |promise| be [=a new promise=].
437
+
1. Let |request| be a new [=request=] whose [=request/URL=] is |url|.
438
+
1. [=Fetch=] |request| with [=processResponseConsumeBody=] set to the following steps given [=response=]<var ignore>response</var> and null, failure, or a [=byte sequence=] |bodyBytes|:
439
+
1. If |bodyBytes| is null or failure, [=reject=] |promise| with a {{TypeError}} and abort these steps.
440
+
1. If |url|'s [=url/scheme=] is an [=HTTP(S) scheme=] and |bodyBytes| [=byte sequence/starts with=] \`<code>)]}'</code>\`, then:
441
+
1. [=While=] |bodyBytes|'s [=byte sequence/length=] is not 0 and |bodyBytes|'s 0th byte is not an [=HTTP newline byte=]:
442
+
1. remove the 0th byte from |bodyBytes|.
443
+
444
+
<div class="note">
445
+
<span class="marker">Note:</span> For historic reasons, when delivering source maps over HTTP(S), servers may prepend a line
446
+
starting with the string `)]}'` to the source map.
447
+
448
+
```
449
+
)]}'garbage here
450
+
{"version": 3, ...}
451
+
```
452
+
453
+
is interpreted as
454
+
455
+
```
456
+
{"version": 3, ...}
457
+
```
458
+
</div>
459
+
1. Let |sourceMap| be the result of [=parsing JSON bytes to a JavaScript value=] given |bodyBytes|.
460
+
1. If the previous step threw an error, [=reject=] |promise| with that error.
461
+
1. Otherwise, [=resolve=] |promise| with |sourceMap|.
0 commit comments