diff --git a/index.bs b/index.bs index a96f99c8..028c0ddb 100644 --- a/index.bs +++ b/index.bs @@ -5269,37 +5269,47 @@ network.Initiator = { The network.Initiatior type represents the source of a network request. +Note: the purpose of initiator to allow finding out which resource +initiated a particular request. +
To get the initiator given |request|: 1. Let |type| be "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. Otherwise, if |requests|'s [=parser metadata=] is "not-parser-inserted", - set |type| to "script". +1. Otherwise, if |request|'s [=request/initiator type=] is "script" + and |request| is [=isTopLevel=], set |type| to "parser". -1. Otherwise, if |requests|'s [=parser metadata=] is "parser-inserted", +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". -1. If |type| is "script": + TODO: probably some other initator 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. Let |stack trace| be the [=current stack trace=]. +1. If |request|'s [=request/initiator type=] is "fetch" or + "xmlhttprequest": - 1. Let |url| be value of the url in |stack trace|[0]. + 1. Set |stack trace| be the [=current stack trace=]. - 1. Let |line number| be value of the lineNumber field in - |stack trace|[0]. +1. Otherwise, if |type| is "script" and [=current stack trace=] is available to the implemenation, - 1. Let |column number| be the value of the columnNumber - field in |stack trace|[0]. + 1. Set |stack trace| be the [=current stack trace=]. -1. Otherwise, if |type| is "parser": +1. Otherwise, if |type| is "parser" and implementation-defined parser state is available: - 1. TODO: set url/line/column based on the parser positions. + 1. Set |line number| to be zero-based parser line position in the resource that initiated the |request|. -1. Otherwise, let |stack trace|, |column number|, and |line number| all be null. + 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