summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_import_preload.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /layout/style/test/test_import_preload.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_import_preload.html')
-rw-r--r--layout/style/test/test_import_preload.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/layout/style/test/test_import_preload.html b/layout/style/test/test_import_preload.html
new file mode 100644
index 0000000000..1c095c9768
--- /dev/null
+++ b/layout/style/test/test_import_preload.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<meta charset="utf-8">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+<script src="slow_load.sjs"></script>
+<script>
+ let time = Date.now();
+ SimpleTest.waitForExplicitFinish();
+
+ onload = function() {
+ let styleTime = parseInt(getComputedStyle(document.documentElement).zIndex, 10);
+ isnot(styleTime, 0, "Should apply the @import sheet");
+ ok(!isNaN(styleTime), "Should apply the @import sheet (and not be nan)");
+ // This is technically a bit racy... Also see the comment in slow_load.sjs about the clamping.
+ time = time % (Math.pow(2, 31) - 1);
+ ok(styleTime < time, "Should try to fetch the import before running the script: " + styleTime + " vs. " + time);
+ SimpleTest.finish();
+ }
+</script>
+<style>
+ @import url(slow_load.sjs?css)
+</style>