@@ -5269,37 +5269,47 @@ network.Initiator = {
52695269The <code> network.Initiatior</code> type represents the source of a network
52705270request.
52715271
5272+ Note: the purpose of initiator to allow finding out which resource
5273+ initiated a particular request.
5274+
52725275<div algorithm>
52735276To <dfn>get the initiator</dfn> given |request|:
52745277
527552781. Let |type| be "<code> other</code> ".
52765279
5280+ 1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
5281+
527752821. If |request| is a [=CORS-Preflight Request=] , set |type| to
52785283 "<code> preflight</code> ".
52795284
5280- 1. Otherwise, if |requests |'s [=parser metadata =] is "<code> not-parser-inserted </code> ",
5281- set |type| to "<code> script </code> ".
5285+ 1. Otherwise, if |request |'s [=request/initiator type =] is "<code> script </code> "
5286+ and |request| is [=isTopLevel=] , set |type| to "<code> parser </code> ".
52825287
5283- 1. Otherwise, if |requests|'s [=parser metadata=] is "<code> parser-inserted</code> ",
5288+ 1. Otherwise, if |request|'s [=request/initiator type=] is "<code> script</code> "
5289+ and |request| is not [=isTopLevel=] , set |type| to "<code> script</code> ".
5290+
5291+ 1. Otherwise, if |request|'s [=request/initiator type=] is "<code> css</code> ",
52845292 set |type| to "<code> parser</code> ".
52855293
5286- 1. If |type| is "<code> script</code> ":
5294+ TODO: probably some other initiator types should be treated as "parser".
5295+
5296+ 1. If |request|'s [=request/referrer=] is a URL,
5297+ set |url| to |request|'s [=request/referrer=] otherwise set |url| to |request|' s document URL;
52875298
5288- 1. Let |stack trace| be the [=current stack trace=] .
5299+ 1. If |request|'s [=request/initiator type=] is "<code> fetch</code> " or
5300+ "<code> xmlhttprequest</code> ":
52895301
5290- 1. Let |url | be value of the <code> url </code> in | stack trace| [0 ] .
5302+ 1. Set |stack trace | be the [=current stack trace= ] .
52915303
5292- 1. Let |line number| be value of the <code> lineNumber</code> field in
5293- |stack trace|[0] .
5304+ 1. Otherwise, if |type| is "<code> script</code> " and [=current stack trace=] is available to the implementation:
52945305
5295- 1. Let |column number| be the value of the <code> columnNumber</code>
5296- field in |stack trace|[0] .
5306+ 1. Set |stack trace| be the [=current stack trace=] .
52975307
5298- 1. Otherwise, if |type| is "<code> parser</code> ":
5308+ 1. Otherwise, if |type| is "<code> parser</code> " and implementation-defined parser state is available :
52995309
5300- 1. TODO: set url/ line/column based on the parser positions .
5310+ 1. Set | line number| to be zero- based parser line position in the resource that initiated the |request| .
53015311
5302- 1. Otherwise, let |stack trace|, | column number|, and |line number| all be null .
5312+ 1. Set |column number| to be zero-based parser column position in the resource that initiated the |request| .
53035313
530453141. Return a [=/map=] matching the <code> network.Initiator</code>
53055315 production, with the <code> type</code> field set to |type|, the
0 commit comments