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

URL: file: URLs have implementation-defined origins #41158

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

annevk
Copy link
Member

@annevk annevk commented Jul 24, 2023

See whatwg/url#780 for context.

@rmisev
Copy link
Member

rmisev commented Jul 24, 2023

I think it may be useful to add test written in JS, say with following cases:

  • new URL("file:///").origin === new URL("blob:file:///").origin
  • new URL("file://host/").origin === new URL("blob:file://host/").origin

@anonrig
Copy link
Member

anonrig commented Jul 25, 2023

These changes are not sufficient enough for us to verify the correctness. Can you also add a Javascript test as well? Additionally, do we need to change any wording in the specification itself?

@annevk
Copy link
Member Author

annevk commented Jul 25, 2023

@anonrig see the link in OP.

I'm not sure we can create those tests @rmisev. While I think I agree with them in spirit, in theory at least the specification allows for those to not be equal.

@rmisev
Copy link
Member

rmisev commented Jul 25, 2023

I'm not sure we can create those tests @rmisev. While I think I agree with them in spirit, in theory at least the specification allows for those to not be equal.

Hmm, after whatwg/url#780 the specification says this about the origin of blob URL:

  1. If pathURL’s scheme is "http", "https", or "file", then return pathURL’s origin

So for blob:file://host/ it must return the origin of file://host/. In other words:
new URL("blob:file://host/").origin === new URL("file://host/").origin
Why do you say that they can be unequal?

@annevk
Copy link
Member Author

annevk commented Jul 26, 2023

Because

Unfortunate as it is, this is left as an exercise to the reader.

could return a random string, for instance.

@Ms2ger Ms2ger merged commit 373be7b into master Aug 18, 2023
@Ms2ger Ms2ger deleted the annevk/file-url-origin branch August 18, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants