summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/css
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/css')
-rw-r--r--testing/web-platform/mozilla/tests/css/bug1833279-001.html38
-rw-r--r--testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html55
-rw-r--r--testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html35
3 files changed, 128 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/css/bug1833279-001.html b/testing/web-platform/mozilla/tests/css/bug1833279-001.html
new file mode 100644
index 0000000000..ecbdf934de
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/bug1833279-001.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<meta charset="utf-8">
+<title>Test for bug 1833279</title>
+<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1833279">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ setup({ single_test: true });
+
+ // The following callback-function gets called twice by our iframe inner-doc:
+ // 1. when the iframe's document finishes printing.
+ // 2. when the iframe's document finishes loading its own <object> child-document.
+ // When those two steps have completed, we're past the situation that would
+ // trigger a fatal assertion when the object document gets cycle-collected.
+ // So at that point we remove our iframe, and (after a rAF tick) trigger a
+ // GC and CC, and then consider the test as having passed if we're still
+ // alive at that point.
+ const MAX_STEPS = 2;
+ let stepsComplete = 0;
+
+ function iframeStepComplete() {
+ stepsComplete++;
+ if (stepsComplete < MAX_STEPS) {
+ return;
+ }
+ requestAnimationFrame(()=> {
+ myIframe.remove();
+ requestAnimationFrame(()=> {
+ SpecialPowers.DOMWindowUtils.garbageCollect();
+ SpecialPowers.DOMWindowUtils.cycleCollect();
+ assert_true(true, "successfully completed without crashing");
+ done();
+ });
+ });
+ }
+</script>
+<iframe id="myIframe" src="resources/bug1833279-iframe.html"></iframe>
diff --git a/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html b/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html
new file mode 100644
index 0000000000..1b64e43a1d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/css-contain/content-visibility/content-visibility-auto-relevancy-updates-stop-ticking-002.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Content Visibility: stop ticking after relevancy updates</title>
+<!--
+ Adapted from testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-intrinsic-size-001.html
+-->
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1880928">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/rendering-utils.js"></script>
+
+<style>
+ #container {
+ position: sticky;
+ }
+ #container > div {
+ content-visibility: auto;
+ contain-intrinsic-size: 1px 5000px;
+ }
+</style>
+<div id="container">
+ <div>X</div>
+ <div id="target">XX</div>
+ <div>XXX</div>
+ <div>XXXX</div>
+</div>
+<script>
+ target.scrollIntoView();
+</script>
+
+<script>
+function hasPendingTick() {
+ return SpecialPowers.wrap(window).windowUtils.refreshDriverHasPendingTick;
+}
+
+// See comment in layout/base/tests/test_bug1756118.html about why the timeouts
+// etc.
+async function expectTicksToStop() {
+ for (let i = 0; i < 100; i++) {
+ await new Promise(r => setTimeout(r, 8));
+ if(!hasPendingTick()) {
+ break;
+ }
+ }
+ assert_false(hasPendingTick(), "refresh driver should have eventually stopped ticking");
+}
+
+promise_test(async function(t) {
+ await new Promise(resolve => { window.addEventListener("load", resolve); });
+ await SpecialPowers.pushPrefEnv({'set':
+ [['layout.keep_ticking_after_load_ms', 0]]});
+ await waitForAtLeastOneFrame();
+ await expectTicksToStop();
+});
+</script>
diff --git a/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html b/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html
new file mode 100644
index 0000000000..ac646e75d3
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/css/resources/bug1833279-iframe.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src="foo" type="text/javascript"></script>
+<script>
+// Note: this file gets loaded twice in the course of this test: first, in an
+// iframe hosted in the top-level test; and second, in an <object> inside that
+// iframe's document. (The object element gets created dynamically in the
+// script below.)
+window.onload = () => {
+ // For efficiency: check our window.location, to be sure we only run this
+ // logic in the iframe, and *not* in the <object> that ends up getting loaded
+ // with the same URL plus a "?" at the end:
+ let locationStr = "" + location;
+ if (!locationStr.endsWith("?")) {
+ window.print();
+
+ // Add an object whose location is set to '?' (which means our same
+ // base URL plus a "?" character):
+ let a = document.createElement("object");
+ a.data = "?";
+ document.documentElement.appendChild(a)
+ } else if (parent.parent && parent.parent.iframeStepComplete) {
+ // We're the nested document in the `<object>` tag that was created above.
+ // Signal the outer document (our grandparent) that we've completed the
+ // step of loading this inner object document.
+ parent.parent.iframeStepComplete();
+ }
+}
+
+window.onafterprint = () => {
+ // We've finished printing; signal to our outer document that we've completed
+ // that step.
+ parent.iframeStepComplete();
+}
+</script>