Skip to content

Commit a8103b4

Browse files
committed
Update initiator algorithms
1 parent 5614cf1 commit a8103b4

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

index.bs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
212212
text: prompt; url: timers-and-user-prompts.html#dom-prompt
213213
text: remove a browsing context; url: browsers.html#bcg-remove
214214
text: report an error; url: webappapis.html#report-the-error
215+
text: resource; url: infrastructure.html#resources
215216
text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks
216217
text: same origin domain; url: browsers.html#same-origin-domain
217218
text: select an image source from a source set; url: images.html#select-an-image-source-from-a-source-set
@@ -5235,11 +5236,11 @@ To <dfn>deserialize header</dfn> given |protocol header|:
52355236

52365237
<pre class="cddl local-cddl">
52375238
network.Initiator = {
5238-
type: "parser" / "script" / "preflight" / "other",
5239+
type: text,
52395240
? columnNumber: js-uint,
52405241
? lineNumber: js-uint,
5242+
? url: text,
52415243
? stackTrace: script.StackTrace,
5242-
? request: network.Request
52435244
};
52445245
</pre>
52455246

@@ -5249,40 +5250,41 @@ request.
52495250
<div algorithm>
52505251
To <dfn>get the initiator</dfn> given |request|:
52515252

5252-
1. Let |request id| be |request|'s [=request id=].
5253-
5254-
1. Let |type| be "<code>other</code>".
5255-
5256-
1. If |request| is a [=CORS-Preflight Request=], set |type| to
5257-
"<code>preflight</code>".
5258-
5259-
1. TODO: Get the |type|. It's not quite clear how this ought to work; the CDP
5260-
data depends on whether the navigation was kicked off by the parser or by
5261-
script (so e.g. inserting an image from script causes the initiator to be
5262-
"<code>script</code>"), but that doesn't correspond to anything in Fetch.
5253+
1. Let |type| be |request|'s [=request/initiator type=].
52635254

52645255
1. If |request|'s [=request/initiator type=] is "<code>fetch</code>" or
52655256
"<code>xmlhttprequest</code>":
52665257

52675258
1. Let |stack trace| be the [=current stack trace=].
52685259

5269-
1. If |stack trace| has size of 1 or greater, let |line number| be value of the
5270-
<code>lineNumber</code> field in |stack trace|[0], and let |column number| be
5271-
the value of the <code>columnNumber</code> field in |stack trace|[0]. Otherwise
5272-
let |line number| and |column number| be 0.
5260+
1. If |stack trace| has size of 1 or greater:
5261+
5262+
1. Let |url| be value of the <code>url</code> in |stack trace|[0].
5263+
5264+
1. Let |line number| be value of the <code>lineNumber</code> field in
5265+
|stack trace|[0].
5266+
5267+
1. Let |column number| be the value of the <code>columnNumber</code>
5268+
field in |stack trace|[0].
5269+
5270+
1. Otherwise:
5271+
5272+
1. Let |stack trace| be null.
5273+
5274+
1. Let |url| be the URL of the [=resource=] that initiated |request|.
52735275

5274-
Otherwise, let |stack trace|, |column number|, and |line number| all be null.
5276+
1. Let |column number| be the column number within the [=resource=] that initiated |request|.
52755277

5276-
TODO: Chrome includes the current parser position as column number / line
5277-
number for parser-inserted resources.
5278+
1. Let |line number| be the line number within the [=resource=] that initiated |request|.
52785279

5279-
1. Return a [=/map=] matching the <code>network.Initiator</code> production, with
5280-
the <code>type</code> field set to |type|, the <code>columnNumber</code>
5281-
field set to |column number| if it's not null, or omitted otherwise, the
5282-
<code>lineNumber</code> field set to |line number| if it's not null, or
5283-
omitted otherwise, the <code>stackTrace</code> field set to |stack trace| if
5284-
it's not null, or omitted otherwise, and the <code>request</code> field set
5285-
to |request id|.
5280+
1. Return a [=/map=] matching the <code>network.Initiator</code>
5281+
production, with the <code>type</code> field set to |type|, the
5282+
<code>columnNumber</code> field set to |column number| if it's not
5283+
null, or omitted otherwise, the <code>lineNumber</code> field set to
5284+
|line number| if it's not null, or omitted otherwise, the
5285+
<code>stackTrace</code> field set to |stack trace| if it's not null,
5286+
or omitted otherwise, and the <code>url</code> field set to |url| if
5287+
it's not null, or omitted otherwise.
52865288

52875289
</div>
52885290

0 commit comments

Comments
 (0)