summaryrefslogtreecommitdiffstats
path: root/intl/uconv/tests
diff options
context:
space:
mode:
Diffstat (limited to 'intl/uconv/tests')
-rw-r--r--intl/uconv/tests/gtest/TestShortRead.cpp109
-rw-r--r--intl/uconv/tests/gtest/moz.build11
-rw-r--r--intl/uconv/tests/mochitest.ini14
-rw-r--r--intl/uconv/tests/moz.build13
-rw-r--r--intl/uconv/tests/stressgb.pl23
-rw-r--r--intl/uconv/tests/test_big5_encoder.html43
-rw-r--r--intl/uconv/tests/test_bug335816.html40
-rw-r--r--intl/uconv/tests/test_bug843434.html27
-rw-r--r--intl/uconv/tests/test_bug959058-1.html28
-rw-r--r--intl/uconv/tests/test_bug959058-2.html28
-rw-r--r--intl/uconv/tests/test_ncr_fallback.html74
-rw-r--r--intl/uconv/tests/test_singlebyte_overconsumption.html33
-rw-r--r--intl/uconv/tests/test_unicode_noncharacterescapes.html303
-rw-r--r--intl/uconv/tests/test_unicode_noncharacters_gb18030.html305
-rw-r--r--intl/uconv/tests/test_unicode_noncharacters_utf8.html303
-rw-r--r--intl/uconv/tests/test_utf8_overconsumption.html39
16 files changed, 1393 insertions, 0 deletions
diff --git a/intl/uconv/tests/gtest/TestShortRead.cpp b/intl/uconv/tests/gtest/TestShortRead.cpp
new file mode 100644
index 0000000000..393f5e0027
--- /dev/null
+++ b/intl/uconv/tests/gtest/TestShortRead.cpp
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "gtest/gtest.h"
+#include "mozilla/ErrorNames.h"
+#include "nsCOMPtr.h"
+#include "nsConverterInputStream.h"
+#include "nsIInputStream.h"
+#include "nsISupports.h"
+#include "nsStringStream.h"
+
+namespace {
+
+class ShortReadWrapper final : public nsIInputStream {
+ public:
+ NS_DECL_THREADSAFE_ISUPPORTS
+ NS_DECL_NSIINPUTSTREAM
+
+ template <size_t N>
+ ShortReadWrapper(const uint32_t (&aShortReads)[N],
+ nsIInputStream* aBaseStream)
+ : mShortReadIter(std::begin(aShortReads)),
+ mShortReadEnd(std::end(aShortReads)),
+ mBaseStream(aBaseStream) {}
+
+ ShortReadWrapper(const ShortReadWrapper&) = delete;
+ ShortReadWrapper& operator=(const ShortReadWrapper&) = delete;
+
+ private:
+ ~ShortReadWrapper() = default;
+
+ const uint32_t* mShortReadIter;
+ const uint32_t* mShortReadEnd;
+ nsCOMPtr<nsIInputStream> mBaseStream;
+};
+
+NS_IMPL_ISUPPORTS(ShortReadWrapper, nsIInputStream)
+
+NS_IMETHODIMP
+ShortReadWrapper::Close() { return mBaseStream->Close(); }
+
+NS_IMETHODIMP
+ShortReadWrapper::Available(uint64_t* aAvailable) {
+ nsresult rv = mBaseStream->Available(aAvailable);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (mShortReadIter != mShortReadEnd) {
+ *aAvailable = std::min(uint64_t(*mShortReadIter), *aAvailable);
+ }
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+ShortReadWrapper::StreamStatus() { return mBaseStream->StreamStatus(); }
+
+NS_IMETHODIMP
+ShortReadWrapper::Read(char* aBuf, uint32_t aCount, uint32_t* _retval) {
+ if (mShortReadIter != mShortReadEnd) {
+ aCount = std::min(*mShortReadIter, aCount);
+ }
+
+ nsresult rv = mBaseStream->Read(aBuf, aCount, _retval);
+ if (NS_SUCCEEDED(rv) && mShortReadIter != mShortReadEnd) {
+ ++mShortReadIter;
+ }
+ return rv;
+}
+
+NS_IMETHODIMP
+ShortReadWrapper::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
+ uint32_t aCount, uint32_t* _retval) {
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+ShortReadWrapper::IsNonBlocking(bool* _retval) {
+ return mBaseStream->IsNonBlocking(_retval);
+}
+
+} // namespace
+
+TEST(ConverterStreamShortRead, ShortRead)
+{
+ uint8_t bytes[] = {0xd8, 0x35, 0xdc, 0x20};
+ nsCOMPtr<nsIInputStream> baseStream;
+ ASSERT_TRUE(NS_SUCCEEDED(NS_NewByteInputStream(getter_AddRefs(baseStream),
+ AsChars(mozilla::Span(bytes)),
+ NS_ASSIGNMENT_COPY)));
+
+ static const uint32_t kShortReads[] = {1, 2, 1};
+ nsCOMPtr<nsIInputStream> shortStream =
+ new ShortReadWrapper(kShortReads, baseStream);
+
+ RefPtr<nsConverterInputStream> unicharStream = new nsConverterInputStream();
+ ASSERT_TRUE(NS_SUCCEEDED(
+ unicharStream->Init(shortStream, "UTF-16BE", 4096,
+ nsIConverterInputStream::ERRORS_ARE_FATAL)));
+
+ uint32_t read;
+ nsAutoString result;
+ ASSERT_TRUE(
+ NS_SUCCEEDED(unicharStream->ReadString(UINT32_MAX, result, &read)));
+
+ ASSERT_EQ(read, 2u);
+ ASSERT_TRUE(result == u"\U0001d420");
+}
diff --git a/intl/uconv/tests/gtest/moz.build b/intl/uconv/tests/gtest/moz.build
new file mode 100644
index 0000000000..969fb52c7e
--- /dev/null
+++ b/intl/uconv/tests/gtest/moz.build
@@ -0,0 +1,11 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+UNIFIED_SOURCES += [
+ "TestShortRead.cpp",
+]
+
+FINAL_LIBRARY = "xul-gtest"
diff --git a/intl/uconv/tests/mochitest.ini b/intl/uconv/tests/mochitest.ini
new file mode 100644
index 0000000000..0f13e77971
--- /dev/null
+++ b/intl/uconv/tests/mochitest.ini
@@ -0,0 +1,14 @@
+[DEFAULT]
+
+[test_bug335816.html]
+[test_bug843434.html]
+[test_bug959058-1.html]
+[test_bug959058-2.html]
+[test_long_doc.html]
+[test_singlebyte_overconsumption.html]
+[test_unicode_noncharacterescapes.html]
+[test_unicode_noncharacters_gb18030.html]
+[test_unicode_noncharacters_utf8.html]
+[test_utf8_overconsumption.html]
+[test_big5_encoder.html]
+[test_ncr_fallback.html]
diff --git a/intl/uconv/tests/moz.build b/intl/uconv/tests/moz.build
new file mode 100644
index 0000000000..888186fb26
--- /dev/null
+++ b/intl/uconv/tests/moz.build
@@ -0,0 +1,13 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+TEST_DIRS += [
+ "gtest",
+]
+
+XPCSHELL_TESTS_MANIFESTS += ["unit/xpcshell.ini"]
+
+MOCHITEST_MANIFESTS += ["mochitest.ini"]
diff --git a/intl/uconv/tests/stressgb.pl b/intl/uconv/tests/stressgb.pl
new file mode 100644
index 0000000000..5b37fb63fb
--- /dev/null
+++ b/intl/uconv/tests/stressgb.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+use LWP::Simple;
+use IO::Handle;
+$stdout = *STDOUT;
+open(RES , ">resultlog.txt") || die "cannot open result log file";
+#system("rm alldiff.txt in*.txt out*.txt");
+for($i=10;$i<909;$i++)
+{
+ RES->printf("Test Page %d \n", $i);
+ $url = "http://people.netscape.com/ftang/testscript/gb18030/gbtext.cgi?page=" . $i;
+ RES->printf( "URL = %s\n", $url);
+ $tmpfile = "> in". $i . ".txt";
+ open STDOUT, $tmpfile || RES->print("cannot open " . $tmpfile . "\n");
+ getprint $url;
+ $cmd2 = "../../../dist/win32_d.obj/bin/nsconv -f GB18030 -t GB18030 in" . $i . ".txt out" . $i . ".txt >err";
+ $cmd3 = "diff -u in" . $i . ".txt out" . $i . ".txt >> alldiff.txt";
+ RES->printf( "Run '%s'\n", $cmd2);
+ $st2 = system($cmd2);
+ RES->printf( "result = '%d'\n", $st2);
+ RES->printf( "Run '%s'\n", $cmd3);
+ $st3 = system($cmd3);
+ RES->printf( "result = '%d'\n", $st3);
+}
diff --git a/intl/uconv/tests/test_big5_encoder.html b/intl/uconv/tests/test_big5_encoder.html
new file mode 100644
index 0000000000..7e86683f00
--- /dev/null
+++ b/intl/uconv/tests/test_big5_encoder.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=912470
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Unicode non-characters</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/* NOTE:
+ * When we make our data: URL origin work as in Blink, this test will fail.
+ * Hopefully, by that time are URL parser has become spec-compliant, so that
+ * we'll pass the Web Platform Test for the big5 encoder
+ * (testing/web-platform/tests/encoding/big5-encoder.html) and this test can
+ * simply be removed.
+ */
+SimpleTest.waitForExplicitFinish();
+
+function test() {
+ var f = document.getElementsByTagName("iframe")[0];
+ f.onload = function() {
+ var href = SpecialPowers.wrap(f).contentWindow.location.href;
+ var index = href.indexOf("?foo=");
+ var actual = href.substring(index + 5);
+ var expected = "h%26%2340614%3Bi%26%23156267%3Bj%A1%40k%A3%E1l%A4%40m%C8%A4n%C8%CDo%FE%FEp%26%238365%3Bq%FDjr%F9%F9s%26%23128169%3Bt";
+ is(actual, expected, "Should have gotten the expected encode.");
+ SimpleTest.finish();
+ }
+ SpecialPowers.wrap(f).contentDocument.forms[0].submit();
+}
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=912470">Mozilla Bug 912470</a>
+<p id="display"></p>
+<div id="content" style="display: none"><iframe src="data:text/html;charset=big5,<form><input name=foo value=h&amp;%23x9EA6;i&amp;%23x2626B;j&amp;%23x3000;k&amp;%23x20AC;l&amp;%23x4E00;m&amp;%23x27607;n&amp;%23xFFE2;o&amp;%23x79D4;p&amp;%23x20AD;q&amp;%23x203B5;r&amp;%23x2550;s&amp;%23x1F4A9;t></form>">
+</div>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_bug335816.html b/intl/uconv/tests/test_bug335816.html
new file mode 100644
index 0000000000..58fe538b5d
--- /dev/null
+++ b/intl/uconv/tests/test_bug335816.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=335816
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Bug 335816</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 335816 **/
+function test()
+{
+ ok($("display").innerHTML != "Keep that breathless charm", "Hidden script not executed");
+ SimpleTest.finish();
+}
+
+function WontYouPleaseArrangeIt()
+{
+ $("display").innerHTML = "Keep that breathless charm";
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=335816">Mozilla Bug 335816</a>
+<p id="display">Lovely ... Never, ever change.</p>
+
+<!-- There is a UTF-8 BOM just here - - -
+ | which should not be stripped
+ v -->
+<div id="content" style="display: none"><锘縮cript>WontYouPleaseArrangeIt();</script></div>
+</body>
+</html>
+
diff --git a/intl/uconv/tests/test_bug843434.html b/intl/uconv/tests/test_bug843434.html
new file mode 100644
index 0000000000..d79ad70e6a
--- /dev/null
+++ b/intl/uconv/tests/test_bug843434.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=843434
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Bug 843434</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <!-- This next 'link' is part of the test, it may cause an assertion. -->
+ <link rel=stylesheet href="data:text/css;charset=ISO-2022-JP,%cc">
+</head>
+<body onload="test()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+function test()
+{
+ ok(true, "Test for no prior assertion.");
+ SimpleTest.finish();
+}
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/intl/uconv/tests/test_bug959058-1.html b/intl/uconv/tests/test_bug959058-1.html
new file mode 100644
index 0000000000..85d45a8841
--- /dev/null
+++ b/intl/uconv/tests/test_bug959058-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=959058
+-->
+<head>
+ <meta charset="gbk">
+ <title>Test for Bug 959058</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 959058 **/
+
+ is("🍔", "\uD83C\uDF54", "Should have gotten a hamburger.");
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=959058">Mozilla Bug 959058</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_bug959058-2.html b/intl/uconv/tests/test_bug959058-2.html
new file mode 100644
index 0000000000..86bf500e1b
--- /dev/null
+++ b/intl/uconv/tests/test_bug959058-2.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=959058
+-->
+<head>
+ <meta charset="gbk">
+ <title>Test for Bug 959058</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 959058 **/
+
+ is("", "\u20AC", "Should have gotten euro.");
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=959058">Mozilla Bug 959058</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_ncr_fallback.html b/intl/uconv/tests/test_ncr_fallback.html
new file mode 100644
index 0000000000..846f18be8f
--- /dev/null
+++ b/intl/uconv/tests/test_ncr_fallback.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1202366
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for unpaired surrogates</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="step()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/* NOTE:
+ * When we make our data: URL origin work as in Blink, this test will fail.
+ * Don't let this test block alignment of data: URL origin with Blink.
+ */
+SimpleTest.waitForExplicitFinish();
+
+var expectations = [
+ "%26%2365533%3B",
+ "a%26%2365533%3B",
+ "%26%2365533%3Ba",
+ "a%26%2365533%3Ba",
+ "%26%2365533%3B",
+ "a%26%2365533%3B",
+ "%26%2365533%3Ba",
+ "a%26%2365533%3Ba",
+ "%26%23128169%3B",
+ "%26%23128169%3B",
+ "%1B%24B%22%29%1B%28B",
+ "%1B%24B%22%29%1B%28B%26%23128169%3B",
+];
+
+var i = 0;
+
+function step() {
+ var f = document.getElementsByTagName("iframe")[i];
+ f.onload = function() {
+ var href = SpecialPowers.wrap(f).contentWindow.location.href;
+ var index = href.indexOf("?foo=");
+ var actual = href.substring(index + 5);
+ var expected = expectations[i];
+ is(actual, expected, "Should have gotten the expected encode.");
+ i++
+ if (i == document.getElementsByTagName("iframe").length) {
+ SimpleTest.finish();
+ } else {
+ step();
+ }
+ }
+ SpecialPowers.wrap(f).contentDocument.forms[0].submit();
+}
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1202366">Mozilla Bug 1202366</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=\uD83D></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=a\uD83D></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=\uD83Da></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=a\uD83Da></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=\uDCA9></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=a\uDCA9></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=\uDCA9a></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=a\uDCA9a></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=big5,<script>document.write('<form><input name=foo value=\uD83D\uDCA9></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=iso-2022-jp,<script>document.write('<form><input name=foo value=\uD83D\uDCA9></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=iso-2022-jp,<script>document.write('<form><input name=foo value=\u3012></form>');</script>"></iframe>
+<iframe src="data:text/html;charset=iso-2022-jp,<script>document.write('<form><input name=foo value=\u3012\uD83D\uDCA9></form>');</script>"></iframe>
+</div>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_singlebyte_overconsumption.html b/intl/uconv/tests/test_singlebyte_overconsumption.html
new file mode 100644
index 0000000000..3aeeb928ec
--- /dev/null
+++ b/intl/uconv/tests/test_singlebyte_overconsumption.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=564679
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=windows-1253">
+ <title>Test for undefined codepoints</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="test()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** test that single byte decoding resynchronizes after undefined codepoints */
+function test()
+{
+ is($("display").innerHTML, "All good.", "No overconsumption");
+ SimpleTest.finish();
+}
+
+ SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=564679">Mozilla Bug 564679</a>
+<p id="display">Evil.</p>
+<div id="content" style="display: none"></div>
+ <script type="text/javascript">
+ $("display").innerHTML = "All good.";
+ </script> ->
+</body>
+</html>
diff --git a/intl/uconv/tests/test_unicode_noncharacterescapes.html b/intl/uconv/tests/test_unicode_noncharacterescapes.html
new file mode 100644
index 0000000000..e44f8d782b
--- /dev/null
+++ b/intl/uconv/tests/test_unicode_noncharacterescapes.html
@@ -0,0 +1,303 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=445886
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Unicode non-characters</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="Inject()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/* eslint-disable no-eval */
+
+/** Test that unicode non-characters are not discarded **/
+function test()
+{
+ is($("display").innerHTML,"All good.", "Noncharacters not stripped");
+ SimpleTest.finish();
+}
+
+// eslint-disable-next-line complexity
+function Inject()
+{
+ // script fragments containing Unicode non-characters
+ try {
+ // U+FDD0
+ eval("$(\"display\").inner\ufdd0HTML += \" U+FDD0 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD1
+ eval("$(\"display\").inner\ufdd1HTML += \" U+FDD1 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD2
+ eval("$(\"display\").inner\ufdd2HTML += \" U+FDD2 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD3
+ eval("$(\"display\").inner\ufdd3HTML += \" U+FDD3 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD4
+ eval("$(\"display\").inner\ufdd4HTML += \" U+FDD4 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD5
+ eval("$(\"display\").inner\ufdd5HTML += \" U+FDD5 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD6
+ eval("$(\"display\").inner\ufdd6HTML += \" U+FDD6 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD7
+ eval("$(\"display\").inner\ufdd7HTML += \" U+FDD7 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD8
+ eval("$(\"display\").inner\ufdd8HTML += \" U+FDD8 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDD9
+ eval("$(\"display\").inner\ufdd9HTML += \" U+FDD9 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDA
+ eval("$(\"display\").inner\ufddaHTML += \" U+FDDA is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDB
+ eval("$(\"display\").inner\ufddbHTML += \" U+FDDB is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDC
+ eval("$(\"display\").inner\ufddcHTML += \" U+FDDC is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDD
+ eval("$(\"display\").inner\ufdddHTML += \" U+FDDD is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDE
+ eval("$(\"display\").inner\ufddeHTML += \" U+FDDE is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDDF
+ eval("$(\"display\").inner\ufddfHTML += \" U+FDDF is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE0
+ eval("$(\"display\").inner\ufde0HTML += \" U+FDE0 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE1
+ eval("$(\"display\").inner\ufde1HTML += \" U+FDE1 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE2
+ eval("$(\"display\").inner\ufde2HTML += \" U+FDE2 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE3
+ eval("$(\"display\").inner\ufde3HTML += \" U+FDE3 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE4
+ eval("$(\"display\").inner\ufde4HTML += \" U+FDE4 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE5
+ eval("$(\"display\").inner\ufde5HTML += \" U+FDE5 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE6
+ eval("$(\"display\").inner\ufde6HTML += \" U+FDE6 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE7
+ eval("$(\"display\").inner\ufde7HTML += \" U+FDE7 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE8
+ eval("$(\"display\").inner\ufde8HTML += \" U+FDE8 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDE9
+ eval("$(\"display\").inner\ufde9HTML += \" U+FDE9 is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDEA
+ eval("$(\"display\").inner\ufdeaHTML += \" U+FDEA is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDEB
+ eval("$(\"display\").inner\ufdebHTML += \" U+FDEB is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDEC
+ eval("$(\"display\").inner\ufdecHTML += \" U+FDEC is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDED
+ eval("$(\"display\").inner\ufdedHTML += \" U+FDED is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDEE
+ eval("$(\"display\").inner\ufdeeHTML += \" U+FDEE is evil\"");
+ } catch(e) {}
+ try {
+ // U+FDEF
+ eval("$(\"display\").inner\ufdefHTML += \" U+FDEF is evil\"");
+ } catch(e) {}
+ try {
+ // U+FFFE
+ eval("$(\"display\").inner\ufffeHTML += \" U+FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+FFFF
+ eval("$(\"display\").inner\uffffHTML += \" U+FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+1FFFE
+ eval("$(\"display\").inner\ud83f\udffeHTML += \" U+1FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+1FFFF
+ eval("$(\"display\").inner\ud83f\udfffHTML += \" U+1FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+2FFFE
+ eval("$(\"display\").inner\ud87f\udffeHTML += \" U+2FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+2FFFF
+ eval("$(\"display\").inner\ud87f\udfffHTML += \" U+2FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+3FFFE
+ eval("$(\"display\").inner\ud8bf\udffeHTML += \" U+3FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+3FFFF
+ eval("$(\"display\").inner\ud8bf\udfffHTML += \" U+3FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+4FFFE
+ eval("$(\"display\").inner\ud8ff\udffeHTML += \" U+4FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+4FFFF
+ eval("$(\"display\").inner\ud8ff\udfffHTML += \" U+4FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+5FFFE
+ eval("$(\"display\").inner\ud93f\udffeHTML += \" U+5FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+5FFFF
+ eval("$(\"display\").inner\ud93f\udfffHTML += \" U+5FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+6FFFE
+ eval("$(\"display\").inner\ud97f\udffeHTML += \" U+6FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+6FFFF
+ eval("$(\"display\").inner\ud97f\udfffHTML += \" U+6FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+7FFFE
+ eval("$(\"display\").inner\ud9bf\udffeHTML += \" U+7FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+7FFFF
+ eval("$(\"display\").inner\ud9bf\udfffHTML += \" U+7FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+8FFFE
+ eval("$(\"display\").inner\ud9ff\udffeHTML += \" U+8FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+8FFFF
+ eval("$(\"display\").inner\ud9ff\udfffHTML += \" U+8FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+9FFFE
+ eval("$(\"display\").inner\uda3f\udffeHTML += \" U+9FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+9FFFF
+ eval("$(\"display\").inner\uda3f\udfffHTML += \" U+9FFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+AFFFE
+ eval("$(\"display\").inner\uda7f\udffeHTML += \" U+AFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+AFFFF
+ eval("$(\"display\").inner\uda7f\udfffHTML += \" U+AFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+BFFFE
+ eval("$(\"display\").inner\udabf\udffeHTML += \" U+BFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+BFFFF
+ eval("$(\"display\").inner\udabf\udfffHTML += \" U+BFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+CFFFE
+ eval("$(\"display\").inner\udaff\udffeHTML += \" U+CFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+CFFFF
+ eval("$(\"display\").inner\udaff\udfffHTML += \" U+CFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+DFFFE
+ eval("$(\"display\").inner\udb3f\udffeHTML += \" U+DFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+DFFFF
+ eval("$(\"display\").inner\udb3f\udfffHTML += \" U+DFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+EFFFE
+ eval("$(\"display\").inner\udb7f\udffeHTML += \" U+EFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+EFFFF
+ eval("$(\"display\").inner\udb7f\udfffHTML += \" U+EFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+FFFFE
+ eval("$(\"display\").inner\udbbf\udffeHTML += \" U+FFFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+FFFFF
+ eval("$(\"display\").inner\udbbf\udfffHTML += \" U+FFFFF is evil\"");
+ } catch(e) {}
+ try {
+ // U+10FFFE
+ eval("$(\"display\").inner\udbff\udffeHTML += \" U+10FFFE is evil\"");
+ } catch(e) {}
+ try {
+ // U+10FFFF
+ eval("$(\"display\").inner\udbff\udfffHTML += \" U+10FFFF is evil\"");
+ } catch(e) {}
+ test();
+}
+
+ SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug 445886</a>
+<p id="display">All good.</p>
+<div id="content" style="display: none"></div>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_unicode_noncharacters_gb18030.html b/intl/uconv/tests/test_unicode_noncharacters_gb18030.html
new file mode 100644
index 0000000000..0c9156d9e3
--- /dev/null
+++ b/intl/uconv/tests/test_unicode_noncharacters_gb18030.html
@@ -0,0 +1,305 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=445886
+-->
+ <meta http-equiv="Content-type" content="text/html; charset=gb18030">
+ <title>Test for Unicode non-characters</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css"
+ href="/tests/SimpleTest/test.css">
+</head>
+<body onload="Inject()">
+<pre id="test"><script class="testbody" type="text/javascript">
+
+/* eslint-disable no-eval */
+
+/** Test that unicode non-characters are not discarded **/
+function test()
+{
+ is($("display").innerHTML, "All good.", "Noncharacters not stripped");
+ SimpleTest.finish();
+}
+
+// eslint-disable-next-line complexity
+function Inject()
+{
+ // script fragments containing Unicode non-characters
+ try {
+ // U+FDD0
+ eval("$(\"display\").inner锟0锟2HTML += \" U+FDD0 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD1
+ eval("$(\"display\").inner锟0锟3HTML += \" U+FDD1 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD2
+ eval("$(\"display\").inner锟0锟4HTML += \" U+FDD2 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD3
+ eval("$(\"display\").inner锟0锟5HTML += \" U+FDD3 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD4
+ eval("$(\"display\").inner锟0锟6HTML += \" U+FDD4 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD5
+ eval("$(\"display\").inner锟0锟7HTML += \" U+FDD5 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD6
+ eval("$(\"display\").inner锟0锟8HTML += \" U+FDD6 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD7
+ eval("$(\"display\").inner锟0锟9HTML += \" U+FDD7 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD8
+ eval("$(\"display\").inner锟0锟0HTML += \" U+FDD8 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD9
+ eval("$(\"display\").inner锟0锟1HTML += \" U+FDD9 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDA
+ eval("$(\"display\").inner锟0锟2HTML += \" U+FDDA is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDB
+ eval("$(\"display\").inner锟0锟3HTML += \" U+FDDB is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDC
+ eval("$(\"display\").inner锟0锟4HTML += \" U+FDDC is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDD
+ eval("$(\"display\").inner锟0锟5HTML += \" U+FDDD is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDE
+ eval("$(\"display\").inner锟0锟6HTML += \" U+FDDE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDF
+ eval("$(\"display\").inner锟0锟7HTML += \" U+FDDF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE0
+ eval("$(\"display\").inner锟0锟8HTML += \" U+FDE0 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE1
+ eval("$(\"display\").inner锟0锟9HTML += \" U+FDE1 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE2
+ eval("$(\"display\").inner锟0锟0HTML += \" U+FDE2 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE3
+ eval("$(\"display\").inner锟0锟1HTML += \" U+FDE3 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE4
+ eval("$(\"display\").inner锟0锟2HTML += \" U+FDE4 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE5
+ eval("$(\"display\").inner锟0锟3HTML += \" U+FDE5 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE6
+ eval("$(\"display\").inner锟0锟4HTML += \" U+FDE6 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE7
+ eval("$(\"display\").inner锟0锟5HTML += \" U+FDE7 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE8
+ eval("$(\"display\").inner锟0锟6HTML += \" U+FDE8 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE9
+ eval("$(\"display\").inner锟0锟7HTML += \" U+FDE9 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEA
+ eval("$(\"display\").inner锟0锟8HTML += \" U+FDEA is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEB
+ eval("$(\"display\").inner锟0锟9HTML += \" U+FDEB is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEC
+ eval("$(\"display\").inner锟0锟0HTML += \" U+FDEC is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDED
+ eval("$(\"display\").inner锟0锟1HTML += \" U+FDED is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEE
+ eval("$(\"display\").inner锟0锟2HTML += \" U+FDEE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEF
+ eval("$(\"display\").inner锟0锟3HTML += \" U+FDEF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFE
+ eval("$(\"display\").inner锟1锟8HTML += \" U+FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFF
+ eval("$(\"display\").inner锟1锟9HTML += \" U+FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+1FFFE
+ eval("$(\"display\").inner锟2锟4HTML += \" U+1FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+1FFFF
+ eval("$(\"display\").inner锟2锟5HTML += \" U+1FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+2FFFE
+ eval("$(\"display\").inner锟4锟0HTML += \" U+2FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+2FFFF
+ eval("$(\"display\").inner锟4锟1HTML += \" U+2FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+3FFFE
+ eval("$(\"display\").inner锟6锟6HTML += \" U+3FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+3FFFF
+ eval("$(\"display\").inner锟6锟7HTML += \" U+3FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+4FFFE
+ eval("$(\"display\").inner锟8锟2HTML += \" U+4FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+4FFFF
+ eval("$(\"display\").inner锟8锟3HTML += \" U+4FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+5FFFE
+ eval("$(\"display\").inner锟0锟8HTML += \" U+5FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+5FFFF
+ eval("$(\"display\").inner锟0锟9HTML += \" U+5FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+6FFFE
+ eval("$(\"display\").inner锟2锟4HTML += \" U+6FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+6FFFF
+ eval("$(\"display\").inner锟2锟5HTML += \" U+6FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+7FFFE
+ eval("$(\"display\").inner锟4锟0HTML += \" U+7FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+7FFFF
+ eval("$(\"display\").inner锟4锟1HTML += \" U+7FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+8FFFE
+ eval("$(\"display\").inner锟6锟6HTML += \" U+8FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+8FFFF
+ eval("$(\"display\").inner锟6锟7HTML += \" U+8FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+9FFFE
+ eval("$(\"display\").inner锟8锟2HTML += \" U+9FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+9FFFF
+ eval("$(\"display\").inner锟8锟3HTML += \" U+9FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+AFFFE
+ eval("$(\"display\").inner锟0锟8HTML += \" U+AFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+AFFFF
+ eval("$(\"display\").inner锟0锟9HTML += \" U+AFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+BFFFE
+ eval("$(\"display\").inner锟2锟4HTML += \" U+BFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+BFFFF
+ eval("$(\"display\").inner锟2锟5HTML += \" U+BFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+CFFFE
+ eval("$(\"display\").inner锟4锟0HTML += \" U+CFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+CFFFF
+ eval("$(\"display\").inner锟4锟1HTML += \" U+CFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+DFFFE
+ eval("$(\"display\").inner锟6锟6HTML += \" U+DFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+DFFFF
+ eval("$(\"display\").inner锟6锟7HTML += \" U+DFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+EFFFE
+ eval("$(\"display\").inner锟8锟2HTML += \" U+EFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+EFFFF
+ eval("$(\"display\").inner锟8锟3HTML += \" U+EFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFFE
+ eval("$(\"display\").inner锟0锟8HTML += \" U+FFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFFF
+ eval("$(\"display\").inner锟0锟9HTML += \" U+FFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+10FFFE
+ eval("$(\"display\").inner锟2锟4HTML += \" U+10FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+10FFFF
+ eval("$(\"display\").inner锟2锟5HTML += \" U+10FFFF is evil \"");
+ } catch(e) {}
+ test();
+}
+
+ SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug
+445886</a>
+<p id="display">All good.</p>
+<div id="content" style="display: none;"></div>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_unicode_noncharacters_utf8.html b/intl/uconv/tests/test_unicode_noncharacters_utf8.html
new file mode 100644
index 0000000000..ecfdbeae09
--- /dev/null
+++ b/intl/uconv/tests/test_unicode_noncharacters_utf8.html
@@ -0,0 +1,303 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=445886
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Unicode non-characters</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="Inject()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/* eslint-disable no-eval */
+
+/** Test that unicode non-characters are not discarded **/
+function test()
+{
+ is($("display").innerHTML, "All good.", "Noncharacters not stripped");
+ SimpleTest.finish();
+}
+
+// eslint-disable-next-line complexity
+function Inject()
+{
+ // script fragments containing Unicode non-characters
+ try {
+ // U+FDD0
+ eval("$(\"display\").inner锓怘TML += \" U+FDD0 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD1
+ eval("$(\"display\").inner锓慔TML += \" U+FDD1 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD2
+ eval("$(\"display\").inner锓扝TML += \" U+FDD2 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD3
+ eval("$(\"display\").inner锓揌TML += \" U+FDD3 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD4
+ eval("$(\"display\").inner锓擧TML += \" U+FDD4 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD5
+ eval("$(\"display\").inner锓旽TML += \" U+FDD5 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD6
+ eval("$(\"display\").inner锓朒TML += \" U+FDD6 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD7
+ eval("$(\"display\").inner锓桯TML += \" U+FDD7 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD8
+ eval("$(\"display\").inner锓楬TML += \" U+FDD8 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDD9
+ eval("$(\"display\").inner锓橦TML += \" U+FDD9 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDA
+ eval("$(\"display\").inner锓欻TML += \" U+FDDA is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDB
+ eval("$(\"display\").inner锓汬TML += \" U+FDDB is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDC
+ eval("$(\"display\").inner锓淗TML += \" U+FDDC is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDD
+ eval("$(\"display\").inner锓滺TML += \" U+FDDD is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDE
+ eval("$(\"display\").inner锓濰TML += \" U+FDDE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDDF
+ eval("$(\"display\").inner锓烪TML += \" U+FDDF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE0
+ eval("$(\"display\").inner锓燞TML += \" U+FDE0 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE1
+ eval("$(\"display\").inner锓TML += \" U+FDE1 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE2
+ eval("$(\"display\").inner锓TML += \" U+FDE2 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE3
+ eval("$(\"display\").inner锓TML += \" U+FDE3 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE4
+ eval("$(\"display\").inner锓TML += \" U+FDE4 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE5
+ eval("$(\"display\").inner锓TML += \" U+FDE5 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE6
+ eval("$(\"display\").inner锓TML += \" U+FDE6 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE7
+ eval("$(\"display\").inner锓TML += \" U+FDE7 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE8
+ eval("$(\"display\").inner锓℉TML += \" U+FDE8 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDE9
+ eval("$(\"display\").inner锓〩TML += \" U+FDE9 is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEA
+ eval("$(\"display\").inner锓狧TML += \" U+FDEA is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEB
+ eval("$(\"display\").inner锓獺TML += \" U+FDEB is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEC
+ eval("$(\"display\").inner锓琀TML += \" U+FDEC is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDED
+ eval("$(\"display\").inner锓璈TML += \" U+FDED is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEE
+ eval("$(\"display\").inner锓瓾TML += \" U+FDEE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FDEF
+ eval("$(\"display\").inner锓疕TML += \" U+FDEF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFE
+ eval("$(\"display\").inner锟綡TML += \" U+FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFF
+ eval("$(\"display\").inner锟縃TML += \" U+FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+1FFFE
+ eval("$(\"display\").inner馃烤HTML += \" U+1FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+1FFFF
+ eval("$(\"display\").inner馃靠HTML += \" U+1FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+2FFFE
+ eval("$(\"display\").inner鸠烤HTML += \" U+2FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+2FFFF
+ eval("$(\"display\").inner鸠靠HTML += \" U+2FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+3FFFE
+ eval("$(\"display\").inner鹂烤HTML += \" U+3FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+3FFFF
+ eval("$(\"display\").inner鹂靠HTML += \" U+3FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+4FFFE
+ eval("$(\"display\").inner駨烤HTML += \" U+4FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+4FFFF
+ eval("$(\"display\").inner駨靠HTML += \" U+4FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+5FFFE
+ eval("$(\"display\").inner駸烤HTML += \" U+5FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+5FFFF
+ eval("$(\"display\").inner駸靠HTML += \" U+5FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+6FFFE
+ eval("$(\"display\").inner癔烤HTML += \" U+6FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+6FFFF
+ eval("$(\"display\").inner癔靠HTML += \" U+6FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+7FFFE
+ eval("$(\"display\").inner窨烤HTML += \" U+7FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+7FFFF
+ eval("$(\"display\").inner窨靠HTML += \" U+7FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+8FFFE
+ eval("$(\"display\").inner驈烤HTML += \" U+8FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+8FFFF
+ eval("$(\"display\").inner驈靠HTML += \" U+8FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+9FFFE
+ eval("$(\"display\").inner驘烤HTML += \" U+9FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+9FFFF
+ eval("$(\"display\").inner驘靠HTML += \" U+9FFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+AFFFE
+ eval("$(\"display\").inner虔烤HTML += \" U+AFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+AFFFF
+ eval("$(\"display\").inner虔靠HTML += \" U+AFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+BFFFE
+ eval("$(\"display\").inner蚩烤HTML += \" U+BFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+BFFFF
+ eval("$(\"display\").inner蚩靠HTML += \" U+BFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+CFFFE
+ eval("$(\"display\").inner髲烤HTML += \" U+CFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+CFFFF
+ eval("$(\"display\").inner髲靠HTML += \" U+CFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+DFFFE
+ eval("$(\"display\").inner鬅烤HTML += \" U+DFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+DFFFF
+ eval("$(\"display\").inner鬅靠HTML += \" U+DFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+EFFFE
+ eval("$(\"display\").inner蟑烤HTML += \" U+EFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+EFFFF
+ eval("$(\"display\").inner蟑靠HTML += \" U+EFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFFE
+ eval("$(\"display\").inner罂烤HTML += \" U+FFFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+FFFFF
+ eval("$(\"display\").inner罂靠HTML += \" U+FFFFF is evil \"");
+ } catch(e) {}
+ try {
+ // U+10FFFE
+ eval("$(\"display\").inner魪烤HTML += \" U+10FFFE is evil \"");
+ } catch(e) {}
+ try {
+ // U+10FFFF
+ eval("$(\"display\").inner魪靠HTML += \" U+10FFFF is evil \"");
+ } catch(e) {}
+ test();
+}
+
+ SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug 445886</a>
+<p id="display">All good.</p>
+<div id="content" style="display: none"></div>
+</body>
+</html>
diff --git a/intl/uconv/tests/test_utf8_overconsumption.html b/intl/uconv/tests/test_utf8_overconsumption.html
new file mode 100644
index 0000000000..25c4a273ea
--- /dev/null
+++ b/intl/uconv/tests/test_utf8_overconsumption.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=445886
+-->
+<head>
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
+ <title>Test for Unicode non-characters</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script type="text/javascript">
+function Inject()
+{
+ $("display").innerHTML = "Evil";
+}
+ </script>
+</head>
+<body >onload="Inject()">
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** test that UTF-8 decoding resynchronizes after incomplete sequences */
+function test()
+{
+ is($("display").innerHTML, "All good.", "No overconsumption");
+ SimpleTest.finish();
+}
+
+ addLoadEvent(function() {
+ setTimeout(test, 0);
+ });
+ SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445886">Mozilla Bug 445886</a>
+<p id="display">All good.</p>
+<div id="content" style="display: none"></div>
+</body>
+</html>