Throw RangeErrors in TextEncoder/TextDecoder constructors.

Fixes #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.
This commit is contained in:
Aneesh Agrawal 2015-04-10 02:42:35 -04:00
parent f3aee90b06
commit 97301400a5
6 changed files with 37 additions and 130 deletions

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Encoding API: invalid label</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var invalidLabel = "invalid-invalidLabel"
test(function() {
assert_throws({name: 'RangeError'}, function() { new TextEncoder(invalidLabel); });
assert_throws({name: 'RangeError'}, function() { new TextDecoder(invalidLabel); });
}, 'Invalid label "' + invalidLabel + '" should be rejected by API.');
</script>