gecko-dev/testing/web-platform/tests/css/css-font-loading/empty-family-load.html
Dominik Röttsches d8d09c4a11 Bug 1596174 [wpt PR 20237] - Avoid looking up empty font name in FontFaceCache, a=testonly
Automatic update from web-platform-tests
Avoid looking up empty font name in FontFaceCache

When document.fonts.load() is called with font specification such as
'1px ""' (containing two quotes) as the argument, CSS font property
parsing parses this successfully as the empty string. FontFaceCache
was not prepared to handle that correctly.

Fix FontFaceCache to guard against that. Add test to actually
ensure that this font specification's load promise resolves
successfully.

In parallel, raised
https://github.com/w3c/csswg-drafts/issues/4510
in CSS WG to discuss whether it would make sense to reject such
a font specification at the parsing stage already.

Bug: 1023206
Change-Id: If46aef0c7fcd2e06bc657480b9189857438d8cc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1914392
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715261}

--

wpt-commits: 67da4dd8159574619c10b26f527f46f9172e805b
wpt-pr: 20237
2019-11-29 10:56:22 +00:00

18 lines
787 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Dominik Röttsches" href="drott@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-font-loading/#font-face-load">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4510">
<meta name="assert" content="Ensure that an empty font family name loads and resolves to array." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function(t) {
var testFontFace = new FontFace('a', 'url(a)');
document.fonts.add(testFontFace);
return document.fonts.load("1px \"\"").then(function(result) {
assert_true(Array.isArray(result),
"Resolved promise's value must be an array.") });
})
</script>
</html>