mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 851982 - Regression test. r=smontagu
This commit is contained in:
parent
cfd5ee2a8a
commit
8f749ee3ff
@ -13,7 +13,7 @@
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
SimpleTest.expectAssertions(0, 2);
|
||||
//SimpleTest.expectAssertions(0, 2);
|
||||
|
||||
setup({explicit_done: true});
|
||||
runTest();
|
||||
|
@ -43,6 +43,7 @@ function runTextDecoderOptions()
|
||||
testDecodeABVOption(data, expectedString);
|
||||
}, "testDecodeABVOption");
|
||||
test(testDecoderForThaiEncoding, "testDecoderForThaiEncoding");
|
||||
test(testInvalid2022JP, "testInvalid2022JP");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -401,3 +402,50 @@ function testCharset(test)
|
||||
}
|
||||
assert_true(!test.error, test.msg);
|
||||
}
|
||||
|
||||
function testInvalid2022JP()
|
||||
{
|
||||
var inputs = [
|
||||
[0x80],
|
||||
[0x1b, 0xFF],
|
||||
[0x1b, 0x28, 0xFF],
|
||||
[0x1b, 0x24, 0x80],
|
||||
[0x1b, 0x24, 0x28, 0x80],
|
||||
[0x1b, 0x28, 0x4a, 0xFF],
|
||||
[0x1b, 0x28, 0x49, 0xFF],
|
||||
[0x1b, 0x24, 0x40, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x20],
|
||||
[0x1b, 0x24, 0x40, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x41, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x42, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x40, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x21, 0x20],
|
||||
[0x1b, 0x2e, 0xFF],
|
||||
[0x1b, 0x4e, 0x20],
|
||||
[0x1b, 0x4e, 0x7F],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0x80],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0xFF],
|
||||
];
|
||||
|
||||
var failureCount = 0;
|
||||
inputs.forEach(function(input) {
|
||||
try {
|
||||
// decode() should never throw unless {fatal: true} is specified
|
||||
new TextDecoder("iso-2022-jp").decode(new Uint8Array(input));
|
||||
} catch (e) {
|
||||
if (e.name !== "EncodingError") {
|
||||
throw e;
|
||||
}
|
||||
failureCount++;
|
||||
}
|
||||
});
|
||||
assert_equals(failureCount, 0, failureCount + " of " + inputs.length + " tests failed");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user