Index: LayoutTests/fast/html/imports/import-script.html |
diff --git a/LayoutTests/fast/html/imports/import-script.html b/LayoutTests/fast/html/imports/import-script.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c5d588c8ea21730cb731f6930d72e80b169d4986 |
--- /dev/null |
+++ b/LayoutTests/fast/html/imports/import-script.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../js/resources/js-test-pre.js"></script> |
+<script> |
+var loadedScripts = []; |
+var numLoaded = 0; |
+var labels = ["InlineParser", "InlineDynamic", "ExternalParser", "ExternalDynamic", "ExternalAsync"].sort(); |
+ |
+document.notifyLoaded = function(label, doc) |
+{ |
+ givenDocument = doc; |
+ shouldBe("givenDocument", "document"); |
+ shouldBe("givenDocument.currentScript.ownerDocument", "leaf.import"); |
+ |
+ loadedScripts.push({ label: label, document: document, script: document.currentScript, order: numLoaded++ }); |
+ if (labels.length != numLoaded) |
+ return; |
+ |
+ loadedLabels = loadedScripts.map(function(o) { return o.label; }).sort(); |
+ shouldBe("labels", "loadedLabels"); |
+ |
+ finishJSTest(); |
+}; |
+</script> |
+<link id="leaf" rel="import" href="resources/script-leaf.html"> |
+</head> |
+<body> |
+<script> |
+description("Test that scripts in imported documents are executed"); |
+window.jsTestIsAsync = true; |
+ |
+var dynamicallyInsertedInlineScript = leaf.import.createElement("script"); |
+dynamicallyInsertedInlineScript.innerHTML = "document.notifyLoaded('InlineDynamic', document);" |
+leaf.import.body.appendChild(dynamicallyInsertedInlineScript); |
+ |
+var dynamicallyInsertedExternalScript = leaf.import.createElement("script"); |
+dynamicallyInsertedExternalScript.setAttribute("src", "script-leaf-external-dynamic.js"); |
+leaf.import.body.appendChild(dynamicallyInsertedExternalScript); |
+</script> |
+<script src="../../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |