summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html b/gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html
new file mode 100644
index 0000000000..edf3ad4728
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_wide_crossorigin_iframe_child.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html id="helper_wide_crossorigin_iframe_child_docelement">
+<meta charset=utf-8>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="apz_test_utils.js"></script>
+ <script src="apz_test_native_event_utils.js"></script>
+<style>
+html {
+ border: 5px solid lime;
+ background: yellow;
+ box-sizing: border-box;
+ overflow-y: scroll;
+}
+</style>
+<script>
+ // negative means keep sending forever
+ // we flip this to 10 when we hit onload, so that we send several
+ // before load and some after.
+ let numMoreTimesToSend = -1;
+ function sendDpToParent() {
+ if (numMoreTimesToSend > 0) {
+ numMoreTimesToSend--;
+ }
+ if (numMoreTimesToSend == 0) {
+ clearInterval(intervalId);
+ parent.postMessage("wereDone", "*");
+ return;
+ }
+ let dp = getLastContentDisplayportFor("helper_wide_crossorigin_iframe_child_docelement", /* expectPainted = */ false);
+ if (dp != null) {
+ info("result " + dp.x + " " + dp.y + " " + dp.width + " " + dp.height);
+
+ parent.postMessage(dp, "*");
+ } else {
+ info("no dp yet");
+ }
+ }
+
+ sendDpToParent();
+ setTimeout(sendDpToParent,0);
+
+ let intervalId = setInterval(sendDpToParent, 100);
+
+ addEventListener("MozAfterPaint", sendAndSetTimeout);
+ function sendAndSetTimeout() {
+ sendDpToParent();
+ setTimeout(sendDpToParent,0);
+ }
+
+ window.requestAnimationFrame(checkAndSendRaf);
+ function checkAndSendRaf() {
+ if (numMoreTimesToSend != 0) {
+ window.requestAnimationFrame(checkAndSendRaf);
+ }
+ sendDpToParent();
+ setTimeout(sendDpToParent,0);
+ }
+
+ window.onload = onloaded;
+ window.onDOMContentLoaded = sendDpToParent;
+ document.onreadystatechange = sendDpToParent;
+ document.onafterscriptexecute = sendDpToParent;
+ document.onbeforescriptexecute = sendDpToParent;
+ document.onvisibilitychange = sendDpToParent;
+ function onloaded() {
+ numMoreTimesToSend = 10;
+ sendDpToParent();
+ }
+
+</script>
+<div style="background: blue; height: 400vh;"></div>