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 /dom/tests/mochitest/dom-level0/test_background_loading_iframes.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.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 'dom/tests/mochitest/dom-level0/test_background_loading_iframes.html')
-rw-r--r-- | dom/tests/mochitest/dom-level0/test_background_loading_iframes.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html b/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html new file mode 100644 index 0000000000..62488557ec --- /dev/null +++ b/dom/tests/mochitest/dom-level0/test_background_loading_iframes.html @@ -0,0 +1,69 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for background loading iframes</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"></p> +<pre id="test"> + +<script class="testbody" type="text/javascript"> +SimpleTest.waitForExplicitFinish(); + +var myLoadTime; +var receivedPostMessage = []; + +window.addEventListener('message', function(event) { + receivedPostMessage.push(parseInt(event.data)); + if (receivedPostMessage.length == 3) { + if (!myLoadTime){ + ok(false, "Child iframes are loaded earlier than the parent document"); + } else { + receivedPostMessage.forEach(function(iframeLoadTime, index) { + ok(iframeLoadTime, "Iframe load time should not be null"); + ok(iframeLoadTime >= myLoadTime, "Parent document should be loaded earlier than child iframes"); + }) + } + SimpleTest.finish(); + } +}) + +window.onload = function() { + myLoadTime = performance.now(); +} + +SpecialPowers.pushPrefEnv({"set":[["dom.background_loading_iframe", true]]}).then(async function () { + await SpecialPowers.promiseTimeout(0); + + var iframe1 = document.createElement("iframe"); + var iframe2 = document.createElement("iframe"); + var iframe3 = document.createElement("iframe"); + + iframe1.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html"; + iframe2.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html"; + iframe3.src = "http://example.org:80/tests/dom/tests/mochitest/dom-level0/file_test_background_loading_iframes.html"; + + iframe1.onload = function() { + iframe1.contentWindow.postMessage("test", "*"); + } + + iframe2.onload = function() { + iframe2.contentWindow.postMessage("test", "*"); + } + + iframe3.onload = function() { + iframe3.contentWindow.postMessage("test", "*"); + } + + document.body.append(iframe1); + document.body.append(iframe2); + document.body.append(iframe3); + +}); + +</script> +</pre> +</body> +</html> |