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

Refactor query state to operate on a buffer #558

Merged
merged 2 commits into from
Nov 2, 2020
Merged

Conversation

annevk
Copy link
Member

@annevk annevk commented Oct 20, 2020

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

This seems to pass all the tests when implemented in jsdom/whatwg-url. It's more complicated, but I assume it's for a good reason related to #557...

@annevk
Copy link
Member Author

annevk commented Oct 21, 2020

Thanks, it's incomplete still as the percent-encoding algorithm will also need changes. I do think using a buffer coupled with whatwg/encoding#235 (comment) gives us the "nicest" way of making this work, but happy to receive feedback otherwise. (The one weirdness is that we don't have a per-code-point percent-encode with arbitrary encoding anymore, but no caller really needs that. The UTF-8 caller can just pass its single code point as a string.)

@annevk
Copy link
Member Author

annevk commented Oct 21, 2020

The corresponding Encoding PR for the second commit in this PR hasn't landed yet and as such it'll fail Build, but it's still worth reviewing at this point I think, especially for non-editorial concerns.

@annevk
Copy link
Member Author

annevk commented Oct 23, 2020

I plan to rebase this Monday and make it pass Build now that whatwg/encoding#238 has landed.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

It looks like I can't really test this with jsdom/whatwg-url since we're still UTF-8 only. So my review of the second commit is just editorial.

Maybe I should sink some time into fixing that, but doing it properly would probably require a from-scratch implementation of the Encoding standard which exposes all of the spec-level primitives. Probably not something I can tackle any time soon...

url.bs Outdated Show resolved Hide resolved
url.bs Show resolved Hide resolved
@domenic
Copy link
Member

domenic commented Oct 23, 2020

Can we get web platform tests for this that are URL-specific? Probably not part of the JSON files though.

url.bs Outdated Show resolved Hide resolved
@annevk
Copy link
Member Author

annevk commented Oct 28, 2020

Thanks for the feedback! I put up some fairly basic tests over at web-platform-tests/wpt#26317 but they should be easy to expand upon if we all think that format is workable.

Since the ISO-2022-JP encoder is stateful, percent-encoding needs to hold onto an instance of the encoder and manually perform error handling. This also requires the input to be the full string rather than individual code points as otherwise the callers of percent-encoding would need to be aware of this too. (As UTF-8 encoding cannot fail this problem does not affect those endpoints.)

Builds on this Encoding PR: whatwg/encoding#238.

Tests: web-platform-tests/wpt#26158 and web-platform-tests/wpt#26317.

Fixes #557.
@annevk annevk merged commit 2ce4938 into master Nov 2, 2020
@annevk annevk deleted the annevk/iso-2022-jp branch November 2, 2020 09:47
domenic added a commit to jsdom/whatwg-url that referenced this pull request Nov 2, 2020
Follows whatwg/url#558.

This also updates the documentation to make it clear that we have no encoding handling, and removes the mention of encodingOverride (which was ignored by the code).
domenic added a commit to jsdom/whatwg-url that referenced this pull request Nov 2, 2020
Follows whatwg/url#558.

This also updates the documentation to make it clear that we have no encoding handling, and removes the mention of encodingOverride (which was ignored by the code).
andreubotella pushed a commit to andreubotella/html that referenced this pull request Nov 10, 2020
After whatwg/url#558, the form submission algorithm is the only place in
the web platform that uses "encode". However, although for
application/x-www-form-urlencoded and text/plain "encode" is clearly
linked, multipart/form-data instead describes an equivalent algorithm.
This change fixes that.
annevk pushed a commit to whatwg/html that referenced this pull request Nov 11, 2020
After whatwg/url#558, the form submission algorithm is the only place in the web platform that uses "encode". However, although for application/x-www-form-urlencoded and text/plain "encode" is clearly linked, multipart/form-data instead describes an equivalent algorithm. This change fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants