commit 58b72fcc1b50dddf3e65c41fa37364087859397f
parent d22a498564ad98e4e056fa1e459b16bed0f8f836
Author: Anna Sato <annasato@chromium.org>
Date: Thu, 9 Oct 2025 20:32:58 +0000
Bug 1992146 [wpt PR 55170] - Fix TypeError in assertNotRestoredFromBFCache for Fenced Frames, a=testonly
Automatic update from web-platform-tests
Fix TypeError in assertNotRestoredFromBFCache for Fenced Frames
The assertNotRestoredFromBFCache helper throw a "TypeError: node.reasons
is not iterable" when encountering a Fenced Frame, which can lack a
reasons property. This CL adds a check to handle this case without
errors.
Change-Id: I0a395418d1e0b8c496f4eaa9a1ef9353e6dcdbf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6987587
Reviewed-by: Fergal Daly <fergal@chromium.org>
Auto-Submit: Anna Sato <annasato@chromium.org>
Commit-Queue: Mingyu Lei <leimy@chromium.org>
Reviewed-by: Mingyu Lei <leimy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523358}
--
wpt-commits: c35dc9efb74d48770c378892823f52d0f117ec34
wpt-pr: 55170
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js b/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/resources/rc-helper.js
@@ -110,11 +110,16 @@ async function assertNotRestoredFromBFCache(
// Flatten the reasons from the main frame and all the child frames.
const collectReason = (node) => {
- for (let reason of node.reasons) {
- notRestoredReasonsSet.add(reason.reason);
+ // Fenced frames do not have a 'reasons' or 'children' property.
+ if (node.reasons) {
+ for (let reason of node.reasons) {
+ notRestoredReasonsSet.add(reason.reason);
+ }
}
- for (let child of node.children) {
- collectReason(child);
+ if (node.children) {
+ for (let child of node.children) {
+ collectReason(child);
+ }
}
};
collectReason(result);