|
| 1 | +<!DOCTYPE HTML> |
| 2 | +<html> |
| 3 | + |
| 4 | +<head> |
| 5 | + <meta charset=utf-8> |
| 6 | + <title>PerformanceNavigationTiming timing remains after iframe removed</title> |
| 7 | + <script src="/resources/testharness.js"></script> |
| 8 | + <script src="/resources/testharnessreport.js"></script> |
| 9 | +</head> |
| 10 | + |
| 11 | +<body> |
| 12 | + <script> |
| 13 | + const timingAttributes = [ |
| 14 | + 'domComplete', |
| 15 | + 'domContentLoadedEventEnd', |
| 16 | + 'domContentLoadedEventStart', |
| 17 | + 'domInteractive', |
| 18 | + ]; |
| 19 | + function verify_timing(pnt, description) { |
| 20 | + for (const att of timingAttributes) { |
| 21 | + assert_greater_than(pnt[att], 0, `${description} ${att}`); |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + promise_test(async function (t) { |
| 26 | + const iframe = document.createElement("iframe"); |
| 27 | + document.body.appendChild(iframe); |
| 28 | + |
| 29 | + iframe.src = "resources/blank_page_green.html"; |
| 30 | + await new Promise(resolve => { |
| 31 | + iframe.onload = function () { |
| 32 | + assert_equals(iframe.contentWindow.performance.getEntriesByType("navigation").length, 1, "Only one navigation time entry"); |
| 33 | + const pnt = iframe.contentWindow.performance.getEntriesByType("navigation")[0]; |
| 34 | + assert_equals(pnt.name, iframe.contentWindow.location.toString(), "navigation name matches the window.location"); |
| 35 | + assert_true(pnt.name.endsWith("blank_page_green.html"), "navigation name is blank_page_green.html"); |
| 36 | + verify_timing(pnt, "timing values should be positive number:"); |
| 37 | + iframe.remove(); |
| 38 | + verify_timing(pnt, "timing values should remain positive after iframe is removed:"); |
| 39 | + resolve(); |
| 40 | + } |
| 41 | + }); |
| 42 | + |
| 43 | + }, "iframe navigation times are persistent after the iframe is removed."); |
| 44 | + </script> |
| 45 | +</body> |
| 46 | + |
| 47 | +</html> |
0 commit comments