From a41ecd6b562701b3d2c34b7b0bd26ad50ee00ed5 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 26 Nov 2024 23:08:45 +0000 Subject: [PATCH] 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 Commit-Queue: Guohui Deng Reviewed-by: Noam Rosenthal Cr-Commit-Position: refs/heads/main{#1384608} -- wpt-commits: d639d949a473d412a3557eab71eba43a58420f3f wpt-pr: 49240 UltraBlame original commit: ce191cb10c4d62462deb3f39d1fa9f4f168987f4 --- .../nav2-test-document-replaced.html | 2 +- .../nav2-test-timing-persistent.html | 350 ++++++++++++++++++ 2 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 testing/web-platform/tests/navigation-timing/nav2-test-timing-persistent.html diff --git a/testing/web-platform/tests/navigation-timing/nav2-test-document-replaced.html b/testing/web-platform/tests/navigation-timing/nav2-test-document-replaced.html index 3a14c97e0c648..e065a214de7b5 100644 --- a/testing/web-platform/tests/navigation-timing/nav2-test-document-replaced.html +++ b/testing/web-platform/tests/navigation-timing/nav2-test-document-replaced.html @@ -339,7 +339,7 @@ validates that a -PerformanceNavigatingTiming +PerformanceNavigationTiming corresponding to a diff --git a/testing/web-platform/tests/navigation-timing/nav2-test-timing-persistent.html b/testing/web-platform/tests/navigation-timing/nav2-test-timing-persistent.html new file mode 100644 index 0000000000000..8a22708772fd3 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/nav2-test-timing-persistent.html @@ -0,0 +1,350 @@ +< +! +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 +>