Firefox · DOM
CVE-2026-8973
Memory Corruption in DOM
Overview
High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
ifdom/html/nsHTMLDocument.cpp |
modified | |
ifparser/html/nsHtml5StreamParser.cpp |
modified |
Files Changed
.cargo/config.toml.inCargo.lockCargo.tomldocshell/test/browser/browser_bug1543077-3.jsdocshell/test/browser/file_bug1543077-3.htmldom/html/nsHTMLDocument.cppextensions/universalchardet/tests/bug1362365_text.htmlextensions/universalchardet/tests/chrome.tomlextensions/universalchardet/tests/test_bug1362365.htmlintl/Encoding.hintl/EncodingDetector.hparser/html/nsHtml5StreamParser.cppsupply-chain/config.tomlsupply-chain/imports.locktesting/web-platform/tests/encoding-detection/ja-ISO-2022-JP-late.tentative.htmltesting/web-platform/tests/encoding-detection/ja-ISO-2022-JP.tentative.htmlthird_party/rust/chardetng/.cargo-checksum.jsonthird_party/rust/chardetng/.cargo_vcs_info.jsonthird_party/rust/chardetng/Cargo.lockthird_party/rust/chardetng/Cargo.tomlthird_party/rust/chardetng/Cargo.toml.origthird_party/rust/chardetng/README.mdthird_party/rust/chardetng/src/lib.rsthird_party/rust/chardetng_c/.cargo-checksum.jsonthird_party/rust/chardetng_c/.cargo_vcs_info.jsonthird_party/rust/chardetng_c/Cargo.lockthird_party/rust/chardetng_c/Cargo.tomlthird_party/rust/chardetng_c/Cargo.toml.origthird_party/rust/chardetng_c/README.mdthird_party/rust/chardetng_c/include/chardetng.hthird_party/rust/chardetng_c/src/lib.rstoolkit/library/rust/shared/Cargo.toml
Patch
diff --git a/.cargo/config.toml.in b/.cargo/config.toml.in
index d3a0dd0ce46..7faf5402f72 100644
--- a/.cargo/config.toml.in
+++ b/.cargo/config.toml.in
@@ -55,16 +55,6 @@ git = "https://github.com/hsivonen/any_all_workaround"
rev = "7fb1b7034c9f172aade21ee1c8554e8d8a48af80"
replace-with = "vendored-sources"
-[source."git+https://github.com/hsivonen/chardetng?rev=a07d20273ce36146adaf76bd667dd57bd7b3508b"]
-git = "https://github.com/hsivonen/chardetng"
-rev = "a07d20273ce36146adaf76bd667dd57bd7b3508b"
-replace-with = "vendored-sources"
-
-[source."git+https://github.com/hsivonen/chardetng_c?rev=2f0aba284677d098de14f91ffe5a9e5b9a4922c2"]
-git = "https://github.com/hsivonen/chardetng_c"
-rev = "2f0aba284677d098de14f91ffe5a9e5b9a4922c2"
-replace-with = "vendored-sources"
-
[source."git+https://github.com/hsivonen/rust-harfbuzz?rev=9d58a23a98772a197291d04af93f7041b7093d95"]
git = "https://github.com/hsivonen/rust-harfbuzz"
rev = "9d58a23a98772a197291d04af93f7041b7093d95"
diff --git a/Cargo.lock b/Cargo.lock
index d29d38df386..bdc40946758 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -852,8 +852,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chardetng"
-version = "0.1.17"
-source = "git+https://github.com/hsivonen/chardetng?rev=a07d20273ce36146adaf76bd667dd57bd7b3508b#a07d20273ce36146adaf76bd667dd57bd7b3508b"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13de944a44b5064ee5d3a5ceccc49a41bfec50f2580e66f82e87703acdb88b53"
dependencies = [
"cfg-if",
"encoding_rs",
@@ -862,8 +863,9 @@ dependencies = [
[[package]]
name = "chardetng_c"
-version = "0.1.2"
-source = "git+https://github.com/hsivonen/chardetng_c?rev=2f0aba284677d098de14f91ffe5a9e5b9a4922c2#2f0aba284677d098de14f91ffe5a9e5b9a4922c2"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47a0270c68b4d2e2453bd31178f6a4470ef294f38872c7dd71ca3c591618be37"
dependencies = [
"chardetng",
"encoding_rs",
diff --git a/Cargo.toml b/Cargo.toml
index b27bfd172f1..f9c59cb76ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -263,8 +263,6 @@ nss-gk-api = { git = "https://github.com/beurdouche/nss-gk-api", rev = "e48a9468
# Other overrides
any_all_workaround = { git = "https://github.com/hsivonen/any_all_workaround", rev = "7fb1b7034c9f172aade21ee1c8554e8d8a48af80" }
-chardetng = { git = "https://github.com/hsivonen/chardetng", rev = "a07d20273ce36146adaf76bd667dd57bd7b3508b" }
-chardetng_c = { git = "https://github.com/hsivonen/chardetng_c", rev = "2f0aba284677d098de14f91ffe5a9e5b9a4922c2" }
cose = { git = "https://github.com/franziskuskiefer/cose-rust", rev = "43c22248d136c8b38fe42ea709d08da6355cf04b" }
firefox-on-glean = { path = "toolkit/components/glean/api" }
icu_capi = { path = "intl/icu_capi" }
diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp
index d2662fa3243..678494b7dfd 100644
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -90,10 +90,6 @@ using namespace mozilla::dom;
// =
// ==================================================================
-static bool IsAsciiCompatible(const Encoding* aEncoding) {
- return aEncoding->IsAsciiCompatible() || aEncoding == ISO_2022_JP_ENCODING;
-}
-
nsresult NS_NewHTMLDocument(Document** aInstancePtrResult,
nsIPrincipal* aPrincipal,
nsIPrincipal* aPartitionedPrincipal,
@@ -189,11 +185,11 @@ void nsHTMLDocument::TryReloadCharset(nsIDocumentViewer* aViewer,
aViewer->ForgetReloadEncoding();
if (reloadEncodingSource <= aCharsetSource ||
- !IsAsciiCompatible(aEncoding)) {
+ !aEncoding->IsAsciiCompatible()) {
return;
}
- if (reloadEncoding && IsAsciiCompatible(reloadEncoding)) {
+ if (reloadEncoding && reloadEncoding->IsAsciiCompatible()) {
aCharsetSource = reloadEncodingSource;
aEncoding = WrapNotNull(reloadEncoding);
}
@@ -217,7 +213,7 @@ void nsHTMLDocument::TryUserForcedCharset(nsIDocumentViewer* aViewer,
}
// mCharacterSet not updated yet for channel, so check aEncoding, too.
- if (WillIgnoreCharsetOverride() || !IsAsciiCompatible(aEncoding)) {
+ if (WillIgnoreCharsetOverride() || !aEncoding->IsAsciiCompatible()) {
return;
}
@@ -249,8 +245,8 @@ void nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
if (kCharsetFromInitialUserForcedAutoDetection == parentSource ||
kCharsetFromFinalUserForcedAutoDetection == parentSource) {
if (WillIgnoreCharsetOverride() ||
- !IsAsciiCompatible(aEncoding) || // if channel said UTF-16
- !IsAsciiCompatible(parentCharset)) {
+ !aEncoding->IsAsciiCompatible() || // if channel said UTF-16
+ !parentCharset->IsAsciiCompatible()) {
return;
}
aEncoding = WrapNotNull(parentCharset);
@@ -266,7 +262,7 @@ void nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
if (kCharsetFromInitialAutoDetectionASCII <= parentSource) {
// Make sure that's OK
if (!NodePrincipal()->Equals(parentPrincipal) ||
- !IsAsciiCompatible(parentCharset)) {
+ !parentCharset->IsAsciiCompatible()) {
return;
}
@@ -759,8 +755,7 @@ bool nsHTMLDocument::WillIgnoreCharsetOverride() {
if (mCharacterSetSource >= kCharsetFromByteOrderMark) {
return true;
}
- if (!mCharacterSet->IsAsciiCompatible() &&
- mCharacterSet != ISO_2022_JP_ENCODING) {
+ if (!mCharacterSet->IsAsciiCompatible()) {
return true;
}
nsIURI* uri = GetOriginalURI();
diff --git a/intl/Encoding.h b/intl/Encoding.h
index 3b5639e431d..e478a9b752a 100644
--- a/intl/Encoding.h
+++ b/intl/Encoding.h
@@ -266,14 +266,6 @@ class Encoding final {
return encoding_is_ascii_compatible(this);
}
- /**
- * Checks whether this is a Japanese legacy encoding.
- */
- inline bool IsJapaneseLegacy() const {
- return this == SHIFT_JIS_ENCODING || this == EUC_JP_ENCODING ||
- this == ISO_2022_JP_ENCODING;
- }
-
/**
* Returns the _output encoding_ of this encoding. This is UTF-8 for
* UTF-16BE, UTF-16LE and replacement and the encoding itself otherwise.
diff --git a/intl/EncodingDetector.h b/intl/EncodingDetector.h
index 269f4c01f2e..4d7abbf141d 100644
--- a/intl/EncodingDetector.h
+++ b/intl/EncodingDetector.h
@@ -51,9 +51,14 @@ class EncodingDetector final {
/**
* Creates a new instance of the detector.
+ *
+ * Pass `false` for `aAllowISO2022JP` for Web content.
+ * The argument is available so that Thunderbird can pass `true` when
+ * processing email content that cannot run scripts.
*/
- static inline UniquePtr<EncodingDetector> Create() {
- UniquePtr<EncodingDetector> detector(chardetng_encoding_detector_new());
+ static inline UniquePtr<EncodingDetector> Create(bool aAllowISO2022JP) {
+ UniquePtr<EncodingDetector> detector(
+ chardetng_encoding_detector_new(aAllowISO2022JP));
return detector;
}
diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp
index 98a70b01652..d0b2a66cf0f 100644
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -314,17 +314,12 @@ nsHtml5StreamParser::GuessEncoding(bool aInitial) {
? kCharsetFromFinalAutoDetectionFile
: kCharsetFromFinalAutoDetectionWouldNotHaveBeenUTF8Generic));
if (source == kCharsetFromFinalAutoDetectionWouldNotHaveBeenUTF8Generic) {
- if (encoding == ISO_2022_JP_ENCODING) {
- if (EncodingDetector::TldMayAffectGuess(mTLD)) {
- source = kCharsetFromFinalAutoDetectionWouldNotHaveBeenUTF8Content;
- }
- } else if (!mDetectorHasSeenNonAscii) {
+ if (!mDetectorHasSeenNonAscii) {
source = kCharsetFromInitialAutoDetectionASCII; // deliberately Initial
} else if (ifHadBeenForced == UTF_8_ENCODING) {
MOZ_ASSERT(mCharsetSource == kCharsetFromInitialAutoDetectionASCII ||
mCharsetSource ==
- kCharsetFromInitialAutoDetectionWouldHaveBeenUTF8 ||
- mEncoding == ISO_2022_JP_ENCODING);
+ kCharsetFromInitialAutoDetectionWouldHaveBeenUTF8);
source = kCharsetFromFinalAutoDetectionWouldHaveBeenUTF8InitialWasASCII;
} else if (encoding != ifHadBeenForced) {
if (mCharsetSource == kCharsetFromInitialAutoDetectionASCII) {
@@ -347,11 +342,7 @@ nsHtml5StreamParser::GuessEncoding(bool aInitial) {
}
} else if (source ==
kCharsetFromInitialAutoDetectionWouldNotHaveBeenUTF8Generic) {
- if (encoding == ISO_2022_JP_ENCODING) {
- if (EncodingDetector::TldMayAffectGuess(mTLD)) {
- source = kCharsetFromInitialAutoDetectionWouldNotHaveBeenUTF8Content;
- }
- } else if (!mDetectorHasSeenNonAscii) {
+ if (!mDetectorHasSeenNonAscii) {
source = kCharsetFromInitialAutoDetectionASCII;
} else if (ifHadBeenForced == UTF_8_ENCODING) {
source = kCharsetFromInitialAutoDetectionWouldHaveBeenUTF8;
@@ -1058,7 +1049,7 @@ nsresult nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest) {
auto detectorCreator = MakeScopeExit([&] {
if ((mForceAutoDetection || mCharsetSource < kCharsetFromParentFrame) ||
!(mMode == LOAD_AS_DATA || mMode == VIEW_SOURCE_XML)) {
- mDetector = mozilla::EncodingDetector::Create();
+ mDetector = mozilla::EncodingDetector::Create(false);
}
});
@@ -1762,8 +1753,7 @@ bool nsHtml5StreamParser::internalEncodingDeclaration(nsHtml5String aEncoding) {
mTokenizer->getLineNumber());
}
- if (mForceAutoDetection &&
- (encoding->IsAsciiCompatible() || encoding == ISO_2022_JP_ENCODING)) {
+ if (mForceAutoDetection && encoding->IsAsciiCompatible()) {
return false;
}
@@ -2156,8 +2146,7 @@ bool nsHtml5StreamParser::ProcessLookingForMetaCharset(bool aEof) {
encoding = xmldecl_parse(contiguous.begin(), contiguous.length());
}
if (encoding) {
- if (!(mForceAutoDetection && (encoding->IsAsciiCompatible() ||
- encoding == ISO_2022_JP_ENCODING))) {
+ if (!(mForceAutoDetection && encoding->IsAsciiCompatible())) {
mForceAutoDetection = false;
mNeedsEncodingSwitchTo = encoding;
mEncodingSwitchSource = kCharsetFromXmlDeclaration;
diff --git a/supply-chain/config.toml b/supply-chain/config.toml
index 26e7be77364..f6c2627a7d9 100644
--- a/supply-chain/config.toml
+++ b/supply-chain/config.toml
@@ -35,14 +35,6 @@ notes = "This is the upstream code plus a few local fixes, see bug 1685697."
audit-as-crates-io = true
notes = "This is the upstream code not yet released"
-[policy.chardetng]
-audit-as-crates-io = true
-notes = "This is a crate Henri wrote which is also published. We should probably update Firefox to tip and certify that."
-
-[policy.chardetng_c]
-audit-as-crates-io = true
-notes = "This is a crate Henri wrote which is also published. We should probably update Firefox to tip and certify that."
-
[policy.cose]
audit-as-crates-io = true
notes = "This is upstream plus a warning fix from bug 1823866."
diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock
index cd166ab63a9..ca35e075a5f 100644
--- a/supply-chain/imports.lock
+++ b/supply-chain/imports.lock
@@ -93,8 +93,15 @@ user-login = "emilio"
user-name = "Emilio Cobos Álvarez"
[[publisher.chardetng]]
-version = "0.1.17"
-when = "2021-12-23"
+version = "1.0.0"
+when = "2026-03-30"
+user-id = 4484
+user-login = "hsivonen"
+user-name = "Henri Sivonen"
+
+[[publisher.chardetng_c]]
+version = "1.0.0"
+when = "2026-03-30"
user-id = 4484
user-login = "hsivonen"
user-name = "Henri Sivonen"
diff --git a/third_party/rust/chardetng/.cargo-checksum.json b/third_party/rust/chardetng/.cargo-checksum.json
index 83941d3927a..f791144f78b 100644
--- a/third_party/rust/chardetng/.cargo-checksum.json
+++ b/third_party/rust/chardetng/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CONTRIBUTING.md":"0e64fb3dd5a00e3fd528de6442de3f2ca851bd718c45cca0871aaf4eedac9ee1","COPYRIGHT":"01a5b47e1a8a9a4d4f9d1790ee83aee8e66292ed936ad82fe9efbc808d790b92","Cargo.toml":"c1d34a7f3fc56729840aa3c162e4aa49a4c84f056bb8281850fa74e2cab1cddc","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"3fa4ca83dcc9237839b1bdeb2e6d16bdfb5ec0c5ce42b24694d8bbf0dcbef72c","README.md":"93c066b8c63986755e358b22e8e0d665addfe4b4afdd3e7f434297bbdb4b2ef9","src/data.rs":"2e58404ae42facd6a0887f81dc76709efcdc7cf4159e5a214f4f2ecd717c44d0","src/lib.rs":"55f29a6f6acd1e1bea40b3f856e539b067bbe4c1839df6da5f91296894bb4856","src/tld.rs":"bf7084a8d6aac020d5cd05ac13d675d54ce81d4a2fbba45b7dffc608afa22783"},"package":null}
\ No newline at end of file
+{"files":{".cargo_vcs_info.json":"769413d43d5075b976f3e63dce9496e0fd5db553ebed91ae8c2c81843d85b03a","CONTRIBUTING.md":"0e64fb3dd5a00e3fd528de6442de3f2ca851bd718c45cca0871aaf4eedac9ee1","COPYRIGHT":"01a5b47e1a8a9a4d4f9d1790ee83aee8e66292ed936ad82fe9efbc808d790b92","Cargo.lock":"53a007f747c1e9b052ee384cbc1ff8695bdb670d475629c03c819b939e4d8d2c","Cargo.toml":"c9babab6216f00701ef5933ba0d74e066f0c1d3cdd1ab8123343c6b7c8153fc8","Cargo.toml.orig":"ab7f35079d171a05949b8888d160368832d55cd141355c3ee90c3c3b8233f040","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"3fa4ca83dcc9237839b1bdeb2e6d16bdfb5ec0c5ce42b24694d8bbf0dcbef72c","README.md":"15f59d31be06931f36a78d7b9155840d247d0e2ee131d2cd16d5540ccf092114","src/data.rs":"2e58404ae42facd6a0887f81dc76709efcdc7cf4159e5a214f4f2ecd717c44d0","src/lib.rs":"25dd7515e501752ace2356b4ead3cc6c74840648481dcad6ab8e496950ca394e","src/tld.rs":"bf7084a8d6aac020d5cd05ac13d675d54ce81d4a2fbba45b7dffc608afa22783"},"package":"13de944a44b5064ee5d3a5ceccc49a41bfec50f2580e66f82e87703acdb88b53"}
\ No newline at end of file
diff --git a/third_party/rust/chardetng/.cargo_vcs_info.json b/third_party/rust/chardetng/.cargo_vcs_info.json
new file mode 100644
index 00000000000..4e5d585b775
--- /dev/null
+++ b/third_party/rust/chardetng/.cargo_vcs_info.json
@@ -0,0 +1,6 @@
+{
+ "git": {
+ "sha1": "4a53a99e07e418ceb91e0049580e6bbcb2df0591"
+ },
+ "path_in_vcs": ""
+}
\ No newline at end of file
diff --git a/third_party/rust/chardetng/Cargo.lock b/third_party/rust/chardetng/Cargo.lock
new file mode 100644
index 00000000000..acebc19383b
--- /dev/null
+++ b/third_party/rust/chardetng/Cargo.lock
@@ -0,0 +1,97 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "chardetng"
+version = "1.0.0"
+dependencies = [
+ "arrayvec",
+ "cfg-if",
+ "detone",
+ "encoding_rs",
+ "memchr",
+ "rayon",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
+dependencies = [
+ "crossbeam-epoch",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-epoch"
+version = "0.9.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
+
+[[package]]
+name = "detone"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7104c193859c8141dcbb2008bd3d93e581d0fa7bb47b0d9f5e15c89d1b55514"
+
+[[package]]
+name = "either"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "memchr"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
+
+[[package]]
+name = "rayon"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
+dependencies = [
+ "either",
+ "rayon-core",
+]
+
+[[package]]
+name = "rayon-core"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
+dependencies = [
+ "crossbeam-deque",
... (file diff truncated)
Loading diff…
Regression Test / PoC
shipped with the fix
diff --git a/docshell/test/browser/browser_bug1543077-3.js b/docshell/test/browser/browser_bug1543077-3.js
index 7cef4aef101..e266bfba058 100644
--- a/docshell/test/browser/browser_bug1543077-3.js
+++ b/docshell/test/browser/browser_bug1543077-3.js
@@ -10,27 +10,27 @@ function test() {
function afterOpen() {
is(
content.document.documentElement.textContent.indexOf("\u3042"),
- 136,
+ 147,
"Parent doc should be ISO-2022-JP initially"
);
is(
content.frames[0].document.documentElement.textContent.indexOf("\u3042"),
- 92,
- "Child doc should be ISO-2022-JP initially"
+ -1,
+ "Child doc should be windows-1252 initially"
);
}
function afterChangeCharset() {
is(
content.document.documentElement.textContent.indexOf("\u3042"),
- 136,
+ 147,
"Parent doc should decode as ISO-2022-JP subsequently"
);
is(
content.frames[0].document.documentElement.textContent.indexOf("\u3042"),
- 92,
- "Child doc should decode as ISO-2022-JP subsequently"
+ -1,
+ "Child doc should decode as windows-1252 subsequently"
);
is(
@@ -40,7 +40,7 @@ function afterChangeCharset() {
);
is(
content.frames[0].document.characterSet,
- "ISO-2022-JP",
- "Child doc should report ISO-2022-JP subsequently"
+ "windows-1252",
+ "Child doc should report windows-1252 subsequently"
);
}
diff --git a/docshell/test/browser/file_bug1543077-3.html b/docshell/test/browser/file_bug1543077-3.html
index c4f467dd3fb..9dcf03727cb 100644
--- a/docshell/test/browser/file_bug1543077-3.html
+++ b/docshell/test/browser/file_bug1543077-3.html
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
+<meta charset="ISO-2022-JP">
<meta content="width=device-width, initial-scale=1" name="viewport">
-<title>No encoding declaration in parent or child</title>
+<title>Encoding declaration in parent but not in child</title>
</head>
<body>
-<h1>No encoding declaration in parent or child</h1>
+<h1>Encoding declaration in parent but not in child</h1>
<p>Hiragana letter a if decoded as ISO-2022-JP: $B$"(B</p>
diff --git a/extensions/universalchardet/tests/bug1362365_text.html b/extensions/universalchardet/tests/bug1362365_text.html
new file mode 100644
index 00000000000..c666c46dcc4
--- /dev/null
+++ b/extensions/universalchardet/tests/bug1362365_text.html
@@ -0,0 +1 @@
+<title>$BF|K\8l(B</title>
diff --git a/extensions/universalchardet/tests/chrome.toml b/extensions/universalchardet/tests/chrome.toml
index 767be95fda2..190033d792c 100644
--- a/extensions/universalchardet/tests/chrome.toml
+++ b/extensions/universalchardet/tests/chrome.toml
@@ -23,6 +23,7 @@ support-files = [
"bug1071816-2_text.html",
"bug1071816-3_text.html",
"bug1071816-4_text.html",
+ "bug1362365_text.html",
]
["test_bug306272.html"]
@@ -70,3 +71,5 @@ support-files = [
["test_bug1071816-3.html"]
["test_bug1071816-4.html"]
+
+["test_bug1362365.html"]
diff --git a/extensions/universalchardet/tests/test_bug1362365.html b/extensions/universalchardet/tests/test_bug1362365.html
new file mode 100644
index 00000000000..8c7a858761a
--- /dev/null
+++ b/extensions/universalchardet/tests/test_bug1362365.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1362365
+-->
+<head>
+ <title>Test for Bug 1362365</title>
+ <script type="text/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
+ </script>
+ <script type="text/javascript" src="CharsetDetectionTests.js"></script>
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1362365">Mozilla Bug 1362365</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<iframe id="testframe"></iframe>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+/** Test for Bug 1362365 */
+CharsetDetectionTests("bug1362365_text.html",
+ "UTF-8", // not windows-1252 due this counting as explicit override
+ new Array("ja_parallel_state_machine"));
+</script>
+</pre>
+</body>
+</html>
diff --git a/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP-late.tentative.html b/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP-late.tentative.html
index 6e4bc9157d8..2d780a55c02 100644
--- a/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP-late.tentative.html
+++ b/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP-late.tentative.html
@@ -7,7 +7,7 @@
setup({explicit_done:true});
window.onmessage = function(e) {
test(function() {
- assert_equals(e.data, "ISO-2022-JP", 'Expected ISO-2022-JP');
+ assert_equals(e.data, "windows-1252", 'Expected windows-1252 due to ISO-2022-JP no longer getting detected');
}, "Check detection result");
w.close();
done();
diff --git a/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP.tentative.html b/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP.tentative.html
index 405e123808d..e67adfd45e7 100644
--- a/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP.tentative.html
+++ b/testing/web-platform/tests/encoding-detection/ja-ISO-2022-JP.tentative.html
@@ -7,7 +7,7 @@
setup({explicit_done:true});
onload = function() {
test(function() {
- assert_equals(document.characterSet, "ISO-2022-JP", 'Expected ISO-2022-JP');
+ assert_equals(document.characterSet, "windows-1252", 'Expected windows-1252 due to ISO-2022-JP no longer getting detected');
}, "Check detection result");
done();
};
Loading diff…
References
On This Page