diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/sessionstore/test/browser_restore_srcdoc.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/sessionstore/test/browser_restore_srcdoc.js')
-rw-r--r-- | browser/components/sessionstore/test/browser_restore_srcdoc.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/browser/components/sessionstore/test/browser_restore_srcdoc.js b/browser/components/sessionstore/test/browser_restore_srcdoc.js new file mode 100644 index 0000000000..9e670100ea --- /dev/null +++ b/browser/components/sessionstore/test/browser_restore_srcdoc.js @@ -0,0 +1,44 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +function makeURL(srcdocValue) { + return `data:text/html;charset=utf-8,<iframe srcdoc="${srcdocValue}">`; +} + +async function runTest(srcdocValue) { + forgetClosedWindows(); + + // Open a new tab. + let tab = BrowserTestUtils.addTab(gBrowser, makeURL(srcdocValue)); + await promiseBrowserLoaded(tab.linkedBrowser); + + // Close that tab. + await promiseRemoveTabAndSessionState(tab); + + // Restore that tab. + tab = ss.undoCloseTab(window, 0); + await promiseTabRestored(tab); + + // Verify contents were restored correctly. + let iframe = await SpecialPowers.spawn( + tab.linkedBrowser, + [], + () => content.document.querySelector("iframe").browsingContext + ); + await SpecialPowers.spawn(iframe, [srcdocValue], text => { + Assert.equal(content.document.body.innerText, text, "Didn't load neterror"); + }); + + // Cleanup. + gBrowser.removeTab(tab); +} + +add_task(async function test_non_blank() { + await runTest("value"); +}); + +add_task(async function test_blank() { + await runTest(""); +}); |