summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/resources/parent-frame-with-cross-origin-child.sub.html
blob: 4be0df872cbfd22dfcbd6b4e8e9005a7a79e88ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<head></head>
<body></body>
<script>
    // Create child frame that is cross-origin with its parent.
    const childFrame = document.createElement('iframe')
    childFrame.src = "http://{{hosts[][]}}:{{ports[http][0]}}/performance-timeline/resources/child-frame.html"
    document.body.appendChild(childFrame)

    performance.mark("entry-name")

    childFrame.addEventListener('load', () => {
        const entries = performance.getEntries(true)
        window.parent.postMessage(entries.length, "*")
    })
</script>