forked from kdashg/gecko-cinn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1931981 [wpt PR 49240] - Put timing values of DocumentTiming in a…
… GCed object, a=testonly Automatic update from web-platform-tests Put timing values of DocumentTiming in a GCed object So they can outlive the document, and PerformanceNavigationTiming can collect them. Bug: 40793421 Change-Id: I2cbb53862ff9fab08f963d9408ef65ff462e5dd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5935276 Reviewed-by: David Baron <[email protected]> Commit-Queue: Guohui Deng <[email protected]> Reviewed-by: Noam Rosenthal <[email protected]> Cr-Commit-Position: refs/heads/main@{#1384608} -- wpt-commits: d639d949a473d412a3557eab71eba43a58420f3f wpt-pr: 49240
- Loading branch information
1 parent
22dbe62
commit 4f8b7d5
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
testing/web-platform/tests/navigation-timing/nav2-test-timing-persistent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset=utf-8> | ||
<title>PerformanceNavigationTiming timing remains after iframe removed</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
const timingAttributes = [ | ||
'domComplete', | ||
'domContentLoadedEventEnd', | ||
'domContentLoadedEventStart', | ||
'domInteractive', | ||
]; | ||
function verify_timing(pnt, description) { | ||
for (const att of timingAttributes) { | ||
assert_greater_than(pnt[att], 0, `${description} ${att}`); | ||
} | ||
} | ||
|
||
promise_test(async function (t) { | ||
const iframe = document.createElement("iframe"); | ||
document.body.appendChild(iframe); | ||
|
||
iframe.src = "resources/blank_page_green.html"; | ||
await new Promise(resolve => { | ||
iframe.onload = function () { | ||
assert_equals(iframe.contentWindow.performance.getEntriesByType("navigation").length, 1, "Only one navigation time entry"); | ||
const pnt = iframe.contentWindow.performance.getEntriesByType("navigation")[0]; | ||
assert_equals(pnt.name, iframe.contentWindow.location.toString(), "navigation name matches the window.location"); | ||
assert_true(pnt.name.endsWith("blank_page_green.html"), "navigation name is blank_page_green.html"); | ||
verify_timing(pnt, "timing values should be positive number:"); | ||
iframe.remove(); | ||
verify_timing(pnt, "timing values should remain positive after iframe is removed:"); | ||
resolve(); | ||
} | ||
}); | ||
|
||
}, "iframe navigation times are persistent after the iframe is removed."); | ||
</script> | ||
</body> | ||
|
||
</html> |