Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: LayoutTests/fast/dom/Document/document-current-script-async.html

Issue 14852011: Implement document.currentScript (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>
+

Powered by Google App Engine
This is Rietveld 408576698