@@ -3915,7 +3915,37 @@ The <code>Initiatior</code> type represents the source of a network request.
39153915<div algorithm>
39163916To <dfn>get the initiator</dfn> given |request|:
39173917
3918- 1. TODO
3918+ 1. Let |type| be "<code> other</code> ".
3919+
3920+ 1. If |request| is a [=CORS Preflight Request=] , set |type| to
3921+ "<code> preflight</code> ".
3922+
3923+ 1. TODO: Get the |type|. It's not quite clear how this ought to work; the CDP
3924+ data depends on whether the navigation was kicked off by the parser or by
3925+ script (so e.g. inserting an image from script causes the initiator to be
3926+ "<code> script</code> "), but that doesn't correspond to anything in Fetch.
3927+
3928+ 1. If |request|'s [=request/initiator-type=] is "<code> fetch</code> " or
3929+ "<code> xmlhttprequest</code> ":
3930+
3931+ 1. Let |stack trace| be the [=current stack trace=] .
3932+
3933+ 1. If |stack trace| has size of 1 or greater, let |line number| be value of the
3934+ <code> lineNumber</code> field in |stack trace|[0] , and let |column number| be
3935+ the value of the <code> columnNumber</code> field |stack trace|[0] . Otherwise
3936+ let |line number| and |column number| be 0.
3937+
3938+ Otherwise, let |stack trace|, |column number|, and |line number| all be null.
3939+
3940+ TODO: Chrome includes the current parser position as column number / line
3941+ number for parser-inserted resources.
3942+
3943+ 1. Return a [=map=] matching the <code> NetworkInitiator</code> production, with
3944+ the |type| field set to "<code> type</code> ", the <code> columnNumber</code>
3945+ field set to |column number| if it's not null, or omitted otherwise, the
3946+ <code> lineNumber</code> field set to |line number| if it's not null, or
3947+ omitted otherwise, the <code> stackTrace</code> field set to |stack trace| if
3948+ it's not null, or omitted otherwise.
39193949
39203950</div>
39213951
0 commit comments