@@ -5247,37 +5247,41 @@ network.Initiator = {
52475247The <code> network.Initiatior</code> type represents the source of a network
52485248request.
52495249
5250+ Note: the purpose of initiator to allow finding out which resource
5251+ initiated a particular request.
5252+
52505253<div algorithm>
52515254To <dfn>get the initiator</dfn> given |request|:
52525255
525352561. Let |type| be "<code> other</code> ".
52545257
5258+ 1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
5259+
525552601. If |request| is a [=CORS-Preflight Request=] , set |type| to
52565261 "<code> preflight</code> ".
52575262
5258- 1. Otherwise, if |requests |'s [=parser metadata =] is "<code> not-parser-inserted </code> ",
5259- set |type| to "<code> script </code> ".
5263+ 1. Otherwise, if |request |'s [=request/initiator type =] is "<code> script </code> "
5264+ and |request| is [=isTopLevel=] , set |type| to "<code> parser </code> ".
52605265
5261- 1. Otherwise, if |requests |'s [=parser metadata =] is "<code> parser-inserted </code> ",
5266+ 1. Otherwise, if |request |'s [=request/initiator type =] is "<code> css </code> ",
52625267 set |type| to "<code> parser</code> ".
52635268
5264- 1. If |type| is "<code> script</code> ":
5265-
5266- 1. Let |stack trace| be the [=current stack trace=] .
5269+ 1. Otherwise, if |request|'s [=request/initiator type=] is "<code> script</code> "
5270+ and |request| is not [=isTopLevel=] , set |type| to "<code> script</code> ".
52675271
5268- 1. Let |url| be value of the <code> url</code> in |stack trace|[0] .
5272+ 1. If |request|'s [=request/referrer=] is a URL,
5273+ set |url| to |request|'s [=request/referrer=] otherwise set |url| to |request|' s document URL;
52695274
5270- 1. Let |line number| be value of the <code> lineNumber </code> field in
5271- |stack trace| [0] .
5275+ 1. If |type| is " <code> script </code> " or |request|'s [=request/initiator type=] is " <code> fetch </code> " or
5276+ " <code> xmlhttprequest </code> ":
52725277
5273- 1. Let |column number| be the value of the <code> columnNumber</code>
5274- field in |stack trace|[0] .
5278+ 1. Set |stack trace| be the [=current stack trace=] .
52755279
5276- 1. Otherwise, if |type| is "<code> parser</code> ":
5280+ 1. Otherwise, if |type| is "<code> parser</code> " and implementation defined parser state is available :
52775281
5278- 1. TODO: set url/ line/column based on the parser positions .
5282+ 1. Set | line number| to be zero- based parser line position when the |request| started .
52795283
5280- 1. Otherwise, let |stack trace|, | column number|, and |line number| all be null .
5284+ 1. Set | column number| to be zero-based parser column position when the |request| started .
52815285
528252861. Return a [=/map=] matching the <code> network.Initiator</code>
52835287 production, with the <code> type</code> field set to |type|, the
0 commit comments