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

Unified Diff: LayoutTests/fast/html/imports/resources/script-prototype-test.html

Issue 19762002: [HTML Imports] Let script of imported document running. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made a test more robust. Created 7 years, 5 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/html/imports/resources/script-prototype-test.html
diff --git a/LayoutTests/fast/html/imports/resources/script-prototype-test.html b/LayoutTests/fast/html/imports/resources/script-prototype-test.html
new file mode 100644
index 0000000000000000000000000000000000000000..799a4e7e1894c102e811bc86717d0b6d82d382bc
--- /dev/null
+++ b/LayoutTests/fast/html/imports/resources/script-prototype-test.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description("This test ensures each import and master is in same JS context.");
+
+var stringInImport = "Import";
+shouldBe("stringInMaster.__proto__", "stringInImport.__proto__");
+
+var thisDocument = document.currentScript.ownerDocument;
+shouldBeTrue("thisDocument !== document");
+shouldBe("thisDocument.__proto__", "document.__proto__");
+shouldBe("thisDocument.head.__proto__", "document.head.__proto__");
+
+// The import doesn't have its own window.
+shouldBeNull("thisDocument.defaultView");
+
+// Since the construcdtor belongs to master's window, its owner document is the master
+shouldBe("(new Image()).ownerDocument", "document");
+
+// With createElement(), we know who is the owner.
+shouldBe("thisDocument.createElement('div').ownerDocument", "thisDocument");
+shouldBe("document.createElement('div').ownerDocument", "document");
+
+</script>
+<script src="../../../js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698