Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse BufferSource in TextDecoder API #20344
Comments
|
@highfive assign me |
|
Hey @christianpoveda! Thanks for your interest in working on this issue. It's now assigned to you! |
|
Just started working on it. I have a first working version here. Nevertheless a bunch of tests are failing. They are failing because
However reading the spec, Should I modify the tests? or should I keep using PD: when using |
|
We should update our implementation to match the specification: https://encoding.spec.whatwg.org/#interface-textdecoder |
|
Ohh sorry I was confused, I did not realized Also, the specification says |
|
Let's accept a TextDecodeOptions as the second argument but ignore the stream member for the purposes of this issue. We can file another issue to implement the steps in https://encoding.spec.whatwg.org/#dom-textdecoder-decode that it affects. |
|
Actually, we shouldn't need to add TextDecodeOptions for this issue at all. I'll file the issue for updating the implementation to match the spec. |
|
Ah, that's #13234. |
|
hehe, Ok i'll let the TextDecodeOptions in the webidl file but will not use it in the body of Decode. What about the exceptions? |
|
What do you mean by "the specification says Decode does not throw exceptions"? If you mean that the spec webIDL doesn't include [Throws], that's because that's an implementation-specific extension that we use. |
|
oh ok got it |
TextDecoder's Decode now receives a BufferSource as input <!-- Please describe your changes on the following line: --> r? jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #20344 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20413) <!-- Reviewable:end -->
TextDecoder's Decode now receives a BufferSource as input <!-- Please describe your changes on the following line: --> r? jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #20344 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20413) <!-- Reviewable:end -->
Now that #20267 has merged, we can uncomment the
decodemethod in TextDecoder.webidl that accepts BufferSource and remove the one that fakes it by accepting anoptionvalue. This will require similar cleanup as #20342.Code:
components/script/dom/webidls/TextDecoder.webidl,components/script/dom/textdecoder.rsTests:
./mach test-wpt tests/wpt/web-platform-tests/encoding/textdecoder*