diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js')
-rw-r--r-- | layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js b/layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js new file mode 100644 index 0000000000..edf926c4ca --- /dev/null +++ b/layout/base/tests/browser_scroll_into_view_in_out_of_process_iframe.js @@ -0,0 +1,50 @@ +"use strict"; + +add_task(async () => { + function httpURL(filename, host = "https://example.com/") { + let root = getRootDirectory(gTestPath).replace( + "chrome://mochitests/content/", + host + ); + return root + filename; + } + + const fissionWindow = await BrowserTestUtils.openNewBrowserWindow({ + fission: true, + }); + const url = httpURL( + "test_scroll_into_view_in_oopif.html", + "http://mochi.test:8888/" + ); + const crossOriginIframeUrl = httpURL("scroll_into_view_in_child.html"); + + try { + await BrowserTestUtils.withNewTab( + { gBrowser: fissionWindow.gBrowser, url }, + async browser => { + await SpecialPowers.spawn( + browser, + [crossOriginIframeUrl], + async iframeUrl => { + const iframe = content.document.getElementById("iframe"); + iframe.setAttribute("src", iframeUrl); + + // Wait for a scroll event since scrollIntoView for cross origin documents is + // asyncronously processed. + const scroller = content.document.getElementById("scroller"); + await new Promise(resolve => { + scroller.addEventListener("scroll", resolve, { once: true }); + }); + + ok( + scroller.scrollTop > 0, + "scrollIntoView works in a cross origin iframe" + ); + } + ); + } + ); + } finally { + await BrowserTestUtils.closeWindow(fissionWindow); + } +}); |