Bug 1523562 [wpt PR 15092] - Escaped EOF, a=testonly
authorTab Atkins Jr <jackalmage@gmail.com>
Fri, 01 Feb 2019 11:40:35 +0000
changeset 458174 21afd416b4906b2b0ff3745ad10cde023c36c46b
parent 458173 f19520404bc6c1170396c97a1a5139b174e4a63a
child 458175 92a780f5eca95537b4274b17bbe063643858394c
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1523562, 15092
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523562 [wpt PR 15092] - Escaped EOF, a=testonly Automatic update from web-platform-tests Escaped EOF Tests <https://github.com/w3c/csswg-drafts/issues/3182> and <https://github.com/w3c/csswg-drafts/issues/1821> -- Use assert_throws, etc Per @domenic's advice, go ahead and use assert_throws on the throwing call, and then just make the should-succeed call directly, as a throw will cause the test to fail anyway. -- Merge pull request #15092 from web-platform-tests/tabatkins-patch-1 Escaped EOF -- wpt-commits: 26f39eb230185a804fabc398810cdcdddefc49ac, f44998b147858a8a2832f66dd32bc9d1ecefb1b3, fc57d7ad7a2942cfa363d5a9b8c6c7d74f5bb693 wpt-pr: 15092
testing/web-platform/tests/css/css-syntax/escaped-eof.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-syntax/escaped-eof.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<title>Escaped EOF</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<meta name="author" title="Tab Atkins-Bittner">
+<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-escaped-code-point">
+<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-string-token">
+<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-token">
+
+<style>foo { --foo:foo\</style>
+<style>foo { --foo:1foo\</style>
+<style>foo { --foo:url(foo\</style>
+<style>foo { --foo:"foo\</style>
+
+<script>
+test(()=>{
+    assert_throws(new SyntaxError, ()=>{document.querySelector("#123");}, "numeric hash token is invalid in a selector");
+    document.querySelector("#foo\\"); // escaped-EOF in a hash token is valid in a selector
+}, "Escaped EOF turns into a U+FFFD in a hash token, makes it 'ID' type.");
+
+test(()=>{
+    const sh = document.styleSheets[0];
+    const val = sh.cssRules[0].style.getPropertyValue("--foo");
+    assert_equals("foo\ufffd", val);
+}, "Escaped EOF turns into a U+FFFD in an ident token.");
+
+test(()=>{
+    const sh = document.styleSheets[1];
+    const val = sh.cssRules[0].style.getPropertyValue("--foo");
+    assert_equals("1foo\ufffd", val);
+}, "Escaped EOF turns into a U+FFFD in a dimension token.");
+
+test(()=>{
+    const sh = document.styleSheets[2];
+    const val = sh.cssRules[0].style.getPropertyValue("--foo");
+    assert_equals("url(foo\ufffd)", val);
+}, "Escaped EOF turns into a U+FFFD in a url token.");
+
+test(()=>{
+    const sh = document.styleSheets[3];
+    const val = sh.cssRules[0].style.getPropertyValue("--foo");
+    assert_equals(`"foo"`, val);
+}, "Escaped EOF in a string is ignored.");
+
+</script>