blob: 2e88a8ff4b7573050d0486fa04cfb81f4b97a0f8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<script>
description('This tests the order by which tasks are scheduled across documents that are not similar origins.');
if (!window.internals)
testFailed('This test relies on window.internals');
else {
jsTestIsAsync = true;
window.onload = startTest;
}
logs = [];
crossOriginLogs = [];
async function startTest()
{
window.frame1 = document.createElement('iframe');
frame1.src = 'http://127.0.0.1:8000/eventloop/resources/eventloop-helper.html';
document.body.appendChild(frame1);
window.frame2 = document.createElement('iframe');
frame2.src = 'https://127.0.0.1:8443/eventloop/resources/eventloop-helper.html';
document.body.appendChild(frame2);
await waitForLoad(frame1);
await waitForLoad(frame2);
shouldBeTrue('internals.hasSameEventLoopAs(frame1.contentWindow)');
shouldBeFalse('internals.hasSameEventLoopAs(frame2.contentWindow)');
finishJSTest();
}
const loadedFrames = new Map;
onmessage = (event) => {
if (event.data.type == 'load') {
const resolve = loadedFrames.get(event.source);
if (resolve)
resolve();
else
loadedFrames.set(event.source, null);
}
}
function waitForLoad(frame)
{
if (loadedFrames.has(frame.contentWindow))
return Promise.resolve();
return new Promise((resolve) => loadedFrames.set(frame.contentWindow, resolve));
}
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>