summaryrefslogtreecommitdiffstats
path: root/layout/generic/test/file_reframe_for_lazy_load_image.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/generic/test/file_reframe_for_lazy_load_image.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/generic/test/file_reframe_for_lazy_load_image.html')
-rw-r--r--layout/generic/test/file_reframe_for_lazy_load_image.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/layout/generic/test/file_reframe_for_lazy_load_image.html b/layout/generic/test/file_reframe_for_lazy_load_image.html
new file mode 100644
index 0000000000..900f212341
--- /dev/null
+++ b/layout/generic/test/file_reframe_for_lazy_load_image.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>
+ Test for bug 1612649: We don't reframe for lazy load image state changes.
+</title>
+<div id="spacer" style="height: calc(100vh + 100px);"></div>
+<img id="image" loading="lazy" width="20" height="20" alt="this is an image"
+ src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC">
+<script>
+const is = opener.is.bind(opener);
+const add_task = opener.add_task;
+const original_finish = opener.SimpleTest.finish;
+const SimpleTest = opener.SimpleTest;
+SimpleTest.finish = function finish() {
+ self.close();
+ original_finish();
+}
+
+const utils = SpecialPowers.DOMWindowUtils;
+
+add_task(async () => {
+ await SimpleTest.promiseFocus();
+
+ const previousConstructCount = utils.framesConstructed;
+
+ const loadPromise = image.complete
+ ? null
+ : new Promise(resolve => image.addEventListener("load", resolve));
+
+ image.scrollIntoView();
+
+ await loadPromise;
+
+ image.getBoundingClientRect();
+
+ is(previousConstructCount, utils.framesConstructed,
+ "We should not have reframed");
+});
+</script>