Skip to content

Commit 126df22

Browse files
committed
Update initiator algorithms
1 parent cf436af commit 126df22

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

index.bs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
212212
text: prompt; url: timers-and-user-prompts.html#dom-prompt
213213
text: remove a browsing context; url: browsers.html#bcg-remove
214214
text: report an error; url: webappapis.html#report-the-error
215+
text: resource; url: infrastructure.html#resources
215216
text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks
216217
text: same origin domain; url: browsers.html#same-origin-domain
217218
text: select an image source from a source set; url: images.html#select-an-image-source-from-a-source-set
@@ -5223,11 +5224,11 @@ To <dfn>deserialize header</dfn> given |protocol header|:
52235224

52245225
<pre class="cddl local-cddl">
52255226
network.Initiator = {
5226-
type: "parser" / "script" / "preflight" / "other",
5227+
type: text,
52275228
? columnNumber: js-uint,
52285229
? lineNumber: js-uint,
5230+
? url: text,
52295231
? stackTrace: script.StackTrace,
5230-
? request: network.Request
52315232
};
52325233
</pre>
52335234

@@ -5237,40 +5238,41 @@ request.
52375238
<div algorithm>
52385239
To <dfn>get the initiator</dfn> given |request|:
52395240

5240-
1. Let |request id| be |request|'s [=request id=].
5241-
5242-
1. Let |type| be "<code>other</code>".
5243-
5244-
1. If |request| is a [=CORS-Preflight Request=], set |type| to
5245-
"<code>preflight</code>".
5246-
5247-
1. TODO: Get the |type|. It's not quite clear how this ought to work; the CDP
5248-
data depends on whether the navigation was kicked off by the parser or by
5249-
script (so e.g. inserting an image from script causes the initiator to be
5250-
"<code>script</code>"), but that doesn't correspond to anything in Fetch.
5241+
1. Let |type| be |request|'s [=request/initiator type=].
52515242

52525243
1. If |request|'s [=request/initiator type=] is "<code>fetch</code>" or
52535244
"<code>xmlhttprequest</code>":
52545245

52555246
1. Let |stack trace| be the [=current stack trace=].
52565247

5257-
1. If |stack trace| has size of 1 or greater, let |line number| be value of the
5258-
<code>lineNumber</code> field in |stack trace|[0], and let |column number| be
5259-
the value of the <code>columnNumber</code> field in |stack trace|[0]. Otherwise
5260-
let |line number| and |column number| be 0.
5248+
1. If |stack trace| has size of 1 or greater:
5249+
5250+
1. Let |url| be value of the <code>url</code> in |stack trace|[0].
5251+
5252+
1. Let |line number| be value of the <code>lineNumber</code> field in
5253+
|stack trace|[0].
5254+
5255+
1. Let |column number| be the value of the <code>columnNumber</code>
5256+
field in |stack trace|[0].
5257+
5258+
1. Otherwise:
5259+
5260+
1. Let |stack trace| be null.
5261+
5262+
1. Let |url| be the URL of the [=resource=] that initiated |request|.
52615263

5262-
Otherwise, let |stack trace|, |column number|, and |line number| all be null.
5264+
1. Let |column number| be the column number within the [=resource=] that initiated |request|.
52635265

5264-
TODO: Chrome includes the current parser position as column number / line
5265-
number for parser-inserted resources.
5266+
1. Let |line number| be the line number within the [=resource=] that initiated |request|.
52665267

5267-
1. Return a [=/map=] matching the <code>network.Initiator</code> production, with
5268-
the <code>type</code> field set to |type|, the <code>columnNumber</code>
5269-
field set to |column number| if it's not null, or omitted otherwise, the
5270-
<code>lineNumber</code> field set to |line number| if it's not null, or
5271-
omitted otherwise, the <code>stackTrace</code> field set to |stack trace| if
5272-
it's not null, or omitted otherwise, and the <code>request</code> field set
5273-
to |request id|.
5268+
1. Return a [=/map=] matching the <code>network.Initiator</code>
5269+
production, with the <code>type</code> field set to |type|, the
5270+
<code>columnNumber</code> field set to |column number| if it's not
5271+
null, or omitted otherwise, the <code>lineNumber</code> field set to
5272+
|line number| if it's not null, or omitted otherwise, the
5273+
<code>stackTrace</code> field set to |stack trace| if it's not null,
5274+
or omitted otherwise, and the <code>url</code> field set to |url| if
5275+
it's not null, or omitted otherwise.
52745276

52755277
</div>
52765278

0 commit comments

Comments
 (0)