OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../js/resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 description("This test ensures each import and master is in same JS context."); |
| 9 |
| 10 var stringInImport = "Import"; |
| 11 shouldBe("stringInMaster.__proto__", "stringInImport.__proto__"); |
| 12 |
| 13 var thisDocument = document.currentScript.ownerDocument; |
| 14 shouldBeTrue("thisDocument !== document"); |
| 15 shouldBe("thisDocument.__proto__", "document.__proto__"); |
| 16 shouldBe("thisDocument.head.__proto__", "document.head.__proto__"); |
| 17 |
| 18 // The import doesn't have its own window. |
| 19 shouldBeNull("thisDocument.defaultView"); |
| 20 |
| 21 // Since the construcdtor belongs to master's window, its owner document is the
master |
| 22 shouldBe("(new Image()).ownerDocument", "document"); |
| 23 |
| 24 // With createElement(), we know who is the owner. |
| 25 shouldBe("thisDocument.createElement('div').ownerDocument", "thisDocument"); |
| 26 shouldBe("document.createElement('div').ownerDocument", "document"); |
| 27 |
| 28 </script> |
| 29 <script src="../../../js/resources/js-test-post.js"></script> |
| 30 </body> |
| 31 </html> |
OLD | NEW |