Index: LayoutTests/fast/dom/Document/document-current-script-async.html |
diff --git a/LayoutTests/fast/dom/Document/document-current-script-async.html b/LayoutTests/fast/dom/Document/document-current-script-async.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d031b65fa220f2c4974402102048eaab75e048e |
--- /dev/null |
+++ b/LayoutTests/fast/dom/Document/document-current-script-async.html |
@@ -0,0 +1,49 @@ |
+<!DOCTYPE html> |
+<script src="../../js/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="../../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |
+ |