summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html')
-rw-r--r--testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html b/testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html
new file mode 100644
index 0000000000..1d74f8ed2a
--- /dev/null
+++ b/testing/web-platform/tests/css/css-font-loading/fontfaceset-load-var.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<title>SyntaxError thrown when matching loading values with var()</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('var(--x) serif'));
+ }, 'Loading "var(--x) serif" causes SyntaxError (document)')
+
+ promise_test(test => {
+ return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('var(--x, 10px) serif'));
+ }, 'Loading "var(--x, 10px) serif" causes SyntaxError (document)')
+
+ promise_test(test => {
+ return promise_rejects_dom(test, 'SyntaxError', load_on_worker('var(--x) serif'));
+ }, 'Loading "var(--x) serif" causes SyntaxError (worker)')
+
+ promise_test(test => {
+ return promise_rejects_dom(test, 'SyntaxError', load_on_worker('var(--x, 10px) serif'));
+ }, 'Loading "var(--x, 10px) serif" causes SyntaxError (worker)')
+
+</script>