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

Clarification: how are origins compared for equality? #468

Closed
asajeffrey opened this issue Jan 27, 2017 · 5 comments

Comments

2 participants
@asajeffrey
Copy link
Contributor

commented Jan 27, 2017

In https://fetch.spec.whatwg.org/#concept-main-fetch, main fetch step 11 includes a test:

request’s current url’s origin is request’s origin and CORS flag is unset

which includes an equality test between origins, but it is not clear which equality is meant. The lhs is "request’s current url’s origin", so its domain is always null (https://url.spec.whatwg.org/#origin). The rhs is the "request’s origin", which may be set by https://fetch.spec.whatwg.org/#dom-request, step 7:

Let origin be current settings object’s origin.

or by https://fetch.spec.whatwg.org/#concept-fetch, step 2:

If request’s origin is "client", set request’s origin to request’s client’s origin.

which may have a domain.

I think what's intended is that the origins are to be compared as being same-origin (https://html.spec.whatwg.org/multipage/browsers.html#same-origin) that is the domain is ignored. However, the way the spec is currently written, it looks like syntactic identity is being used, so the test will fail if the client has set document.domain.

Should the test here be "request’s current url’s origin is the same as request’s origin and CORS flag is unset"?

@asajeffrey

This comment has been minimized.

Copy link
Contributor Author

commented Jan 27, 2017

In general, it would be really really nice for Servo if the Fetch spec never touched origin domains, since those are mutable due to document.domain, which gives Servo lots of headaches since the fetch may be performed by a different process. cc @jdm

@annevk

This comment has been minimized.

Copy link
Member

commented Jan 27, 2017

Yeah, these should use "same origin".

@asajeffrey

This comment has been minimized.

Copy link
Contributor Author

commented Jan 27, 2017

@annevk OK, should I submit a PR with this change?

@annevk

This comment has been minimized.

Copy link
Member

commented Jan 27, 2017

@asajeffrey that'd be great if you can. I don't think we necessarily need new tests for this change since this is just a clarification.

@asajeffrey

This comment has been minimized.

Copy link
Contributor Author

commented Jan 27, 2017

@annevk OK, will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.