blob: bfe834dbb95c4404eb526fcb250051eef0be9032 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<script>
jsTestIsAsync = true;
description('Test usage of document.currentScript with async')
var seenIds = [];
function logCurrentScript(id) {
// Don't print anything if pass since the execution order of script[async]
// is non deterministic.
if (id !== document.currentScript.id)
shouldBeEqualToString('document.currentScript.id', id);
seenIds.push(document.currentScript.id);
seenIds.sort();
if (seenIds.join('') === expectedIds)
finishJSTest();
}
var expectedIds = 'abcdef';
</script>
<script id="a">
logCurrentScript('a');
</script>
<script id="b" async src="resources/log-current-script-b.js"></script>
<script id="c">
logCurrentScript('c');
</script>
<script id="d" async src="resources/log-current-script-d.js"></script>
<script id="e">
logCurrentScript('e');
var script = document.createElement('script');
script.id = 'f'
script.async = true;
script.defer = false;
script.src = 'resources/log-current-script-f.js';
document.head.appendChild(script);
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>