From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/browser/browser_findbar_hiddenframes.js | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 toolkit/content/tests/browser/browser_findbar_hiddenframes.js (limited to 'toolkit/content/tests/browser/browser_findbar_hiddenframes.js') diff --git a/toolkit/content/tests/browser/browser_findbar_hiddenframes.js b/toolkit/content/tests/browser/browser_findbar_hiddenframes.js new file mode 100644 index 0000000000..f0f4131464 --- /dev/null +++ b/toolkit/content/tests/browser/browser_findbar_hiddenframes.js @@ -0,0 +1,59 @@ +const TEST_PAGE = "https://example.com/document-builder.sjs?html="; + +let content = + ""; + +async function doAndCheckFind(bc, text) { + await promiseFindFinished(gBrowser, text, false); + + let foundText = await SpecialPowers.spawn(bc, [], () => { + return content.getSelection().toString(); + }); + is(foundText, text, text + " is found"); +} + +// This test verifies that find continues to work when a find begins and the frame +// is hidden during the next find step. +add_task(async function test_frame() { + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + TEST_PAGE + content + ); + let browser = gBrowser.getBrowserForTab(tab); + + let findbar = await gBrowser.getFindBar(); + + await doAndCheckFind(browser.browsingContext.children[0], "This"); + + await SpecialPowers.spawn(browser, [], () => { + content.document.getElementById("a").style.display = "none"; + content.document.getElementById("a").getBoundingClientRect(); // flush + }); + + await doAndCheckFind(browser.browsingContext.children[1], "another"); + + await SpecialPowers.spawn(browser, [], () => { + content.document.getElementById("a").style.display = ""; + content.document.getElementById("a").getBoundingClientRect(); + }); + + await doAndCheckFind(browser.browsingContext.children[0], "first"); + + await SpecialPowers.spawn(browser, [], () => { + content.document.getElementById("a").style.visibility = "hidden"; + content.document.getElementById("a").getBoundingClientRect(); + }); + + await doAndCheckFind(browser.browsingContext.children[1], "That"); + + await SpecialPowers.spawn(browser, [], () => { + content.document.getElementById("a").style.visibility = ""; + content.document.getElementById("a").getBoundingClientRect(); + }); + + await doAndCheckFind(browser.browsingContext.children[0], "This"); + + await closeFindbarAndWait(findbar); + + gBrowser.removeTab(tab); +}); -- cgit v1.2.3