diff --git a/index.bs b/index.bs
index 752a6db02..93a57eded 100644
--- a/index.bs
+++ b/index.bs
@@ -212,6 +212,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
text: prompt; url: timers-and-user-prompts.html#dom-prompt
text: remove a browsing context; url: browsers.html#bcg-remove
text: report an error; url: webappapis.html#report-the-error
+ text: resource; url: infrastructure.html#resources
text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks
text: same origin domain; url: browsers.html#same-origin-domain
text: select an image source from a source set; url: images.html#select-an-image-source-from-a-source-set
@@ -5260,51 +5261,64 @@ network.Initiator = {
type: "parser" / "script" / "preflight" / "other",
? columnNumber: js-uint,
? lineNumber: js-uint,
+ ? url: text,
? stackTrace: script.StackTrace,
- ? request: network.Request
};
The network.Initiatior
type represents the source of a network
request.
+Note: the purpose of initiator is to allow finding out which resource
+initiated a particular request.
+
other
".
+1. Let |stack trace|, |url|, |column number|, and |line number| all be null.
+
1. If |request| is a [=CORS-Preflight Request=], set |type| to
"preflight
".
-1. TODO: Get the |type|. It's not quite clear how this ought to work; the CDP
- data depends on whether the navigation was kicked off by the parser or by
- script (so e.g. inserting an image from script causes the initiator to be
- "script
"), but that doesn't correspond to anything in Fetch.
+1. Otherwise, if |request|'s [=request/initiator type=] is "script
"
+ and |request| is [=isTopLevel=], set |type| to "parser
".
+
+1. Otherwise, if |request|'s [=request/initiator type=] is "script
"
+ and |request| is not [=isTopLevel=], set |type| to "script
".
+
+1. Otherwise, if |request|'s [=request/initiator type=] is "css
",
+ set |type| to "parser
".
+
+ TODO: probably some other initiator types should be treated as "parser".
+
+1. If |request|'s [=request/referrer=] is a URL,
+ set |url| to |request|'s [=request/referrer=] otherwise set |url| to |request|'s document URL;
1. If |request|'s [=request/initiator type=] is "fetch
" or
"xmlhttprequest
":
- 1. Let |stack trace| be the [=current stack trace=].
+ 1. Set |stack trace| to the [=current stack trace=].
+
+1. Otherwise, if |type| is "script
" and [=current stack trace=] is available to the implementation:
+
+ 1. Set |stack trace| to the [=current stack trace=].
- 1. If |stack trace| has size of 1 or greater, let |line number| be value of the
- lineNumber
field in |stack trace|[0], and let |column number| be
- the value of the columnNumber
field in |stack trace|[0]. Otherwise
- let |line number| and |column number| be 0.
+1. Otherwise, if |type| is "parser
" and implementation-defined parser state is available:
- Otherwise, let |stack trace|, |column number|, and |line number| all be null.
+ 1. Set |line number| to be zero-based parser line position in the resource that initiated the |request|.
- TODO: Chrome includes the current parser position as column number / line
- number for parser-inserted resources.
+ 1. Set |column number| to be zero-based parser column position in the resource that initiated the |request|.
-1. Return a [=/map=] matching the network.Initiator
production, with
- the type
field set to |type|, the columnNumber
- field set to |column number| if it's not null, or omitted otherwise, the
- lineNumber
field set to |line number| if it's not null, or
- omitted otherwise, the stackTrace
field set to |stack trace| if
- it's not null, or omitted otherwise, and the request
field set
- to |request id|.
+1. Return a [=/map=] matching the network.Initiator
+ production, with the type
field set to |type|, the
+ columnNumber
field set to |column number| if it's not
+ null, or omitted otherwise, the lineNumber
field set to
+ |line number| if it's not null, or omitted otherwise, the
+ stackTrace
field set to |stack trace| if it's not null,
+ or omitted otherwise, and the url
field set to |url| if
+ it's not null, or omitted otherwise.