mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
[PM-5189] Implementing fixes for how positioning of the overlay element functions
This commit is contained in:
@@ -56,8 +56,8 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||
private overlayButtonPort: chrome.runtime.Port;
|
||||
private overlayListPort: chrome.runtime.Port;
|
||||
private focusedFieldData: FocusedFieldData;
|
||||
private isFieldCurrentlyFocused: boolean;
|
||||
private isCurrentlyFilling: boolean;
|
||||
private isFieldCurrentlyFocused: boolean = false;
|
||||
private isCurrentlyFilling: boolean = false;
|
||||
private overlayPageTranslations: Record<string, string>;
|
||||
private iconsServerUrl: string;
|
||||
private readonly extensionMessageHandlers: OverlayBackgroundExtensionMessageHandlers = {
|
||||
@@ -433,7 +433,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||
{ overlayElement }: { overlayElement?: string },
|
||||
sender: chrome.runtime.MessageSender,
|
||||
) {
|
||||
if (!overlayElement) {
|
||||
if (!overlayElement || sender.tab.id !== this.focusedFieldData.tabId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -443,10 +443,10 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||
{ frameId: 0 },
|
||||
);
|
||||
|
||||
const subFrameOffsetsForTab = this.subFrameOffsetsForTab[sender.tab.id];
|
||||
const subFrameOffsetsForTab = this.subFrameOffsetsForTab[this.focusedFieldData.tabId];
|
||||
let subFrameOffsets: SubFrameOffsetData;
|
||||
if (subFrameOffsetsForTab) {
|
||||
subFrameOffsets = subFrameOffsetsForTab.get(sender.frameId);
|
||||
subFrameOffsets = subFrameOffsetsForTab.get(this.focusedFieldData.frameId);
|
||||
}
|
||||
|
||||
if (overlayElement === AutofillOverlayElement.Button) {
|
||||
@@ -814,7 +814,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||
}
|
||||
|
||||
const messageResponse = handler({ message, sender });
|
||||
if (!messageResponse) {
|
||||
if (typeof messageResponse === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -852,14 +852,14 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||
translations: this.getTranslations(),
|
||||
ciphers: isOverlayListPort ? await this.getOverlayCipherData() : null,
|
||||
});
|
||||
// void this.updateOverlayPosition(
|
||||
// {
|
||||
// overlayElement: isOverlayListPort
|
||||
// ? AutofillOverlayElement.List
|
||||
// : AutofillOverlayElement.Button,
|
||||
// },
|
||||
// port.sender,
|
||||
// );
|
||||
void this.updateOverlayPosition(
|
||||
{
|
||||
overlayElement: isOverlayListPort
|
||||
? AutofillOverlayElement.List
|
||||
: AutofillOverlayElement.Button,
|
||||
},
|
||||
port.sender,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -236,7 +236,7 @@ export class InlineMenuElements implements InlineMenuElementsInterface {
|
||||
private updateCustomElementDefaultStyles(element: HTMLElement) {
|
||||
this.unobserveCustomElements();
|
||||
|
||||
setElementStyles(element, this.customElementDefaultStyles, true);
|
||||
this.setElementStyles(element, this.customElementDefaultStyles, true);
|
||||
|
||||
this.observeCustomElements();
|
||||
}
|
||||
|
||||
@@ -542,9 +542,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
||||
}
|
||||
|
||||
if (!formElementHasValue || (!this.isOverlayCiphersPopulated && this.isUserAuthed())) {
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.sendExtensionMessage("openAutofillOverlay");
|
||||
void this.sendExtensionMessage("openAutofillOverlay");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ async function sendExtensionMessage(
|
||||
return new Promise((resolve) => {
|
||||
chrome.runtime.sendMessage(Object.assign({ command }, options), (response) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
return;
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
resolve(response);
|
||||
|
||||
Reference in New Issue
Block a user