-
Notifications
You must be signed in to change notification settings - Fork 51
Clarify the initiator steps #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
OrKoN
wants to merge
6
commits into
main
Choose a base branch
from
orkon/initiator-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
}; | ||
</pre> | ||
|
||
The <code>network.Initiatior</code> type represents the source of a network | ||
request. | ||
|
||
Note: the purpose of initiator is to allow finding out which resource | ||
initiated a particular request. | ||
|
||
<div algorithm> | ||
To <dfn>get the initiator</dfn> given |request|: | ||
|
||
1. Let |request id| be |request|'s [=request id=]. | ||
|
||
1. Let |type| be "<code>other</code>". | ||
|
||
1. Let |stack trace|, |url|, |column number|, and |line number| all be null. | ||
|
||
1. If |request| is a [=CORS-Preflight Request=], set |type| to | ||
"<code>preflight</code>". | ||
|
||
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 | ||
"<code>script</code>"), but that doesn't correspond to anything in Fetch. | ||
1. Otherwise, if |request|'s [=request/initiator type=] is "<code>script</code>" | ||
and |request| is [=isTopLevel=], set |type| to "<code>parser</code>". | ||
|
||
1. Otherwise, if |request|'s [=request/initiator type=] is "<code>script</code>" | ||
and |request| is not [=isTopLevel=], set |type| to "<code>script</code>". | ||
|
||
1. Otherwise, if |request|'s [=request/initiator type=] is "<code>css</code>", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me if this is correct given e.g. |
||
set |type| to "<code>parser</code>". | ||
|
||
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 "<code>fetch</code>" or | ||
"<code>xmlhttprequest</code>": | ||
|
||
1. Let |stack trace| be the [=current stack trace=]. | ||
1. Set |stack trace| to the [=current stack trace=]. | ||
|
||
1. Otherwise, if |type| is "<code>script</code>" 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 | ||
<code>lineNumber</code> field in |stack trace|[0], and let |column number| be | ||
the value of the <code>columnNumber</code> field in |stack trace|[0]. Otherwise | ||
let |line number| and |column number| be 0. | ||
1. Otherwise, if |type| is "<code>parser</code>" 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 <code>network.Initiator</code> production, with | ||
the <code>type</code> field set to |type|, the <code>columnNumber</code> | ||
field set to |column number| if it's not null, or omitted otherwise, the | ||
<code>lineNumber</code> field set to |line number| if it's not null, or | ||
omitted otherwise, the <code>stackTrace</code> field set to |stack trace| if | ||
it's not null, or omitted otherwise, and the <code>request</code> field set | ||
to |request id|. | ||
1. Return a [=/map=] matching the <code>network.Initiator</code> | ||
production, with the <code>type</code> field set to |type|, the | ||
<code>columnNumber</code> field set to |column number| if it's not | ||
null, or omitted otherwise, the <code>lineNumber</code> field set to | ||
|line number| if it's not null, or omitted otherwise, the | ||
<code>stackTrace</code> field set to |stack trace| if it's not null, | ||
or omitted otherwise, and the <code>url</code> field set to |url| if | ||
it's not null, or omitted otherwise. | ||
|
||
</div> | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.