Diff
Modified: trunk/LayoutTests/ChangeLog (254219 => 254220)
--- trunk/LayoutTests/ChangeLog 2020-01-08 21:18:42 UTC (rev 254219)
+++ trunk/LayoutTests/ChangeLog 2020-01-08 21:26:00 UTC (rev 254220)
@@ -1,3 +1,16 @@
+2020-01-08 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Fix specification violation in Font Loading API
+ https://bugs.webkit.org/show_bug.cgi?id=205901
+ <rdar://problem/58083743>
+
+ Reviewed by Brent Fulgham.
+
+ Test all the entry points to the CSS Font Loading API that accept CSS keywords.
+
+ * fast/text/font-loading-global-keyword-expected.txt: Added.
+ * fast/text/font-loading-global-keyword.html: Added.
+
2020-01-08 Diego Pino Garcia <dp...@igalia.com>
[GTK] Unreviewed, update test expectations
Added: trunk/LayoutTests/fast/text/font-loading-global-keyword-expected.txt (0 => 254220)
--- trunk/LayoutTests/fast/text/font-loading-global-keyword-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/font-loading-global-keyword-expected.txt 2020-01-08 21:26:00 UTC (rev 254220)
@@ -0,0 +1,45 @@
+This test ensure that global CSS keywords generate expected syntax errors.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.fonts.check('initial', 'A') threw exception SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.check('inherited', 'A') threw exception SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.check('unset', 'A') threw exception SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.check('revert', 'A') threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'style': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'style': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'style': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'style': 'revert'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'weight': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'weight': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'weight': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'weight': 'revert'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'stretch': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'stretch': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'stretch': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'stretch': 'revert'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'unicodeRange': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'unicodeRange': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'unicodeRange': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'unicodeRange': 'revert'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'featureSettings': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'featureSettings': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'featureSettings': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'featureSettings': 'revert'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'display': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'display': 'inherited'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'display': 'unset'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'url(asdf)', {'display': 'initial'}) threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'inherited') threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'unset') threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'revert') threw exception SyntaxError: The string did not match the expected pattern..
+PASS new FontFace('abc', 'revert') threw exception SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.load('initial', 'A') rejected promise with SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.load('inherited', 'A') rejected promise with SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.load('unset', 'A') rejected promise with SyntaxError: The string did not match the expected pattern..
+PASS document.fonts.load('revert', 'A') rejected promise with SyntaxError: The string did not match the expected pattern..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/text/font-loading-global-keyword.html (0 => 254220)
--- trunk/LayoutTests/fast/text/font-loading-global-keyword.html (rev 0)
+++ trunk/LayoutTests/fast/text/font-loading-global-keyword.html 2020-01-08 21:26:00 UTC (rev 254220)
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("This test ensure that global CSS keywords generate expected syntax errors.");
+shouldThrowErrorName("document.fonts.check('initial', 'A')", "SyntaxError");
+shouldThrowErrorName("document.fonts.check('inherited', 'A')", "SyntaxError");
+shouldThrowErrorName("document.fonts.check('unset', 'A')", "SyntaxError");
+shouldThrowErrorName("document.fonts.check('revert', 'A')", "SyntaxError");
+shouldReject("document.fonts.load('initial', 'A')");
+shouldReject("document.fonts.load('inherited', 'A')");
+shouldReject("document.fonts.load('unset', 'A')");
+shouldReject("document.fonts.load('revert', 'A')");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'style': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'style': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'style': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'style': 'revert'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'weight': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'weight': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'weight': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'weight': 'revert'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'stretch': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'stretch': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'stretch': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'stretch': 'revert'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'unicodeRange': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'unicodeRange': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'unicodeRange': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'unicodeRange': 'revert'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'featureSettings': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'featureSettings': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'featureSettings': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'featureSettings': 'revert'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'display': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'display': 'inherited'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'display': 'unset'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'url(asdf)', {'display': 'initial'})", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'inherited')", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'unset')", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'revert')", "SyntaxError");
+shouldThrowErrorName("new FontFace('abc', 'revert')", "SyntaxError");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (254219 => 254220)
--- trunk/Source/WebCore/ChangeLog 2020-01-08 21:18:42 UTC (rev 254219)
+++ trunk/Source/WebCore/ChangeLog 2020-01-08 21:26:00 UTC (rev 254220)
@@ -1,3 +1,23 @@
+2020-01-08 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Fix specification violation in Font Loading API
+ https://bugs.webkit.org/show_bug.cgi?id=205901
+ <rdar://problem/58083743>
+
+ Reviewed by Brent Fulgham.
+
+ Our Font Loading API does not comply with the spec:
+
+ > If the parsed value is a CSS-wide keyword, return a syntax error.
+
+ Rather than crashing, we should return a syntax error.
+
+ Test: fast/text/font-loading-global-keyword.html
+
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::computeFontSelectionRequest):
+ (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
+
2020-01-08 Dean Jackson <d...@apple.com>
[WebGL] More GraphicsContext3D to GraphicsContextGL renaming
Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (254219 => 254220)
--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp 2020-01-08 21:18:42 UTC (rev 254219)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp 2020-01-08 21:26:00 UTC (rev 254220)
@@ -300,7 +300,7 @@
return m_faces[i];
}
-static FontSelectionRequest computeFontSelectionRequest(MutableStyleProperties& style)
+static ExceptionOr<FontSelectionRequest> computeFontSelectionRequest(MutableStyleProperties& style)
{
RefPtr<CSSValue> weightValue = style.getPropertyCSSValue(CSSPropertyFontWeight).get();
if (!weightValue)
@@ -314,11 +314,14 @@
if (!styleValue)
styleValue = CSSFontStyleValue::create(CSSValuePool::singleton().createIdentifierValue(CSSValueNormal));
+ if (weightValue->isGlobalKeyword() || stretchValue->isGlobalKeyword() || styleValue->isGlobalKeyword())
+ return Exception { SyntaxError };
+
auto weightSelectionValue = Style::BuilderConverter::convertFontWeightFromValue(*weightValue);
auto stretchSelectionValue = Style::BuilderConverter::convertFontStretchFromValue(*stretchValue);
auto styleSelectionValue = Style::BuilderConverter::convertFontStyleFromValue(*styleValue);
- return { weightSelectionValue, stretchSelectionValue, styleSelectionValue };
+ return {{ weightSelectionValue, stretchSelectionValue, styleSelectionValue }};
}
static HashSet<UChar32> codePointsFromString(StringView stringView)
@@ -344,7 +347,10 @@
if (parseResult == CSSParser::ParseResult::Error)
return Exception { SyntaxError };
- FontSelectionRequest request = computeFontSelectionRequest(style.get());
+ auto requestOrException = computeFontSelectionRequest(style.get());
+ if (requestOrException.hasException())
+ return requestOrException.releaseException();
+ auto request = requestOrException.releaseReturnValue();
auto family = style->getPropertyCSSValue(CSSPropertyFontFamily);
if (!is<CSSValueList>(family))