summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/syntax/charset
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/syntax/charset
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/syntax/charset')
-rw-r--r--testing/web-platform/tests/html/syntax/charset/README.md6
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-1kb.html955
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-bogus-after-1kb.html933
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-bogus.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-head-after-1kb-crlf.html927
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-head-after-1kb.html933
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-head-in-1kb-crlf.html932
-rw-r--r--testing/web-platform/tests/html/syntax/charset/after-head-in-1kb.html938
-rw-r--r--testing/web-platform/tests/html/syntax/charset/baseline.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/document-write.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-comment.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-noscript-after-template-after-1kb.html894
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-object.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-script.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-style.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-svg-in-cdata.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-svg.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-template-after-1kb.html1046
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-template.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/in-title.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/ncr.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/non-ascii-in-comment-before.html11
-rw-r--r--testing/web-platform/tests/html/syntax/charset/non-ascii-in-title-before.html11
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-1kb-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-bogus-after-1kb-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-bogus-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-crlf-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-crlf-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/baseline-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/document-write-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-comment-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-noscript-after-template-after-1kb-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-object-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-script-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-style-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-svg-in-cdata-ref.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-svg-ref.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-template-after-1kb-ref.html8
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-template-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/in-title-ref.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/ncr-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-comment-before-ref.html9
-rw-r--r--testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-title-before-ref.html10
-rw-r--r--testing/web-platform/tests/html/syntax/charset/with-inheritance.html60
-rw-r--r--testing/web-platform/tests/html/syntax/charset/without-inheritance.htmlbin0 -> 4550 bytes
-rw-r--r--testing/web-platform/tests/html/syntax/charset/xhr.html73
48 files changed, 8040 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/charset/README.md b/testing/web-platform/tests/html/syntax/charset/README.md
new file mode 100644
index 0000000000..eaa708507c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/README.md
@@ -0,0 +1,6 @@
+These tests don't necessarily match the spec as of September 2021 but instead
+these tests test the behavior that on one hand WebKit and Blink and on the
+other hand https://github.com/whatwg/html/issues/6962 have in common.
+
+The cases where the two approaches differ are in
+https://searchfox.org/mozilla-central/source/testing/web-platform/mozilla/tests/html/syntax/charset
diff --git a/testing/web-platform/tests/html/syntax/charset/after-1kb.html b/testing/web-platform/tests/html/syntax/charset/after-1kb.html
new file mode 100644
index 0000000000..01eedca187
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-1kb.html
@@ -0,0 +1,955 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/after-1kb-ref.html">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<meta charset="windows-1251">
+</head>
+<body>
+<p>In <code>head</code>, after first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-bogus-after-1kb.html b/testing/web-platform/tests/html/syntax/charset/after-bogus-after-1kb.html
new file mode 100644
index 0000000000..f44fda1e6d
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-bogus-after-1kb.html
@@ -0,0 +1,933 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/after-bogus-after-1kb-ref.html">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<bogus><meta charset="windows-1251">
+</head>
+<body>
+<p>After <code>bogus</code>, before <code>head</code> end tag, after first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-bogus.html b/testing/web-platform/tests/html/syntax/charset/after-bogus.html
new file mode 100644
index 0000000000..7eeedde7af
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-bogus.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/after-bogus-ref.html">
+<bogus><meta charset="windows-1251">
+</head>
+<body>
+<p>Meta after <code>bogus</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb-crlf.html b/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb-crlf.html
new file mode 100644
index 0000000000..10a6d1c3d7
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb-crlf.html
@@ -0,0 +1,927 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/after-head-after-1kb-crlf-ref.html">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</head>
+<meta charset="windows-1251">
+<body>
+<p>After <code>head</code>, before <code>body</code>, after first kilobyte, with a CRLF in the first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb.html b/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb.html
new file mode 100644
index 0000000000..d514fdfbff
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-head-after-1kb.html
@@ -0,0 +1,933 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/after-head-after-1kb-ref.html">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</head>
+<meta charset="windows-1251">
+<body>
+<p>After <code>head</code>, before <code>body</code>, after first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb-crlf.html b/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb-crlf.html
new file mode 100644
index 0000000000..e5c95e7036
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb-crlf.html
@@ -0,0 +1,932 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/after-head-in-1kb-crlf-ref.html">
+</head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<meta charset="windows-1251">
+<body>
+<p>After <code>head</code>, before <code>body</code>, within first kilobyte, with a CRLF in the first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb.html b/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb.html
new file mode 100644
index 0000000000..e73522d373
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/after-head-in-1kb.html
@@ -0,0 +1,938 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/after-head-in-1kb-ref.html">
+</head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<meta charset="windows-1251">
+<body>
+<p>After <code>head</code>, before <code>body</code>, within first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/baseline.html b/testing/web-platform/tests/html/syntax/charset/baseline.html
new file mode 100644
index 0000000000..40bce2f63f
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/baseline.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/baseline-ref.html">
+<meta charset="windows-1251">
+</head>
+<body>
+<p>Normal meta.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/document-write.html b/testing/web-platform/tests/html/syntax/charset/document-write.html
new file mode 100644
index 0000000000..b70a15c567
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/document-write.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/document-write-ref.html">
+<script>document.write('<meta char' + 'set="windows-1251">');</script>
+</head>
+<body>
+<p>Meta from <code>document.write</code> (with concatenation in the middle of <code>charset</code> to require execution for effect).</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-comment.html b/testing/web-platform/tests/html/syntax/charset/in-comment.html
new file mode 100644
index 0000000000..65828a1872
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-comment.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-comment-ref.html">
+<!--<meta charset="windows-1251">-->
+</head>
+<body>
+<p>Meta inside comment.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-noscript-after-template-after-1kb.html b/testing/web-platform/tests/html/syntax/charset/in-noscript-after-template-after-1kb.html
new file mode 100644
index 0000000000..d22e83aaa7
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-noscript-after-template-after-1kb.html
@@ -0,0 +1,894 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-noscript-after-template-after-1kb-ref.html">
+<noscript><template></template>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<meta charset="windows-1251"></noscript>
+</head>
+<body>
+<p>Meta in <code>noscript</code> after <code>template</code> (which is also inside the <code>noscript</code>) after 1kb of padding following the template.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-object.html b/testing/web-platform/tests/html/syntax/charset/in-object.html
new file mode 100644
index 0000000000..32535b8eba
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-object.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/in-object-ref.html">
+<object><meta charset="windows-1251"></object>
+</head>
+<body>
+<p>Meta in <code>object</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-script.html b/testing/web-platform/tests/html/syntax/charset/in-script.html
new file mode 100644
index 0000000000..0c18a4435e
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-script.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-script-ref.html">
+<script><meta charset="windows-1251"></script>
+</head>
+<body>
+<p>Meta in <code>script</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-style.html b/testing/web-platform/tests/html/syntax/charset/in-style.html
new file mode 100644
index 0000000000..69d8fa429c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-style.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-style-ref.html">
+<style><meta charset="windows-1251"></style>
+</head>
+<body>
+<p>Meta in <code>style</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-svg-in-cdata.html b/testing/web-platform/tests/html/syntax/charset/in-svg-in-cdata.html
new file mode 100644
index 0000000000..d1c4ca12b3
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-svg-in-cdata.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-svg-in-cdata-ref.html">
+</head>
+<body>
+<svg><![CDATA[<meta charset="windows-1251">]]></svg>
+<p>In SVG in CDATA (after head).</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-svg.html b/testing/web-platform/tests/html/syntax/charset/in-svg.html
new file mode 100644
index 0000000000..cb29164289
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-svg.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/in-svg-ref.html">
+</head>
+<body>
+<svg><meta charset="windows-1251"></svg>
+<p>In SVG (after head).</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-template-after-1kb.html b/testing/web-platform/tests/html/syntax/charset/in-template-after-1kb.html
new file mode 100644
index 0000000000..ae77decea2
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-template-after-1kb.html
@@ -0,0 +1,1046 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-template-after-1kb-ref.html">
+
+
+
+
+
+
+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
+
+
+
+
+
+<template><meta charset="windows-1251"></template>
+</head>
+<body>
+<p>In <code>template</code>, before <code>head</code> end tag, after first kilobyte.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-template.html b/testing/web-platform/tests/html/syntax/charset/in-template.html
new file mode 100644
index 0000000000..264affc269
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-template.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/in-template-ref.html">
+<template><meta charset="windows-1251"></template>
+</head>
+<body>
+<p>Meta in <code>template</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/in-title.html b/testing/web-platform/tests/html/syntax/charset/in-title.html
new file mode 100644
index 0000000000..7b72c48dd8
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/in-title.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="mismatch" href="references/in-title-ref.html">
+<title><meta charset="windows-1251"></title>
+</head>
+<body>
+<p>Meta in <code>title</code>.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/ncr.html b/testing/web-platform/tests/html/syntax/charset/ncr.html
new file mode 100644
index 0000000000..9f8b7308ad
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/ncr.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/ncr-ref.html">
+<meta charset="&#119;indows-1251">
+</head>
+<body>
+<p>NCR in encoding label.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/non-ascii-in-comment-before.html b/testing/web-platform/tests/html/syntax/charset/non-ascii-in-comment-before.html
new file mode 100644
index 0000000000..148c6544a3
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/non-ascii-in-comment-before.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/non-ascii-in-comment-before-ref.html">
+<!-- æ -->
+<meta charset="windows-1251">
+</head>
+<body>
+<p>Normal meta. Non-ASCII in comment before.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/non-ascii-in-title-before.html b/testing/web-platform/tests/html/syntax/charset/non-ascii-in-title-before.html
new file mode 100644
index 0000000000..aac0ca94c1
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/non-ascii-in-title-before.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<head>
+<link rel="match" href="references/non-ascii-in-title-before-ref.html">
+<title>æ</title>
+<meta charset="windows-1251">
+</head>
+<body>
+<p>Normal meta. Non-ASCII in title before.</p>
+<p>Test: æ</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-1kb-ref.html
new file mode 100644
index 0000000000..edb0ae9c72
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-1kb-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>In <code>head</code>, after first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-bogus-after-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-bogus-after-1kb-ref.html
new file mode 100644
index 0000000000..c6f129a89e
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-bogus-after-1kb-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>After <code>bogus</code>, before <code>head</code> end tag, after first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-bogus-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-bogus-ref.html
new file mode 100644
index 0000000000..f8080e60aa
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-bogus-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta after <code>bogus</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-crlf-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-crlf-ref.html
new file mode 100644
index 0000000000..868a9639bf
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-crlf-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>After <code>head</code>, before <code>body</code>, after first kilobyte, with a CRLF in the first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-ref.html
new file mode 100644
index 0000000000..bde4745b26
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-head-after-1kb-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>After <code>head</code>, before <code>body</code>, after first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-crlf-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-crlf-ref.html
new file mode 100644
index 0000000000..0676d7374e
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-crlf-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>After <code>head</code>, before <code>body</code>, within first kilobyte, with a CRLF in the first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-ref.html
new file mode 100644
index 0000000000..75fc2dd618
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/after-head-in-1kb-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>After <code>head</code>, before <code>body</code>, within first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/baseline-ref.html b/testing/web-platform/tests/html/syntax/charset/references/baseline-ref.html
new file mode 100644
index 0000000000..21b939efe0
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/baseline-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Normal meta.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/document-write-ref.html b/testing/web-platform/tests/html/syntax/charset/references/document-write-ref.html
new file mode 100644
index 0000000000..9902cf77d1
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/document-write-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta from <code>document.write</code> (with concatenation in the middle of <code>charset</code> to require execution for effect).</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-comment-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-comment-ref.html
new file mode 100644
index 0000000000..94b2016e0d
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-comment-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta inside comment.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-noscript-after-template-after-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-noscript-after-template-after-1kb-ref.html
new file mode 100644
index 0000000000..12e9b93626
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-noscript-after-template-after-1kb-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta in <code>noscript</code> after <code>template</code> (which is also inside the <code>noscript</code>) after 1kb of padding following the template.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-object-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-object-ref.html
new file mode 100644
index 0000000000..3f52d0efe9
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-object-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta in <code>object</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-script-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-script-ref.html
new file mode 100644
index 0000000000..bbb63fd931
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-script-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta in <code>script</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-style-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-style-ref.html
new file mode 100644
index 0000000000..9669146eb5
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-style-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta in <code>style</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-svg-in-cdata-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-svg-in-cdata-ref.html
new file mode 100644
index 0000000000..1d17d2720b
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-svg-in-cdata-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<svg></svg>
+<p>In SVG in CDATA (after head).</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-svg-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-svg-ref.html
new file mode 100644
index 0000000000..c9e41aa177
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-svg-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<svg></svg>
+<p>In SVG (after head).</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-template-after-1kb-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-template-after-1kb-ref.html
new file mode 100644
index 0000000000..df20eba39b
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-template-after-1kb-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<head>
+</head>
+<body>
+<p>In <code>template</code>, before <code>head</code> end tag, after first kilobyte.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-template-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-template-ref.html
new file mode 100644
index 0000000000..83c0e93072
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-template-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Meta in <code>template</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/in-title-ref.html b/testing/web-platform/tests/html/syntax/charset/references/in-title-ref.html
new file mode 100644
index 0000000000..5fb8a05f2d
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/in-title-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<title><meta charset="windows-1251"></title>
+</head>
+<body>
+<p>Meta in <code>title</code>.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/ncr-ref.html b/testing/web-platform/tests/html/syntax/charset/references/ncr-ref.html
new file mode 100644
index 0000000000..1d25b4d23d
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/ncr-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>NCR in encoding label.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-comment-before-ref.html b/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-comment-before-ref.html
new file mode 100644
index 0000000000..bd2acd274c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-comment-before-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<p>Normal meta. Non-ASCII in comment before.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-title-before-ref.html b/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-title-before-ref.html
new file mode 100644
index 0000000000..4f54732432
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/references/non-ascii-in-title-before-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<title>ж</title>
+</head>
+<body>
+<p>Normal meta. Non-ASCII in title before.</p>
+<p>Test: ж</p>
+<p>If &#x0436;, meta takes effect</p>
+</body>
diff --git a/testing/web-platform/tests/html/syntax/charset/with-inheritance.html b/testing/web-platform/tests/html/syntax/charset/with-inheritance.html
new file mode 100644
index 0000000000..6ed3f9ec7a
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/with-inheritance.html
@@ -0,0 +1,60 @@
+<!doctype html>
+<meta charset="windows-1253">
+<title>meta charset in iframes with windows-1253 inhering from parent</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+
+<script>
+setup({explicit_done:true});
+window.onload = function() {
+ runAllTests();
+ done();
+};
+
+function runAllTests() {
+ const prefix = "Test: ";
+ let iframes = document.getElementsByTagName("iframe");
+ for (let i = 0; i < iframes.length; ++i) {
+ let iframe = iframes[i];
+ test(function() {
+ let doc = iframe.contentWindow.document;
+ let link = doc.getElementsByTagName("link")[0];
+ let match = (link.rel == "match");
+ let content = doc.documentElement.textContent;
+ let index = content.indexOf(prefix);
+ let c = content.substring(index + prefix.length, index + prefix.length + 1);
+ if (match) {
+ assert_equals(doc.characterSet, "windows-1251", 'Check characterSet');
+ assert_equals(c, "\u0436", 'Check character');
+ } else {
+ assert_equals(doc.characterSet, "windows-1253", 'Check characterSet');
+ assert_equals(c, "\u03B6", 'Check character');
+ }
+ }, "Check " + iframe.src);
+ }
+}
+
+</script>
+
+<iframe src="after-1kb.html"></iframe>
+<iframe src="after-bogus-after-1kb.html"></iframe>
+<iframe src="after-bogus.html"></iframe>
+<iframe src="after-head-after-1kb-crlf.html"></iframe>
+<iframe src="after-head-after-1kb.html"></iframe>
+<iframe src="after-head-in-1kb-crlf.html"></iframe>
+<iframe src="after-head-in-1kb.html"></iframe>
+<iframe src="baseline.html"></iframe>
+<iframe src="document-write.html"></iframe>
+<iframe src="in-comment.html"></iframe>
+<iframe src="in-noscript-after-template-after-1kb.html"></iframe>
+<iframe src="in-object.html"></iframe>
+<iframe src="in-script.html"></iframe>
+<iframe src="in-style.html"></iframe>
+<iframe src="in-svg.html"></iframe>
+<iframe src="in-svg-in-cdata.html"></iframe>
+<iframe src="in-template-after-1kb.html"></iframe>
+<iframe src="in-template.html"></iframe>
+<iframe src="in-title.html"></iframe>
+<iframe src="ncr.html"></iframe>
+<iframe src="non-ascii-in-comment-before.html"></iframe>
+<iframe src="non-ascii-in-title-before.html"></iframe>
diff --git a/testing/web-platform/tests/html/syntax/charset/without-inheritance.html b/testing/web-platform/tests/html/syntax/charset/without-inheritance.html
new file mode 100644
index 0000000000..d05945720a
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/without-inheritance.html
Binary files differ
diff --git a/testing/web-platform/tests/html/syntax/charset/xhr.html b/testing/web-platform/tests/html/syntax/charset/xhr.html
new file mode 100644
index 0000000000..70af7e720c
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/charset/xhr.html
@@ -0,0 +1,73 @@
+<!doctype html>
+<meta charset="windows-1253">
+<title>meta charset in XHR</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+
+<script>
+setup({explicit_done:true});
+window.onload = function() {
+ runNextTest();
+};
+
+let files = [
+ "after-1kb.html",
+ "after-bogus-after-1kb.html",
+ "after-bogus.html",
+ "after-head-after-1kb-crlf.html",
+ "after-head-after-1kb.html",
+ "after-head-in-1kb-crlf.html",
+ "after-head-in-1kb.html",
+ "baseline.html",
+ "document-write.html",
+ "in-comment.html",
+ "in-noscript-after-template-after-1kb.html",
+ "in-object.html",
+ "in-script.html",
+ "in-style.html",
+ "in-svg.html",
+ "in-svg-in-cdata.html",
+ "in-template-after-1kb.html",
+ "in-template.html",
+ "in-title.html",
+ "ncr.html",
+ "non-ascii-in-comment-before.html",
+ "non-ascii-in-title-before.html",
+];
+
+function handler() {
+ const prefix = "Test: ";
+ let doc = this.response;
+ test(function() {
+ let link = doc.getElementsByTagName("link")[0];
+ let match = (link.rel == "match");
+ let content = doc.documentElement.textContent;
+ let index = content.indexOf(prefix);
+ let c = content.substring(index + prefix.length, index + prefix.length + 1);
+ if (match) {
+ assert_equals(doc.characterSet, "windows-1251", 'Check characterSet');
+ assert_equals(c, "\u0436", 'Check character');
+ } else {
+ assert_equals(doc.characterSet, "UTF-8", 'Check characterSet');
+ assert_equals(c, "\uFFFD", 'Check character');
+ }
+ }, "Check " + this.thesrc);
+ runNextTest();
+}
+
+function runNextTest() {
+ let file = files.shift();
+ if (!file) {
+ done();
+ return;
+ }
+ let xhr = new XMLHttpRequest();
+ xhr.responseType = "document";
+ xhr.onload = handler;
+ xhr.thesrc = file; // expando
+ xhr.open("GET", file);
+ xhr.send();
+}
+
+</script>
+