@@ -5269,37 +5269,47 @@ network.Initiator = {
5269
5269
The <code> network.Initiatior</code> type represents the source of a network
5270
5270
request.
5271
5271
5272
+ Note: the purpose of initiator to allow finding out which resource
5273
+ initiated a particular request.
5274
+
5272
5275
<div algorithm>
5273
5276
To <dfn>get the initiator</dfn> given |request|:
5274
5277
5275
5278
1. Let |type| be "<code> other</code> ".
5276
5279
5280
+ 1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
5281
+
5277
5282
1. If |request| is a [=CORS-Preflight Request=] , set |type| to
5278
5283
"<code> preflight</code> ".
5279
5284
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> ".
5282
5287
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> ",
5284
5292
set |type| to "<code> parser</code> ".
5285
5293
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;
5287
5298
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> ":
5289
5301
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= ] .
5291
5303
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:
5294
5305
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=] .
5297
5307
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 :
5299
5309
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| .
5301
5311
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| .
5303
5313
5304
5314
1. Return a [=/map=] matching the <code> network.Initiator</code>
5305
5315
production, with the <code> type</code> field set to |type|, the
0 commit comments