blob: b1bc191be2b540528ced6bdd894bea25e3d55573 [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 of file URI documents.');
if (!window.internals)
testFailed('This test relies on window.internals');
else {
jsTestIsAsync = true;
logs = [];
frame1 = document.createElement('iframe');
document.body.appendChild(frame1);
frame2 = document.createElement('iframe');
frame2.src = 'resources/eventloop-helper.html';
frame2.addEventListener('load', runTest);
document.body.appendChild(frame2);
}
function runTest() {
internals.queueTask("DOMManipulation", () => logs.push('1'));
frame1.contentWindow.internals.queueTask("DOMManipulation", () => logs.push('2'));
internals.queueTask("DOMManipulation", () => logs.push('3'));
frame2.contentWindow.internals.queueTask("DOMManipulation", () => logs.push('4'));
frame1.contentWindow.internals.queueTask("DOMManipulation", () => logs.push('5'));
internals.queueTask("DOMManipulation", () => logs.push('6'));
setTimeout(() => {
shouldBeEqualToString('logs.join(", ")', '1, 2, 3, 4, 5, 6');
shouldBeTrue('internals.hasSameEventLoopAs(frame1.contentWindow)');
shouldBeTrue('internals.hasSameEventLoopAs(frame2.contentWindow)');
finishJSTest();
}, 100);
}
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>