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 RangeError for TextEncoder/TextDecoder #5620
Comments
|
I'd like to give this a try. |
|
Go for it! |
Fix the TODOs and FIXMEs to comply with the spec. Fixes servo#5620.
|
A few questions about the tests.
I'll look into writing the not-even-an-encoding test cases once I get the current set to pass. |
|
@aneeshusa: Expected test result come from the ini files under tests/wpt/meta, like http://mxr.mozilla.org/servo/source/tests/wpt/metadata/encoding/api-replacement-encodings.html.ini . If you're seeing output like "PASS expected FAIL", that means that your changes are causing the checks to succeed, but the ini files currently record an expected failure instead. Does that clear it up? |
|
OK, thanks, that's a much better explanation than name-changing voodoo. I've gotten the rest of the tests to pass, what should I do about the gbk test (see my previous comment)? |
|
Also, is there an official way to only run certain wpt tests via mach? I've been using a hacky solution, but if there's a better way that would be much appreciated. |
|
|
|
You can also just run |
|
Also, as far as I can tell the rust-encoding crate is wrong about the whatwg name for utf-16le and utf-16, so I'll put in a PR upstream. |
|
Perfect, the --include option is what I was looking for. Thanks! |
|
Btw, my thoughts on gbk are that gbk should map to gbk instead of gbk18030, as per the spec, implying a fix would be needed upstream. |
|
Gbk looks like it needs an upstream fix, yeah. |
|
Just put in the PR for utf-16le. Working on one for gbk right now, and investigating a potential issue with hz-gb-2312. |
|
The utf-16le PR just got merged, and I also just put in a PR to fix GBK encoding. |
|
cc me |
|
I just tried to bump the components/script crate's version dependency on the encoding crate to 0.2.30, which includes the utf-16le changes so I could test if they worked. Unfortunately, something is limiting the version number to 0.2.25, and I haven't been able to figure out which crate is the cause; the error message isn't very informative and grep isn't helping either. Does anyone know which crate is the impediment? |
|
Also, I opened an issue for a deviation from the spec for hz-gb-2312; if the current implementation is kept it isn't too hard to work around in servo (just an extra pattern in a match statement), so I'm not too worried about which way that goes. |
|
I would suggest just fixing the |
Fixes servo#5620. Fix the TODOs and FIXMEs to comply with the spec. Add test case for passing invalid invalid labels. Update test metadata; three test cases have been resolved upstream and will be fixed whenever the rust-encoding dependency is sufficiently upgraded.
…textdecoder, r=jdm Fixes #5620, and adds a few extra test cases. Currently waiting on a few upstream PRs in rust-encoding to land. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5659) <!-- Reviewable:end -->
Blocks #5601.
components/script/dom/textdecoder.rs,components/script/dom/textencoder.rs,components/script/dom/bindings/error.rs./encoding/api-replacement-encodings.html,/encoding/textencoder-constructor-non-utf.html.To fix this bug, you'll first need to implement
RangeErrorexceptions. This should be analogous to theTypeErrorimplementation that already exists incomponents/script/dom/bindings/error.rs. I'd extendget_error_messageto accept one error number forTypeErrorand one forRangeError, and create a second static likeERROR_FORMAT_STRINGthat usesJSEXN_RANGEERR.Then you'll need to return
Err(Error::Range)in the places that currently have TODO/FIXME comments mentioning "RangeError".Bonus point for writing additional tests for the case where the encoding argument is not an encoding at all.