From 61fea366043710532e22e3b9d74725acafd15885 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Wed, 12 Jun 2024 17:40:41 -0500 Subject: [PATCH] [PM-5189] Implementing a set threshold for the maximum depth for which we are willing to calculate sub frame offsets --- apps/browser/src/autofill/background/overlay.background.ts | 2 +- apps/browser/src/autofill/enums/autofill-overlay.enum.ts | 2 +- .../src/autofill/services/autofill-overlay-content.service.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index f4778c22a9..fee2d21f74 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -1073,7 +1073,7 @@ export class OverlayBackground implements OverlayBackgroundInterface { const parentFrameIds = new Set(); subFrameOffsetsForTab.forEach((subFrameOffsetData) => - subFrameOffsetData.parentFrameIds.forEach((parentFrameId) => + subFrameOffsetData?.parentFrameIds.forEach((parentFrameId) => parentFrameIds.add(parentFrameId), ), ); diff --git a/apps/browser/src/autofill/enums/autofill-overlay.enum.ts b/apps/browser/src/autofill/enums/autofill-overlay.enum.ts index 70f3e319ce..8dc99e9c40 100644 --- a/apps/browser/src/autofill/enums/autofill-overlay.enum.ts +++ b/apps/browser/src/autofill/enums/autofill-overlay.enum.ts @@ -16,4 +16,4 @@ export const RedirectFocusDirection = { Next: "next", } as const; -export const MAX_SUB_FRAME_DEPTH = 10; +export const MAX_SUB_FRAME_DEPTH = 8; diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index da1ec918c8..978ef4a180 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -1060,7 +1060,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ const subFrameData: SubFrameDataFromWindowMessage = event.data.subFrameData; subFrameData.subFrameDepth++; - if (subFrameData.subFrameDepth > MAX_SUB_FRAME_DEPTH) { + if (subFrameData.subFrameDepth >= MAX_SUB_FRAME_DEPTH) { void this.sendExtensionMessage("destroyAutofillInlineMenuListeners", { subFrameData }); return; }