Source/WebCore:
[WebKit-https.git] / LayoutTests / fast / dom / Window / Location / ancestor-origins.html
1 <head>
2     <script src="../../../../resources/js-test-pre.js"></script>
3     <script src="resources/location-tests-functions.js"></script>
4 </head>
5
6 <script>
7
8 self.jsTestIsAsync = true;
9
10 description("Test the Location object's ancestorOrigins property.")
11
12 shouldBeType("window.location.ancestorOrigins", "DOMStringList");
13 shouldBe("window.location.ancestorOrigins.length", "0");
14 shouldBeTrue("window.location.ancestorOrigins === window.location.ancestorOrigins");
15
16 var subframeOrigins;
17
18 window.onmessage = function(event)
19 {
20     subframeOrigins = event.data;
21
22     shouldBe("subframeOrigins.length", "1");
23     shouldBe("subframeOrigins[0]", "'file://'");
24
25     finishJSTest();
26 }
27
28 </script>
29 <iframe srcdoc="
30   <script>
31     var origins = [];
32     for (var i = 0; i < location.ancestorOrigins.length; ++i) {
33         origins.push(location.ancestorOrigins.item(i));
34     }
35     top.postMessage(origins, '*')
36   </script>
37 "></iframe>
38 <script src="../../../../resources/js-test-post.js"></script>