node/test/fixtures/wpt/performance-timeline/tentative/performance-entry-source.html
RedYetiDev 1aa71351fa
test: update performance-timeline wpt
PR-URL: https://github.com/nodejs/node/pull/55197
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2024-11-06 10:59:52 +01:00

37 lines
1.1 KiB
HTML

<!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 => {
const navigationEntries = performance.getEntries({ type: 'navigation' })
const parentEntry = navigationEntries[0]
// Parent NavigationTiming source is current window.
assert_equals(parentEntry.source, window)
// Create child iframe.
const childFrame = document.createElement('iframe')
childFrame.src = "../resources/child-frame.html"
document.body.appendChild(childFrame)
childFrame.addEventListener('load', () => {
const markedEntries = performance.getEntries(
{ name: 'mark_child_frame', includeChildFrames: true });
const childEntry = markedEntries[0]
// Child PerformanceMark source is the child's Window.
assert_equals(childEntry.source, childFrame.contentWindow)
resolve()
})
})
}, "PerformanceEntry source is equal to its respective Window")
</script>