Skip to content
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

Clarify the initiator steps #714

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Clarify the initiator steps #714

wants to merge 6 commits into from

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented May 21, 2024

Issue #698

This PR clarifies the logic of how to compute various initiator types and makes the following changes:

  • removes the requestId since it is already included in the network event that contains the initiator.
  • adds a URL to hold the referrer for the initators that do not have a stack trace.
  • clarifies that the line and column position should be based on the implementation-specific parser metadata that is currently not specified by web standards but usually is available for error reporting and DevTools.
  • adds a note clarifying the purpose of the initiator: to give the user the information about how a particular request was triggered, so that the source of the request can be identified.

Preview | Diff

@OrKoN OrKoN force-pushed the orkon/initiator-id branch 2 times, most recently from 7c0f66a to ff7b66d Compare May 21, 2024 11:54
@OrKoN OrKoN closed this May 21, 2024
@OrKoN OrKoN reopened this May 21, 2024
@OrKoN OrKoN force-pushed the orkon/initiator-id branch 4 times, most recently from a7af82c to 1e54584 Compare May 24, 2024 07:42
@OrKoN OrKoN force-pushed the orkon/initiator-id branch 3 times, most recently from 2dd66fc to 0c8f40b Compare June 7, 2024 14:03
@OrKoN OrKoN changed the title Update initiator algorithms Clarify the initiator steps Jun 13, 2024
@OrKoN OrKoN marked this pull request as ready for review June 13, 2024 17:58
@OrKoN
Copy link
Contributor Author

OrKoN commented Jun 14, 2024

@juliandescottes @jgraham @whimboo I attempted to improve the initiator steps. There are still a few problems although it brings the steps closer to what is expressed by CDDL types. Problems:

  1. I am not quite sure that there referrer would be an URL. The fetch spec mentions that it will be a URL or no-referrer during fetching. CSSOM spec seems to be always setting it without checking for no-referrer.
  2. the parser positions are "implementation-defined" since I could not link to any spec.
  3. the parser type is extended to cover the css initiators but it is a bit difficult to track what exactly fetch initiators define.

WDYT?

Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, overall that looks good to me. Not sure yet how to retrieve the fetch initiator type on our side, but that shouldn't block landing this.

index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
OrKoN and others added 3 commits June 27, 2024 12:26
Co-authored-by: Julian Descottes <[email protected]>
Co-authored-by: Julian Descottes <[email protected]>
Co-authored-by: Julian Descottes <[email protected]>
Copy link
Member

@jgraham jgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like if all the logic we need to map onto what Puppeteer expects is the fetch initiator type and isTopLevel we should consider just providing those directly and performing the mapping in the client.

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>",
Copy link
Member

Choose a reason for hiding this comment

The 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. @import rules (I don't know how CDP behaves)

@juliandescottes
Copy link
Contributor

@OrKoN what do you think about the suggestion from @jgraham to only expose the fetch initiator + isTopLevel. Having the BiDi initiator differ from the fetch initiator could be confusing I think?

@OrKoN
Copy link
Contributor Author

OrKoN commented Aug 6, 2024

@juliandescottes I think the BiDi initiator is already different from the fetch spec: "parser" / "script" / "preflight" / "other these are the types currently specified. The issue with the fetch spec is that it is not clear how all those initiator types are computed (the fetch spec has a list but the computations seem to be scattered around a bunch of other specs?) and AFAIK our implementation does not implement all of them. In any case, I think we can postpone this then. In CDP, we do not have isTopLevel and fetch initiator types exposed so it would take some time to plumb them through and since there is no use case for exposing them directly, we can consider it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants