<!doctype html>
<title>InOrder Script Execution Order</title>
<html>
<head>
<meta charset="utf-8">
<meta name=variant content="?default">
<meta name=variant content="?reload">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/helper.js"></script>
</head>
<body>
<script>
const reload_key = 'run-after-reload';
if (location.search == '?reload' && !window.localStorage.getItem(reload_key)) {
window.localStorage.setItem(reload_key, true);
location.reload();
} else {
window.localStorage.clear();
test();
}
function test() {
setup({ single_test: true });
enableLogDOMContentLoaded();
function finish() {
assert_array_equals(
window.result,
["Inline1", "Sync1", "Inline2", "EndOfBody",
"DOMContentLoaded", "Async1"], "Execution order");
// When ForceInOrder is enabled, the order is following:
// ["Inline1", "Async1", "Sync1", "Inline2",
// "EndOfBody", "DOMContentLoaded"]
done();
}
window.addEventListener("load", finish);
logScript("Inline1");
}
</script>
<!-- Add 1 sec delay to make the loading happens after DOMContentLoaded -->
<script src="../resources/async-script-1.js?pipe=trickle(d1)" async></script>
<script src="../resources/sync-script-1.js"></script>
<script>
logScript("Inline2");
</script>
<pre id="bodyend">End</pre>
</body>
</html>