Skip to content

Commit 88134a7

Browse files
committed
[css-font-loading] Move source argument parsing to the sync section, when it's a string.
1 parent 49d4d88 commit 88134a7

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,14 @@ The Constructor</h3>
213213
Parse the {{family!!argument}} argument,
214214
and the members of the {{descriptors!!argument}} argument,
215215
according to the grammars of the corresponding descriptors of the CSS ''@font-face'' rule.
216+
If the {{source!!argument}} argument is a {{DOMString}},
217+
parse it according to the grammar of the CSS ''@font-face/src'' descriptor of the ''@font-face'' rule.
216218
If any of them fail to parse correctly,
217219
reject <var>font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError",
218220
set <var>font face’s</var> corresponding attributes to the empty string,
219221
and set <var>font face’s</var> {{FontFace/status}} attribute to "error".
220222
Otherwise, set <var>font face's</var> corresponding attributes to the serialization of the parsed values.
221223

222-
Return <var>font face</var>.
223-
If <var>font face’s</var> {{FontFace/status}} is "error",
224-
terminate this algorithm;
225-
otherwise,
226-
complete the rest of these steps asynchronously.
227-
228-
2. If the {{source!!argument}} argument was a {{DOMString}},
229-
parse it according to the grammar of the 'src' descriptor of the CSS ''@font-face'' rule.
230-
If it fails to parse correctly,
231-
queue a task to set <var>font face’s</var> {{FontFace/status}} attribute to "error"
232-
and reject <var>font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError" exception,
233-
and abort these steps;
234-
otherwise, set <var>font face's</var> internal {{[[Urls]]}} slot to the string.
235-
236224
Note: Note that this means that passing a naked url as the source argument,
237225
like <code>"http://example.com/myFont.woff"</code>,
238226
won't work - it needs to be at least wrapped in a ''url()'' function,
@@ -249,6 +237,15 @@ The Constructor</h3>
249237
or should they use their worker url?
250238
Is that always defined?
251239

240+
Return <var>font face</var>.
241+
If <var>font face’s</var> {{FontFace/status}} is "error",
242+
terminate this algorithm;
243+
otherwise,
244+
complete the rest of these steps asynchronously.
245+
246+
2. If the {{source!!argument}} argument was a {{DOMString}},
247+
set <var>font face's</var> internal {{[[Urls]]}} slot to the string.
248+
252249
If the {{source}} argument was a {{BinaryData}},
253250
set <var>font face's</var> internal {{[[Data]]}} slot to the passed argument.
254251

0 commit comments

Comments
 (0)