node/test/fixtures/wpt/resource-timing/resource_subframe_self_navigation.html
legendecas 364c0e196c
perf_hooks: fix webperf idlharness
1. Enforce receiver checks on IDL interfaces.
2. Avoid prototype manipulation on constructing IDL interfaces with
   `ReflectConstruct`.
3. `defineReplaceableAttribute` should create IDL getter/setter.
4. Corrected `PerformanceResourceTiming` to inherit the public interface
   `PerformanceEntry` instead of the internal interface
   `InternalPerformanceResourceTiming`.
5. `detail` is not a specified attribute on `PerfomanceEntry`. Node.js
   specific extensions are moved to a subclass of `PerformanceEntry` as
   `PerformanceNodeEntry`.

PR-URL: https://github.com/nodejs/node/pull/44483
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-04 00:55:58 +08:00

53 lines
1.6 KiB
HTML

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
function numberOfDownloads(url) {
let absoluteURL = new URL(url, location.href).href;
return performance.getEntriesByName(absoluteURL).length;
}
function waitForSubFrameLoad() {
return new Promise((resolve) => {
window.subFrameLoaded = () => {
window.subFrameLoaded = null;
resolve();
};
});
}
function runTest(type) {
performance.clearResourceTimings();
let elem = document.createElement(type);
if (type === 'object')
elem.data = 'resources/self_navigation.html?' + type;
else
elem.src = 'resources/self_navigation.html?' + type;
document.body.appendChild(elem);
return waitForSubFrameLoad().then(() => {
let resources = performance.getEntriesByType('resource');
assert_equals(numberOfDownloads('resources/self_navigation.html?' + type), 1);
assert_equals(numberOfDownloads('resources/notify_parent.html?redirected'), 0);
document.body.removeChild(elem);
});
}
promise_test(
() => runTest('iframe'),
"Subsequent <iframe> navigations don't appear in the resource-timing buffer.");
promise_test(
() => runTest('frame'),
"Subsequent <frame> navigations don't appear in the resource-timing buffer.");
promise_test(
() => runTest('embed'),
"Subsequent <embed> navigations don't appear in the resource-timing buffer.");
promise_test(
() => runTest('object'),
"Subsequent <object> navigations don't appear in the resource-timing buffer.");
</script>
</body>