diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index a908a8fb75..f5f9d6ebc5 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -252,7 +252,7 @@ describe("OverlayBackground", () => { await flushPromises(); expect(subFrameOffsetsSpy[tabId]).toStrictEqual( - new Map([[1, { left: 4, top: 4, url: "url", parentFrameIds: [1, 0] }]]), + new Map([[1, { left: 4, top: 4, url: "url", parentFrameIds: [0, 1] }]]), ); expect(pageDetailsForTabSpy[tabId].size).toBe(2); }); @@ -279,7 +279,7 @@ describe("OverlayBackground", () => { expect(getFrameDetailsSpy).toHaveBeenCalledTimes(1); expect(subFrameOffsetsSpy[tabId]).toStrictEqual( - new Map([[1, { left: 0, top: 0, url: "url", parentFrameIds: [] }]]), + new Map([[1, { left: 0, top: 0, url: "url", parentFrameIds: [0] }]]), ); }); diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 36cad8ca65..e4e890702a 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -373,7 +373,7 @@ export class OverlayBackground implements OverlayBackgroundInterface { return; } - const subFrameData: SubFrameOffsetData = { url, top: 0, left: 0, parentFrameIds: [] }; + const subFrameData: SubFrameOffsetData = { url, top: 0, left: 0, parentFrameIds: [0] }; let frameDetails = await BrowserApi.getFrameDetails({ tabId, frameId }); while (frameDetails && frameDetails.parentFrameId > -1) { @@ -406,7 +406,9 @@ export class OverlayBackground implements OverlayBackgroundInterface { subFrameData.top += subFrameOffset.top; subFrameData.left += subFrameOffset.left; - subFrameData.parentFrameIds.push(frameDetails.parentFrameId); + if (!subFrameData.parentFrameIds.includes(frameDetails.parentFrameId)) { + subFrameData.parentFrameIds.push(frameDetails.parentFrameId); + } frameDetails = await BrowserApi.getFrameDetails({ tabId, diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts index b2cb7f1c94..b29173e507 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts @@ -1398,7 +1398,7 @@ describe("AutofillOverlayContentService", () => { frameId: subFrameId, left: 0, top: 0, - parentFrameIds: [], + parentFrameIds: [0], subFrameDepth: 0, }, }, 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 52f8d78352..1061e3bf3a 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -922,7 +922,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ frameId: message.subFrameId, left: 0, top: 0, - parentFrameIds: [], + parentFrameIds: [0], subFrameDepth: 0, } as SubFrameDataFromWindowMessage, },