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

Add fetch calls #356

Merged
merged 7 commits into from
Sep 30, 2022
Merged

Add fetch calls #356

merged 7 commits into from
Sep 30, 2022

Conversation

npm1
Copy link
Collaborator

@npm1 npm1 commented Sep 27, 2022

Relevant issues:

This PR adds the fetch calls to the other FedCM fetches.


Preview | Diff

Copy link
Collaborator

@samuelgoto samuelgoto left a comment

Choose a reason for hiding this comment

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

Looks generally good to me, but we need to resolve TODOs before merging. Will take another pass when you resolve them.

@npm1
Copy link
Collaborator Author

npm1 commented Sep 29, 2022

PTAL, addressed all of your comments. The pending thing is the referrer being handwavy (in the case we do want to send it), while I figure out how to set it properly.

1. [=request/window=] set to "no-window"
1. [=request/service-workers mode=] set to "none"
1. [=request/destination=] set to "identity"
1. [=request/origin=] set to a unique [=opaque origin=]
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does this do? is this for the cache partitioning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It sets the origin of the request. The origin is 'user agent' but there is not such thing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this supposed to be referring to this [1]? [=opaque origin=] serializes to "null" rather than "user agent" right [2]?

Do you know what this is for?

[1] https://fetch.spec.whatwg.org/#concept-request-origin
[2] https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure what origin is used when not using CORS but there is no such thing as 'user agent' origin in Fetch right now, so I think an opaque origin works best (this was Dominic's recommendation)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't know what this is for, why are we setting it? Is that a required field? Can we just leave it unset for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not think so, because Fetch does not handle that properly. If request’s origin is "client", then set request’s origin to request’s client’s origin.
https://fetch.spec.whatwg.org/#ref-for-concept-request-origin%E2%91%A6:~:text=If%20request%E2%80%99s%20origin%20is%20%22client%22%2C%20then%20set%20request%E2%80%99s%20origin%20to%20request%E2%80%99s%20client%E2%80%99s%20origin.

@npm1
Copy link
Collaborator Author

npm1 commented Sep 29, 2022

Ready for more review, PTAL.

Copy link
Collaborator

@samuelgoto samuelgoto left a comment

Choose a reason for hiding this comment

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

Looks generally good to me, but still feels like the parameters aren't quite right.

On a separate note, any chance we can get @domfarolino to take a pass at this too?

1. [=request/window=] set to "no-window"
1. [=request/service-workers mode=] set to "none"
1. [=request/destination=] set to "identity"
1. [=request/origin=] set to a unique [=opaque origin=]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this supposed to be referring to this [1]? [=opaque origin=] serializes to "null" rather than "user agent" right [2]?

Do you know what this is for?

[1] https://fetch.spec.whatwg.org/#concept-request-origin
[2] https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque

@npm1
Copy link
Collaborator Author

npm1 commented Sep 30, 2022

Looks generally good to me, but still feels like the parameters aren't quite right.

On a separate note, any chance we can get @domfarolino to take a pass at this too?

Can you look again but looking at the latest version??

@npm1
Copy link
Collaborator Author

npm1 commented Sep 30, 2022

Added Sec- header changes

1. [=request/window=] set to "no-window"
1. [=request/service-workers mode=] set to "none"
1. [=request/destination=] set to "identity"
1. [=request/origin=] set to a unique [=opaque origin=]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't know what this is for, why are we setting it? Is that a required field? Can we just leave it unset for now?

spec/index.bs Outdated
1. [=request/destination=] set to "web-identity"
1. [=request/origin=] set to a unique [=opaque origin=]
1. [=request/header list=] set to a [=list=] containing a single [=header=] with
[=header/name=] set to "Accept" and [=header/value=] set to "JSON"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, shouldn't this be a mime type? Are you sure this isn't supposed to be text/json?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, don't think so? MIME type is an object computed from headers[1] but header names and values are byte sequences [2]. I think it should be application/json based on the implementation.
[1] https://mimesniff.spec.whatwg.org/#mime-type
[2] https://fetch.spec.whatwg.org/#concept-header

Copy link
Collaborator Author

@npm1 npm1 left a comment

Choose a reason for hiding this comment

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

Thanks for the review, PTAL.

1. [=request/window=] set to "no-window"
1. [=request/service-workers mode=] set to "none"
1. [=request/destination=] set to "identity"
1. [=request/origin=] set to a unique [=opaque origin=]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not think so, because Fetch does not handle that properly. If request’s origin is "client", then set request’s origin to request’s client’s origin.
https://fetch.spec.whatwg.org/#ref-for-concept-request-origin%E2%91%A6:~:text=If%20request%E2%80%99s%20origin%20is%20%22client%22%2C%20then%20set%20request%E2%80%99s%20origin%20to%20request%E2%80%99s%20client%E2%80%99s%20origin.

spec/index.bs Outdated
1. [=request/destination=] set to "web-identity"
1. [=request/origin=] set to a unique [=opaque origin=]
1. [=request/header list=] set to a [=list=] containing a single [=header=] with
[=header/name=] set to "Accept" and [=header/value=] set to "JSON"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, don't think so? MIME type is an object computed from headers[1] but header names and values are byte sequences [2]. I think it should be application/json based on the implementation.
[1] https://mimesniff.spec.whatwg.org/#mime-type
[2] https://fetch.spec.whatwg.org/#concept-header

@samuelgoto
Copy link
Collaborator

LGTM

I'll merge, and if there is anything pending we can patch separately.

@samuelgoto samuelgoto merged commit a38e359 into w3c-fedid:main Sep 30, 2022
github-actions bot added a commit that referenced this pull request Sep 30, 2022
SHA: a38e359
Reason: push, by @samuelgoto

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@npm1 npm1 deleted the fetch1 branch September 30, 2022 21:04
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.

2 participants