From 67db794eda022490bb46501f82190bc6038ac3d1 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Thu, 6 Jun 2024 10:39:25 -0500 Subject: [PATCH] [PM-5189] Fixing a weird side issue that appears when a frame within the page triggers a reposition after the inline menu has been built --- .../autofill/background/overlay.background.ts | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 64abc4d8a8..05eff398ba 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -343,23 +343,21 @@ export class OverlayBackground implements OverlayBackgroundInterface { return; } - const subFrameOffsetsForTab = this.subFrameOffsetsForTab[sender.tab.id]; - if (!subFrameOffsetsForTab) { - return; - } - if (this.updateInlineMenuPositionTimeout) { clearTimeout(this.updateInlineMenuPositionTimeout); } - const tabFrameIds = Array.from(subFrameOffsetsForTab.keys()); - for (const frameId of tabFrameIds) { - if (frameId === sender.frameId) { - continue; - } + const subFrameOffsetsForTab = this.subFrameOffsetsForTab[sender.tab.id]; + if (subFrameOffsetsForTab) { + const tabFrameIds = Array.from(subFrameOffsetsForTab.keys()); + for (const frameId of tabFrameIds) { + if (frameId === sender.frameId) { + continue; + } - subFrameOffsetsForTab.delete(frameId); - await this.buildSubFrameOffsets(sender.tab, frameId, sender.url); + subFrameOffsetsForTab.delete(frameId); + await this.buildSubFrameOffsets(sender.tab, frameId, sender.url); + } } this.updateInlineMenuPositionTimeout = setTimeout(