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

[Spec] Set correct initiator (origin) of requests. #1246

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

qingxinwu
Copy link
Collaborator

@qingxinwu qingxinwu commented Aug 7, 2024

As https://fetch.spec.whatwg.org/#fetch-elsewhere-request says:
"If your fetching is not directly web-exposed, e.g., it is sent in the background without relying on a current Window or Worker, leave request’s client as null and set the request’s origin, policy container, service-workers mode, and referrer to appropriate values instead"

In the spec, we didn't set [=request/origin=] for most requests (also didn't set policy container field, which we may need to fix separately).
In implementation, we did set request initiator (spec's [=request/origin=]). Code references of what origins are set to:
script fetch: frame origin.
permissions check fetch: frame origin.
IG update fetch: IG owner
send report fetch: frame origin


Preview | Diff

@qingxinwu qingxinwu added the spec Relates to the spec label Aug 7, 2024
@qingxinwu
Copy link
Collaborator Author

This was pointed out in #1212 (comment)

@qingxinwu
Copy link
Collaborator Author

qingxinwu commented Aug 7, 2024

The spec also didn't set policy container field, which we may need to fix separately

@morlovich
Copy link
Collaborator

In the spec, we didn't set [=request/origin=] for most requests (also didn't set policy container field, which we may need to fix separately). In implementation, we did set request initiator (spec's [=request/origin=]). Code references of what origins are set to: script fetch:

Note that this is linking to an out-of-date version of the file; it doesn't affect origin for scripts but does affect it for trusted signals.

@@ -2502,6 +2512,9 @@ To <dfn>send report</dfn> given a [=URL=] |url|:
: [=request/redirect mode=]
:: "`error`"

Issue: One of the side-effects of a `null` client for this subresource request is it neuters
all service worker interceptions, despite not having to set the service workers mode.
Copy link
Collaborator

Choose a reason for hiding this comment

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

...Maybe we should just set it to "no service workers" explicitly?

Copy link
Collaborator Author

@qingxinwu qingxinwu Aug 7, 2024

Choose a reason for hiding this comment

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

IIRC, we didn't set service workers mode explicitly in Chrome's network code, that's why we had this note. But yes, just setting it to no service workers is probably a good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. Not setting it in the implementation still gives it a default value under the hood. I'd make that explicit in the spec.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This was at the bottom of my inbox, but it looks like this comment was never addressed, right? We did not set the service workers mode explicitly, is that right?

Copy link
Collaborator Author

@qingxinwu qingxinwu Dec 1, 2024

Choose a reason for hiding this comment

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

sorry forgot this. Here it is: #1351.

@qingxinwu
Copy link
Collaborator Author

In the spec, we didn't set [=request/origin=] for most requests (also didn't set policy container field, which we may need to fix separately). In implementation, we did set request initiator (spec's [=request/origin=]). Code references of what origins are set to: script fetch:

Note that this is linking to an out-of-date version of the file; it doesn't affect origin for scripts but does affect it for trusted signals.

ah updated others, but still missed one :). Updated now.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@@ -2502,6 +2512,9 @@ To <dfn>send report</dfn> given a [=URL=] |url|:
: [=request/redirect mode=]
:: "`error`"

Issue: One of the side-effects of a `null` client for this subresource request is it neuters
all service worker interceptions, despite not having to set the service workers mode.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. Not setting it in the implementation still gives it a default value under the hood. I'd make that explicit in the spec.

Co-authored-by: Dominic Farolino <[email protected]>
@domfarolino domfarolino merged commit c0ac4a8 into WICG:main Aug 13, 2024
2 checks passed
@qingxinwu qingxinwu deleted the initiator branch August 13, 2024 17:42
github-actions bot added a commit to qingxinwu/turtledove that referenced this pull request Aug 13, 2024
SHA: c0ac4a8
Reason: push, by qingxinwu

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Relates to the spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants