mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 05:08:36 +02:00
Automatic update from web-platform-tests Don't crash in FontFaceSet::ResolveFontStyle for CSS-wide keywords We were only checking for "initial" and "inherit", which led to crashes for "unset" and "revert", since the FontStyleResolver received unexpected values. Check for CSS-wide keywords using IsCSSWideKeyword instead. This should catch *all* CSS-wide keywords, and make this "point of interest" more discoverable when adding new CSS-wide keywords in the future. Bug: 1067980 Change-Id: Ie2e384ab3239e0bbc001dba67bc840823a82a610 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2137339 Reviewed-by: Dominik Röttsches <drott@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#756637} -- wpt-commits: cbbcc55ef1e20eaeb079419e1bca9fb5956a8a33 wpt-pr: 22717
60 lines
2.3 KiB
HTML
60 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<title>SyntaxError thrown when matching CSS-wide keyword</title>
|
|
<link rel="help" href="https://drafts.csswg.org/css-font-loading/#font-face-set-load">
|
|
<link rel="help" href="https://drafts.csswg.org/css-font-loading/#find-the-matching-font-faces">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
|
|
function load_on_worker(keyword) {
|
|
return new Promise((resolve, reject) =>{
|
|
var blob = new Blob([`
|
|
self.fonts.load('${keyword}').then(
|
|
()=>{ self.postMessage('success') },
|
|
(e)=>{ self.postMessage(e) }
|
|
);
|
|
`]);
|
|
var blob_url = window.URL.createObjectURL(blob);
|
|
let worker = new Worker(blob_url);
|
|
worker.onmessage = msg => {
|
|
if (msg === 'success')
|
|
resolve(msg.data)
|
|
else
|
|
reject(msg.data)
|
|
}
|
|
});
|
|
}
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('initial'));
|
|
}, 'Loading CSS-wide keyword "initial" causes SyntaxError (document)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('inherit'));
|
|
}, 'Loading CSS-wide keyword "inherit" causes SyntaxError (document)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('unset'));
|
|
}, 'Loading CSS-wide keyword "unset" causes SyntaxError (document)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('revert'));
|
|
}, 'Loading CSS-wide keyword "revert" causes SyntaxError (document)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('initial'));
|
|
}, 'Loading CSS-wide keyword "initial" causes SyntaxError (worker)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('inherit'));
|
|
}, 'Loading CSS-wide keyword "inherit" causes SyntaxError (worker)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('unset'));
|
|
}, 'Loading CSS-wide keyword "unset" causes SyntaxError (worker)')
|
|
|
|
promise_test(test => {
|
|
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('revert'));
|
|
}, 'Loading CSS-wide keyword "revert" causes SyntaxError (worker)')
|
|
|
|
</script>
|