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 /toolkit/components/windowwatcher/test/test_storage_copied.html | |
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 'toolkit/components/windowwatcher/test/test_storage_copied.html')
-rw-r--r-- | toolkit/components/windowwatcher/test/test_storage_copied.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/toolkit/components/windowwatcher/test/test_storage_copied.html b/toolkit/components/windowwatcher/test/test_storage_copied.html new file mode 100644 index 0000000000..de05cd6855 --- /dev/null +++ b/toolkit/components/windowwatcher/test/test_storage_copied.html @@ -0,0 +1,43 @@ +<!DOCTYPE HTML> +<html> +<!-- +Test sessionStorage is copied over when a new window opens to the +same domain as the opener. +--> +<head> + <meta charset="utf-8"> + <title>Test storage copied</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="head.js" type="application/javascript"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> + <script type="application/javascript"> + "use strict"; + + function waitForMessage(win) { + return new Promise(resolve => { + win.addEventListener("message", function(event) { + resolve(event.data); + }, {once: true}); + }); + } + + add_task(async function() { + const TEST_VALUE = "test-value"; + // This magic value of 2 means that by default, when content tries + // to open a new window, it'll actually open in a new window instead + // of a new tab. + await SpecialPowers.pushPrefEnv({"set": [ + ["browser.link.open_newwindow", 2], + ]}); + + window.sessionStorage.setItem("test-item", TEST_VALUE); + let win = window.open("file_storage_copied.html", "my_window"); + let data = await waitForMessage(win); + is(data, TEST_VALUE, "Should have cloned the test value"); + win.close(); + }); + </script> +</body> +</html> |