Skip to content

Commit 65c440f

Browse files
committed
Specify a bit about how the initator field in requests should work
1 parent 9df7564 commit 65c440f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

index.bs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3984,7 +3984,37 @@ The <code>Initiatior</code> type represents the source of a network request.
39843984
<div algorithm>
39853985
To <dfn>get the initiator</dfn> given |request|:
39863986

3987-
1. TODO
3987+
1. Let |type| be "<code>other</code>".
3988+
3989+
1. If |request| is a [=CORS Preflight Request=], set |type| to
3990+
"<code>preflight</code>".
3991+
3992+
1. TODO: Get the |type|. It's not quite clear how this ought to work; the CDP
3993+
data depends on whether the navigation was kicked off by the parser or by
3994+
script (so e.g. inserting an image from script causes the initiator to be
3995+
"<code>script</code>"), but that doesn't correspond to anything in Fetch.
3996+
3997+
1. If |request|'s [=request/initiator-type=] is "<code>fetch</code>" or
3998+
"<code>xmlhttprequest</code>":
3999+
4000+
1. Let |stack trace| be the [=current stack trace=].
4001+
4002+
1. If |stack trace| has size of 1 or greater, let |line number| be value of the
4003+
<code>lineNumber</code> field in |stack trace|[0], and let |column number| be
4004+
the value of the <code>columnNumber</code> field |stack trace|[0]. Otherwise
4005+
let |line number| and |column number| be 0.
4006+
4007+
Otherwise, let |stack trace|, |column number|, and |line number| all be null.
4008+
4009+
TODO: Chrome includes the current parser position as column number / line
4010+
number for parser-inserted resources.
4011+
4012+
1. Return a [=map=] matching the <code>NetworkInitiator</code> production, with
4013+
the |type| field set to "<code>type</code>", the <code>columnNumber</code>
4014+
field set to |column number| if it's not null, or omitted otherwise, the
4015+
<code>lineNumber</code> field set to |line number| if it's not null, or
4016+
omitted otherwise, the <code>stackTrace</code> field set to |stack trace| if
4017+
it's not null, or omitted otherwise.
39884018

39894019
</div>
39904020

0 commit comments

Comments
 (0)