-
Notifications
You must be signed in to change notification settings - Fork 347
Changes needed for gecko-integration #201
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
Conversation
…ostname. Implement From<u32> for Position to allow use of slicing methods from C API.
I’ll comment more tomorrow, but why the first change? It deviates from the spec. If it’s necessary for web-compat, the spec should be changed. |
I forgot to mention the reasoning behind this. Indeed it deviates from the spec (which is why I made it a feature), but that is needed to support old addons in Gecko, which access their content using a URL such as resource://ADDON_ID/path - where ADDON_ID usually contains a percent encoded |
Does Gecko’s URL parser for web content have the same behavior? If that’s the case and Gecko is not willing to align with the spec, maybe the spec should be changed. Could you file an issue on https://github.com/whatwg/url/issues/ with the proposed parser changes and this reasoning? Instead of a compile-time switch it could be a per-URL run-time one: add a method to I’ll comment inline on implementation details. |
@@ -110,6 +110,14 @@ define_encode_set! { | |||
} | |||
} | |||
|
|||
define_encode_set! { | |||
/// This encode set is used to decide which characters are allowed in the hostname. | |||
pub HOSTNAME_ENCODE_SET = [SIMPLE_ENCODE_SET] | { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encode sets are normally used for percent encoding, not decoding. So I’d rather not expose this in the public API. In after_percent_sign
you could "inline" !HOSTNAME_ENCODE_SET.contains(c)
to !(matches(c, ' ' | '!' | '"' | /* ...*/ '~') || c < '\u{20}' || c > '\u{7E}')
, or invert the logic and use matches!(c, 'a'...'z' | 'A'...'Z' | '0'...'9' | '.' | '-' | '_' | '*')
. (I think that’s the complementary set, but I’m not sure *
should be there.)
Why not use an enum from C too for Position? |
☔ The latest upstream changes (presumably #216) made this pull request unmergeable. Please resolve the merge conflicts. |
The resource://ADDON_ID issue will be fixed in Firefox, so we shouldn't worry about that here. |
@valenting And you deliver this information on my birthday? You have a good timing sense, thanks. :D |
This pull request contains 2 features that are needed in the C-API for use in Gecko:
This introduces the
only_percent_decode_hostname_valid
feature.This change is