blob: 8aa5df778fef3dc18d450377e6a3ec0c3c31a2f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
</body>
<script>
promise_test(() => {
return new Promise(resolve => {
performance.clearResourceTimings()
// Create child iframe with an embedded frame that is cross-origin with its parent, but same-origin with the current frame.
const crossOriginChildFrame = document.createElement('iframe')
crossOriginChildFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/performance-timeline/resources/parent-frame-with-cross-origin-child.sub.html"
document.body.appendChild(crossOriginChildFrame)
// Listen for postMessage() from grandchild frame.
window.addEventListener("message", () => {
const entries = performance.getEntries(true)
const navigationEntries = performance.getEntriesByType("navigation", true)
const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
// 3 entries for parent, 0 for child, 2 for grandchild.
assert_equals(entries.length, 5)
// 1 entry for parent, 1 for grandchild.
assert_equals(navigationEntries.length, 2)
// 1 entry for grandchild.
assert_equals(markedEntries.length, 1)
resolve()
})
})
}, "GetEntries of a parent Frame with one Cross-Origin child and one Same-Origin grandchild")
</script>
|