@@ -5247,37 +5247,41 @@ network.Initiator = {
5247
5247
The <code> network.Initiatior</code> type represents the source of a network
5248
5248
request.
5249
5249
5250
+ Note: the purpose of initiator to allow finding out which resource
5251
+ initiated a particular request.
5252
+
5250
5253
<div algorithm>
5251
5254
To <dfn>get the initiator</dfn> given |request|:
5252
5255
5253
5256
1. Let |type| be "<code> other</code> ".
5254
5257
5258
+ 1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
5259
+
5255
5260
1. If |request| is a [=CORS-Preflight Request=] , set |type| to
5256
5261
"<code> preflight</code> ".
5257
5262
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> ".
5260
5265
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> ",
5262
5267
set |type| to "<code> parser</code> ".
5263
5268
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> ".
5267
5271
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;
5269
5274
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> ":
5272
5277
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=] .
5275
5279
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 :
5277
5281
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 .
5279
5283
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 .
5281
5285
5282
5286
1. Return a [=/map=] matching the <code> network.Initiator</code>
5283
5287
production, with the <code> type</code> field set to |type|, the
0 commit comments