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-iframe-element/iframe-loading-lazy-multiple-queued-navigations.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-iframe-element/iframe-loading-lazy-multiple-queued-navigations.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-multiple-queued-navigations.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-multiple-queued-navigations.html b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-multiple-queued-navigations.html new file mode 100644 index 0000000000..0569881ea5 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-multiple-queued-navigations.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<head> + <title>Multiple queued lazy load navigations do not crash the page</title> + <link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org"> + <link rel="help" href="https://html.spec.whatwg.org/multipage/urls-and-fetching.html#lazy-loading-attributes"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> + +<script> + const t = async_test('Multiple queued lazy load navigations do not crash ' + + 'the page'); + + let has_below_viewport_loaded = false; + + window.addEventListener("load", t.step_func(() => { + assert_false(has_below_viewport_loaded, + "The below_viewport element should not have loaded before " + + "window.load()."); + + // Queue another lazy load navigation on the iframe. This should not result + // in multiple internal intersection observers being created for the iframe + // element, but instead should result in only one intersection observer + // associated with the iframe element, and the resulting navigation should + // be for the latest `src` attribute mutation. + const target = document.querySelector('#below_viewport'); + target.src = 'resources/subframe.html?new-src'; + target.scrollIntoView(); + })); + + const below_viewport_iframe_onload = t.step_func_done(() => { + const target = document.querySelector('#below_viewport'); + // We check both of these to ensure that the `src` attribute and actual + // navigated resource do not get out-of-sync when navigating to lazy loaded + // resources. + assert_true( + target.src.includes('new-src'), + "The iframe's src should be updated to reflect the latest `src` " + + "mutation"); + assert_true( + target.contentDocument.location.href.includes('new-src'), + 'The iframe should be navigated to the resource provided by the latest ' + + '`src` mutation'); + }); +</script> + +<body> + <div style="height:3000vh;"></div> + <iframe id="below_viewport" src="resources/subframe.html?old-src" + loading="lazy" width="200px" height="100px" + onload="below_viewport_iframe_onload();"></iframe> +</body> |