new FontFace('x 2y', 'url(abc.woff2)') throws an exception in Safari 12.2 but not in Chrome or Firefox.
Huh, Blink doesn't seem to do any validation for the font name at all :(
Oh, it's because there's a space in there.
This is because of the historical difference between font-family:foo; and font-family:”foo”;
FontFace::parseString() is passing its argument directly to consumeFontFamilyDescriptor() in CSSPropertyParser.cpp, which parses the string according to the first form. The first form doesn’t allow spaces.
We should adopt the Chrome/Firefox behavior, and the spec should be clarified here.
Created attachment 366004 [details]
In Chrome & Firefox, this file would say "OK". In WebKit, it does not.
Relevant spec text:
> 1. ...
> Parse the family argument, and the members of the descriptors argument, according to > the grammars of the corresponding descriptors of the CSS @font-face rule
> Font family names other than generic families must either be given quoted as <string>s, or unquoted as a sequence of one or more identifiers.
> If a sequence of identifiers is given as a <family-name>, the computed value is the name converted to a string by joining all the identifiers in the sequence by single spaces.
We probably need to amend the following text for FontFace constructor:
> If any of them fail to parse correctly, reject font face’s [[FontStatusPromise]] with a DOMException named "SyntaxError", set font face’s corresponding attributes to the empty string, and set font face’s status attribute to "error". Otherwise, set font face’s corresponding attributes to the serialization of the parsed values.
Created attachment 366226 [details]
Comment on attachment 366226 [details]
Clearing flags on attachment: 366226
Committed r243637: <https://trac.webkit.org/changeset/243637>
All reviewed patches have been landed. Closing bug.