diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html | |
parent | Initial commit. (diff) | |
download | firefox-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 'testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html new file mode 100644 index 0000000000..eed3644650 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/image-loading-lazy-in-cross-origin-iframe-001.sub.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<head> +<title>A below-viewport loading=lazy image in a cross origin iframe loads only + when scrolled into viewport</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/urls-and-fetching.html#lazy-loading-attributes"> +<link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org"> +<link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.com"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> +</head> + +<iframe id="iframe" width="500px" height="500px"></iframe> + +<script> +promise_test(t => { + iframe.src = + get_host_info().HTTP_NOTSAMESITE_ORIGIN + + new URL("resources/", self.location).pathname + + "image-loading-lazy-below-viewport.html"; + + // Wait for the frame to report that its window load event fired. + return new Promise(resolve => { + window.addEventListener("message", + event => resolve(event.data), {once: true}); + }).then(iframe_message => { + assert_equals(iframe_message, "window_loaded", + "The loading=lazy image should not block the iframe's load " + + "event"); + + // Tell the iframe to scroll the image element into view. + frames[0].postMessage("scroll", "*"); + + return new Promise(resolve => { + window.addEventListener("message", event => resolve(event.data)); + }); + }).then(iframe_message => { + assert_equals(iframe_message, "image_loaded", + "The below-viewport loading=lazy image should load only " + + "once scrolled into the viewport"); + + }); // new Promise(); +}); // promise_test. +</script> |