1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

[PM-5189] Refactoring and organizing implementation

This commit is contained in:
Cesar Gonzalez
2024-04-08 05:43:06 -05:00
parent bed24d17a9
commit a69d9d8f4a
2 changed files with 5 additions and 5 deletions

View File

@@ -59,8 +59,8 @@ type OverlayBackgroundExtensionMessage = {
isFieldCurrentlyFilling?: boolean;
subFrameData?: SubFrameOffsetData;
focusedFieldData?: FocusedFieldData;
data?: LockedVaultPendingNotificationsData;
styles?: Partial<CSSStyleDeclaration>;
data?: LockedVaultPendingNotificationsData;
} & OverlayAddNewItemMessage;
type OverlayPortMessage = {

View File

@@ -52,7 +52,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
private overlayLoginCiphers: Map<string, CipherView> = new Map();
private pageDetailsForTab: PageDetailsForTab = {};
private subFrameOffsetsForTab: SubFrameOffsetsForTab = {};
private rebuildSubFrameOffsetsTimeout: number | NodeJS.Timeout;
private updateOverlayPositionAfterSubFrameRebuildTimeout: number | NodeJS.Timeout;
private userAuthStatus: AuthenticationStatus = AuthenticationStatus.LoggedOut;
private overlayButtonPort: chrome.runtime.Port;
private overlayListPort: chrome.runtime.Port;
@@ -306,8 +306,8 @@ class OverlayBackground implements OverlayBackgroundInterface {
return;
}
if (this.rebuildSubFrameOffsetsTimeout) {
clearTimeout(this.rebuildSubFrameOffsetsTimeout as number);
if (this.updateOverlayPositionAfterSubFrameRebuildTimeout) {
clearTimeout(this.updateOverlayPositionAfterSubFrameRebuildTimeout);
}
const frameTabs = Array.from(subFrameOffsetsForTab.keys());
@@ -320,7 +320,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
await this.buildSubFrameOffsets(sender.tab, frameId, sender.url);
}
this.rebuildSubFrameOffsetsTimeout = setTimeout(() => {
this.updateOverlayPositionAfterSubFrameRebuildTimeout = setTimeout(() => {
if (this.isFieldCurrentlyFocused) {
void this.updateOverlayPosition({ overlayElement: AutofillOverlayElement.List }, sender);
void this.updateOverlayPosition({ overlayElement: AutofillOverlayElement.Button }, sender);