You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setting the scheme to "file" should fail if there's a host or port #278
Activity
asajeffrey commentedon Feb 15, 2017
This is the root cause of servo/servo#15435
Auto merge of #15618 - asajeffrey:constellation-ipc-dont-panic, r=Man…
servo: Merge #15618 - Prevent the constellation from panicking if the…
servo: Merge #15618 - Prevent the constellation from panicking if the…
servo: Merge #15618 - Prevent the constellation from panicking if the…
set_scheme should fail if url has host or port
set_scheme should fail if url has host or port
set_scheme should fail if url has host or port
SimonSapin commentedon Jun 21, 2017
Should it really fail? This doesn’t match the spec at https://url.spec.whatwg.org/#dom-url-protocol
In this test case:
Firefox prints
file:///foo, Chromium printsfile://example.net:8080/foo. I think we probably want to do like Firefox and remove the port implicitly.@annevk Do you think the spec should be changed to remove the port in this case and avoid leaving the URL in an inconsistent state?
annevk commentedon Jun 22, 2017
If you look at scheme state 2.1.3 it seems pretty clear there is a special case. It's not quite failure, but it shouldn't succeed.
tmccombs commentedon Jun 24, 2017
https://url.spec.whatwg.org/#scheme-state
If I understand this correctly, it means that setting the scheme to file for a URL that has credentials or a port specified should fail.
annevk commentedon Jun 26, 2017
It's a no-op from the perspective of JavaScript, it doesn't throw. That's what I meant with not quite failure.
tmccombs commentedon Jun 27, 2017
You're right @annevk.
sanmai-NL commentedon Nov 6, 2017
@SimonSapin: Similarly, this library behaves counterintuitively when parsing a data URL.
See https://play.rust-lang.org/?gist=032d9d4e7724b68d74efec2daf07df35&version=stable
My reading of this discussion is that @tmccombs's #366 isn't an unreasonable approach in the end.
In the JavaScript console in the latest Firefox:
Some weirdness with the protocol component/scheme, but no hostname or port number extracted from a data URL for sure.
jdm commentedon Nov 6, 2017
@sanmai-NL Data URLs do not include the //.
sanmai-NL commentedon Nov 6, 2017
@jdm: I know, a valid example is the counterexample in the Rust playground test case.
annevk commentedon Nov 7, 2017
For a data URL that includes // Firefox is incorrect there as the URL parser doesn't special case data URLs.
servo: Merge #15618 - Prevent the constellation from panicking if the…
servo: Merge #15618 - Prevent the constellation from panicking if the…
servo: Merge #15618 - Prevent the constellation from panicking if the…
url: test that setting scheme to file with host fails (see #278)
djc commentedon Aug 25, 2020
This passes the proposed test, so I'm guessing it can be closed. I added the test in 7b8b841 just to make sure.
url: test that setting scheme to file with host fails (see servo#278)