<!DOCTYPE html> <html> <head> <script src="../../../resources/js-test.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> </body> </html>