diff options
Diffstat (limited to 'dom/html/test/test_window_open_from_closing.html')
-rw-r--r-- | dom/html/test/test_window_open_from_closing.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/html/test/test_window_open_from_closing.html b/dom/html/test/test_window_open_from_closing.html new file mode 100644 index 0000000000..0d38c88d84 --- /dev/null +++ b/dom/html/test/test_window_open_from_closing.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> +<head> + <title>window.open from a window being closed</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> + <h1>window.open from a window being closed</h1> +<script> +add_task(async function() { + const RELS = ["", "#noopener", "#opener"]; + const FEATURES = [ + "", + "noopener", + "width=300", + "width=300,noopener", + ]; + + let resolver; + let channel = new BroadcastChannel("test"); + channel.onmessage = function(e) { + info("message from broadcastchannel: " + e.data); + if (e.data == "load") { + resolver(); + } + }; + + for (let rel of RELS) { + for (let feature of FEATURES) { + info(`running test: rel=${rel}, feature=${feature}`); + + let loadPromise = new Promise(r => { resolver = r; }); + window.open("file_window_close_and_open.html" + rel, "_blank", feature); + await loadPromise; + ok(true, "popup opened successfully - closing..."); + channel.postMessage("close"); + } + } +}); +</script> +</body> +</html> |