-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Encoding: ISO-2022-JP encoder "SO/SI ESC" test #26158
Conversation
The test dates from 2014; expected behaviour changed in 2016
Thank you for contributing this! It seems you may have uncovered several issues by writing this test, which I hope to sort through in whatwg/url#557 before taking action here. |
Always happy to cause trouble. ;) I'd just finished writing an ISO-2022-JP encoder and was using Firefox to validate my results (since the tests are not very portable). Imagine my surprise when I discovered Firefox was wrong despite passing every test. I didn't expect to open a whole can of worms, though. |
@JKingweb would you mind duplicating the test you modified and add a non-ASCII code point to the input and the expectations? That will show some more variety in browsers. (I'm also happy to push such a test if that's okay with you.) I'll (also) work on the changes to the URL Standard that are needed. |
@hsivonen I went ahead and pushed a bunch more tests. If these look okay to you I suggest we go ahead and land these and then I'll work on the specification patches next. |
This avoids the need for "prepend" in the "process" algorithm as is needed to fix #235. Additionally, this commit adds two clarifying asserts to the "process" algorithm documenting what error modes can be in effect when. Related tests: web-platform-tests/wpt#26158.
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.
LGTM. I verified that Gecko passes these with the pending Gecko patch.
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.) Depends on this Encoding PR: whatwg/encoding#238. Tests: web-platform-tests/wpt#26158. Fixes #557.
More bugs:
PRs: |
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. Fixes #557.
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. Fixes #557.
Refs: web-platform-tests/wpt#25988 Refs: web-platform-tests/wpt#26158 PR-URL: #35794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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.
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.
Refs: web-platform-tests/wpt#25988 Refs: web-platform-tests/wpt#26158 PR-URL: #35794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: web-platform-tests/wpt#25988 Refs: web-platform-tests/wpt#26158 PR-URL: #35794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: web-platform-tests/wpt#25988 Refs: web-platform-tests/wpt#26158 PR-URL: #35794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: web-platform-tests/wpt#25988 Refs: web-platform-tests/wpt#26158 PR-URL: #35794 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
The test dates from 2014; expected behaviour changed in 2016 with whatwg/encoding@f9540e5.