Skip to content

Commit 0c8f40b

Browse files
committed
initiator steps
1 parent cc5993e commit 0c8f40b

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

index.bs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5247,37 +5247,41 @@ network.Initiator = {
52475247
The <code>network.Initiatior</code> type represents the source of a network
52485248
request.
52495249

5250+
Note: the purpose of initiator to allow finding out which resource
5251+
initiated a particular request.
5252+
52505253
<div algorithm>
52515254
To <dfn>get the initiator</dfn> given |request|:
52525255

52535256
1. Let |type| be "<code>other</code>".
52545257

5258+
1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
5259+
52555260
1. 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

52825286
1. Return a [=/map=] matching the <code>network.Initiator</code>
52835287
production, with the <code>type</code> field set to |type|, the

0 commit comments

Comments
 (0)