mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
[PM-5189] Updating message references to better reflect intent
This commit is contained in:
@@ -92,8 +92,8 @@ type BackgroundOnMessageHandlerParams = BackgroundMessageParam & BackgroundSende
|
|||||||
|
|
||||||
type OverlayBackgroundExtensionMessageHandlers = {
|
type OverlayBackgroundExtensionMessageHandlers = {
|
||||||
[key: string]: CallableFunction;
|
[key: string]: CallableFunction;
|
||||||
openAutofillOverlay: () => void;
|
openAutofillOverlayMenu: () => void;
|
||||||
closeAutofillOverlay: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
closeAutofillOverlayMenu: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
||||||
autofillOverlayElementClosed: ({ message }: BackgroundMessageParam) => void;
|
autofillOverlayElementClosed: ({ message }: BackgroundMessageParam) => void;
|
||||||
autofillOverlayAddNewVaultItem: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
autofillOverlayAddNewVaultItem: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
||||||
getAutofillOverlayVisibility: () => void;
|
getAutofillOverlayVisibility: () => void;
|
||||||
@@ -131,7 +131,7 @@ type PortOnMessageHandlerParams = PortMessageParam & PortConnectionParam;
|
|||||||
type OverlayButtonPortMessageHandlers = {
|
type OverlayButtonPortMessageHandlers = {
|
||||||
[key: string]: CallableFunction;
|
[key: string]: CallableFunction;
|
||||||
overlayButtonClicked: ({ port }: PortConnectionParam) => void;
|
overlayButtonClicked: ({ port }: PortConnectionParam) => void;
|
||||||
closeAutofillOverlay: ({ port }: PortConnectionParam) => void;
|
closeAutofillOverlayMenu: ({ port }: PortConnectionParam) => void;
|
||||||
forceCloseAutofillOverlay: ({ port }: PortConnectionParam) => void;
|
forceCloseAutofillOverlay: ({ port }: PortConnectionParam) => void;
|
||||||
overlayPageBlurred: () => void;
|
overlayPageBlurred: () => void;
|
||||||
redirectOverlayFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
|
redirectOverlayFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ describe("OverlayBackground", () => {
|
|||||||
|
|
||||||
it("will return a response if the message handler returns a response", async () => {
|
it("will return a response if the message handler returns a response", async () => {
|
||||||
const message = {
|
const message = {
|
||||||
command: "openAutofillOverlay",
|
command: "openAutofillOverlayMenu",
|
||||||
};
|
};
|
||||||
const sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } });
|
const sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } });
|
||||||
const sendResponse = jest.fn();
|
const sendResponse = jest.fn();
|
||||||
@@ -552,17 +552,17 @@ describe("OverlayBackground", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("extension message handlers", () => {
|
describe("extension message handlers", () => {
|
||||||
describe("openAutofillOverlay message handler", () => {
|
describe("openAutofillOverlayMenu message handler", () => {
|
||||||
it("opens the autofill overlay by sending a message to the current tab", async () => {
|
it("opens the autofill overlay by sending a message to the current tab", async () => {
|
||||||
const sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } });
|
const sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } });
|
||||||
jest.spyOn(BrowserApi, "getTabFromCurrentWindowId").mockResolvedValueOnce(sender.tab);
|
jest.spyOn(BrowserApi, "getTabFromCurrentWindowId").mockResolvedValueOnce(sender.tab);
|
||||||
jest.spyOn(BrowserApi, "tabSendMessage").mockImplementation();
|
jest.spyOn(BrowserApi, "tabSendMessage").mockImplementation();
|
||||||
|
|
||||||
sendMockExtensionMessage({ command: "openAutofillOverlay" });
|
sendMockExtensionMessage({ command: "openAutofillOverlayMenu" });
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(BrowserApi.tabSendMessage).not.toHaveBeenCalledWith(sender.tab, {
|
expect(BrowserApi.tabSendMessage).not.toHaveBeenCalledWith(sender.tab, {
|
||||||
command: "openAutofillOverlay",
|
command: "openAutofillOverlayMenu",
|
||||||
isFocusingFieldElement: false,
|
isFocusingFieldElement: false,
|
||||||
isOpeningFullOverlay: false,
|
isOpeningFullOverlay: false,
|
||||||
authStatus: AuthenticationStatus.Unlocked,
|
authStatus: AuthenticationStatus.Unlocked,
|
||||||
@@ -981,7 +981,7 @@ describe("OverlayBackground", () => {
|
|||||||
const message = {
|
const message = {
|
||||||
command: "unlockCompleted",
|
command: "unlockCompleted",
|
||||||
data: {
|
data: {
|
||||||
commandToRetry: { message: { command: "openAutofillOverlay" } },
|
commandToRetry: { message: { command: "openAutofillOverlayMenu" } },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
jest.spyOn(BrowserApi, "getTabFromCurrentWindowId").mockResolvedValueOnce(sender.tab);
|
jest.spyOn(BrowserApi, "getTabFromCurrentWindowId").mockResolvedValueOnce(sender.tab);
|
||||||
@@ -993,7 +993,7 @@ describe("OverlayBackground", () => {
|
|||||||
expect(BrowserApi.tabSendMessage).toHaveBeenCalledWith(
|
expect(BrowserApi.tabSendMessage).toHaveBeenCalledWith(
|
||||||
sender.tab,
|
sender.tab,
|
||||||
{
|
{
|
||||||
command: "openAutofillOverlay",
|
command: "openAutofillOverlayMenu",
|
||||||
isFocusingFieldElement: true,
|
isFocusingFieldElement: true,
|
||||||
isOpeningFullOverlay: false,
|
isOpeningFullOverlay: false,
|
||||||
authStatus: AuthenticationStatus.Unlocked,
|
authStatus: AuthenticationStatus.Unlocked,
|
||||||
@@ -1144,23 +1144,23 @@ describe("OverlayBackground", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("opens the autofill overlay if the auth status is unlocked", () => {
|
it("opens the autofill overlay if the auth status is unlocked", () => {
|
||||||
jest.spyOn(overlayBackground as any, "openOverlay").mockImplementation();
|
jest.spyOn(overlayBackground as any, "openOverlayMenu").mockImplementation();
|
||||||
|
|
||||||
sendPortMessage(buttonMessageConnectorPortSpy, {
|
sendPortMessage(buttonMessageConnectorPortSpy, {
|
||||||
command: "overlayButtonClicked",
|
command: "overlayButtonClicked",
|
||||||
portKey,
|
portKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(overlayBackground["openOverlay"]).toHaveBeenCalled();
|
expect(overlayBackground["openOverlayMenu"]).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: The tests for `closeAutofillOverlay` and `forceCloseAutofillOverlay` need to be fleshed out
|
// TODO: The tests for `closeAutofillOverlayMenu` and `forceCloseAutofillOverlay` need to be fleshed out
|
||||||
describe("closeAutofillOverlay", () => {
|
describe("closeAutofillOverlayMenu", () => {
|
||||||
it("sends a `closeOverlay` message to the sender tab", () => {
|
it("sends a `closeOverlay` message to the sender tab", () => {
|
||||||
jest.spyOn(BrowserApi, "tabSendMessage");
|
jest.spyOn(BrowserApi, "tabSendMessage");
|
||||||
|
|
||||||
sendPortMessage(buttonMessageConnectorPortSpy, {
|
sendPortMessage(buttonMessageConnectorPortSpy, {
|
||||||
command: "closeAutofillOverlay",
|
command: "closeAutofillOverlayMenu",
|
||||||
portKey,
|
portKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1281,14 +1281,14 @@ describe("OverlayBackground", () => {
|
|||||||
|
|
||||||
describe("unlockVault", () => {
|
describe("unlockVault", () => {
|
||||||
it("closes the autofill overlay and opens the unlock popout", async () => {
|
it("closes the autofill overlay and opens the unlock popout", async () => {
|
||||||
jest.spyOn(overlayBackground as any, "closeOverlay").mockImplementation();
|
jest.spyOn(overlayBackground as any, "closeOverlayMenu").mockImplementation();
|
||||||
jest.spyOn(overlayBackground as any, "openUnlockPopout").mockImplementation();
|
jest.spyOn(overlayBackground as any, "openUnlockPopout").mockImplementation();
|
||||||
jest.spyOn(BrowserApi, "tabSendMessageData").mockImplementation();
|
jest.spyOn(BrowserApi, "tabSendMessageData").mockImplementation();
|
||||||
|
|
||||||
sendPortMessage(listMessageConnectorPortSpy, { command: "unlockVault", portKey });
|
sendPortMessage(listMessageConnectorPortSpy, { command: "unlockVault", portKey });
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(overlayBackground["closeOverlay"]).toHaveBeenCalledWith(
|
expect(overlayBackground["closeOverlayMenu"]).toHaveBeenCalledWith(
|
||||||
listMessageConnectorPortSpy.sender,
|
listMessageConnectorPortSpy.sender,
|
||||||
);
|
);
|
||||||
expect(BrowserApi.tabSendMessageData).toHaveBeenCalledWith(
|
expect(BrowserApi.tabSendMessageData).toHaveBeenCalledWith(
|
||||||
@@ -1296,7 +1296,7 @@ describe("OverlayBackground", () => {
|
|||||||
"addToLockedVaultPendingNotifications",
|
"addToLockedVaultPendingNotifications",
|
||||||
{
|
{
|
||||||
commandToRetry: {
|
commandToRetry: {
|
||||||
message: { command: "openAutofillOverlay" },
|
message: { command: "openAutofillOverlayMenu" },
|
||||||
sender: listMessageConnectorPortSpy.sender,
|
sender: listMessageConnectorPortSpy.sender,
|
||||||
},
|
},
|
||||||
target: "overlay.background",
|
target: "overlay.background",
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
private overlayPageTranslations: Record<string, string>;
|
private overlayPageTranslations: Record<string, string>;
|
||||||
private iconsServerUrl: string;
|
private iconsServerUrl: string;
|
||||||
private readonly extensionMessageHandlers: OverlayBackgroundExtensionMessageHandlers = {
|
private readonly extensionMessageHandlers: OverlayBackgroundExtensionMessageHandlers = {
|
||||||
openAutofillOverlay: () => this.openOverlay(false),
|
openAutofillOverlayMenu: () => this.openOverlayMenu(false),
|
||||||
closeAutofillOverlay: ({ message, sender }) => this.closeOverlay(sender, message),
|
closeAutofillOverlayMenu: ({ message, sender }) => this.closeOverlayMenu(sender, message),
|
||||||
autofillOverlayElementClosed: ({ message }) => this.overlayElementClosed(message),
|
autofillOverlayElementClosed: ({ message }) => this.overlayElementClosed(message),
|
||||||
autofillOverlayAddNewVaultItem: ({ message, sender }) => this.addNewVaultItem(message, sender),
|
autofillOverlayAddNewVaultItem: ({ message, sender }) => this.addNewVaultItem(message, sender),
|
||||||
getAutofillOverlayVisibility: () => this.getOverlayVisibility(),
|
getAutofillOverlayVisibility: () => this.getOverlayVisibility(),
|
||||||
@@ -92,9 +92,9 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
};
|
};
|
||||||
private readonly overlayButtonPortMessageHandlers: OverlayButtonPortMessageHandlers = {
|
private readonly overlayButtonPortMessageHandlers: OverlayButtonPortMessageHandlers = {
|
||||||
overlayButtonClicked: ({ port }) => this.handleOverlayButtonClicked(port),
|
overlayButtonClicked: ({ port }) => this.handleOverlayButtonClicked(port),
|
||||||
closeAutofillOverlay: ({ port }) => this.closeOverlay(port.sender),
|
closeAutofillOverlayMenu: ({ port }) => this.closeOverlayMenu(port.sender),
|
||||||
forceCloseAutofillOverlay: ({ port }) =>
|
forceCloseAutofillOverlay: ({ port }) =>
|
||||||
this.closeOverlay(port.sender, { forceCloseOverlay: true }),
|
this.closeOverlayMenu(port.sender, { forceCloseOverlay: true }),
|
||||||
overlayPageBlurred: () => this.checkOverlayListFocused(),
|
overlayPageBlurred: () => this.checkOverlayListFocused(),
|
||||||
redirectOverlayFocusOut: ({ message, port }) => this.redirectOverlayFocusOut(message, port),
|
redirectOverlayFocusOut: ({ message, port }) => this.redirectOverlayFocusOut(message, port),
|
||||||
updateOverlayPageColorScheme: () => this.updateButtonPageColorScheme(),
|
updateOverlayPageColorScheme: () => this.updateButtonPageColorScheme(),
|
||||||
@@ -102,7 +102,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
private readonly overlayListPortMessageHandlers: OverlayListPortMessageHandlers = {
|
private readonly overlayListPortMessageHandlers: OverlayListPortMessageHandlers = {
|
||||||
checkAutofillOverlayButtonFocused: () => this.checkOverlayButtonFocused(),
|
checkAutofillOverlayButtonFocused: () => this.checkOverlayButtonFocused(),
|
||||||
forceCloseAutofillOverlay: ({ port }) =>
|
forceCloseAutofillOverlay: ({ port }) =>
|
||||||
this.closeOverlay(port.sender, { forceCloseOverlay: true }),
|
this.closeOverlayMenu(port.sender, { forceCloseOverlay: true }),
|
||||||
overlayPageBlurred: () => this.checkOverlayButtonFocused(),
|
overlayPageBlurred: () => this.checkOverlayButtonFocused(),
|
||||||
unlockVault: ({ port }) => this.unlockVault(port),
|
unlockVault: ({ port }) => this.unlockVault(port),
|
||||||
fillSelectedListItem: ({ message, port }) => this.fillSelectedOverlayListItem(message, port),
|
fillSelectedListItem: ({ message, port }) => this.fillSelectedOverlayListItem(message, port),
|
||||||
@@ -409,7 +409,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
* @param forceCloseOverlay - Identifies whether the overlay should be forced closed
|
* @param forceCloseOverlay - Identifies whether the overlay should be forced closed
|
||||||
* @param overlayElement - The overlay element to close, either the list or button
|
* @param overlayElement - The overlay element to close, either the list or button
|
||||||
*/
|
*/
|
||||||
private closeOverlay(
|
private closeOverlayMenu(
|
||||||
sender: chrome.runtime.MessageSender,
|
sender: chrome.runtime.MessageSender,
|
||||||
{
|
{
|
||||||
forceCloseOverlay,
|
forceCloseOverlay,
|
||||||
@@ -614,13 +614,13 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
* @param isFocusingFieldElement - Identifies whether the field element should be focused when the overlay is opened
|
* @param isFocusingFieldElement - Identifies whether the field element should be focused when the overlay is opened
|
||||||
* @param isOpeningFullOverlay - Identifies whether the full overlay should be forced open regardless of other states
|
* @param isOpeningFullOverlay - Identifies whether the full overlay should be forced open regardless of other states
|
||||||
*/
|
*/
|
||||||
private async openOverlay(isFocusingFieldElement = false, isOpeningFullOverlay = false) {
|
private async openOverlayMenu(isFocusingFieldElement = false, isOpeningFullOverlay = false) {
|
||||||
const currentTab = await BrowserApi.getTabFromCurrentWindowId();
|
const currentTab = await BrowserApi.getTabFromCurrentWindowId();
|
||||||
|
|
||||||
await BrowserApi.tabSendMessage(
|
await BrowserApi.tabSendMessage(
|
||||||
currentTab,
|
currentTab,
|
||||||
{
|
{
|
||||||
command: "openAutofillOverlay",
|
command: "openAutofillOverlayMenu",
|
||||||
isFocusingFieldElement,
|
isFocusingFieldElement,
|
||||||
isOpeningFullOverlay,
|
isOpeningFullOverlay,
|
||||||
authStatus: await this.getAuthStatus(),
|
authStatus: await this.getAuthStatus(),
|
||||||
@@ -681,7 +681,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void this.openOverlay(false, true);
|
void this.openOverlayMenu(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -692,9 +692,9 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
private async unlockVault(port: chrome.runtime.Port) {
|
private async unlockVault(port: chrome.runtime.Port) {
|
||||||
const { sender } = port;
|
const { sender } = port;
|
||||||
|
|
||||||
this.closeOverlay(port.sender);
|
this.closeOverlayMenu(port.sender);
|
||||||
const retryMessage: LockedVaultPendingNotificationsData = {
|
const retryMessage: LockedVaultPendingNotificationsData = {
|
||||||
commandToRetry: { message: { command: "openAutofillOverlay" }, sender },
|
commandToRetry: { message: { command: "openAutofillOverlayMenu" }, sender },
|
||||||
target: "overlay.background",
|
target: "overlay.background",
|
||||||
};
|
};
|
||||||
await BrowserApi.tabSendMessageData(
|
await BrowserApi.tabSendMessageData(
|
||||||
@@ -742,8 +742,8 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
private async unlockCompleted(message: OverlayBackgroundExtensionMessage) {
|
private async unlockCompleted(message: OverlayBackgroundExtensionMessage) {
|
||||||
await this.getAuthStatus();
|
await this.getAuthStatus();
|
||||||
|
|
||||||
if (message.data?.commandToRetry?.message?.command === "openAutofillOverlay") {
|
if (message.data?.commandToRetry?.message?.command === "openAutofillOverlayMenu") {
|
||||||
await this.openOverlay(true);
|
await this.openOverlayMenu(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ describe("AutofillOverlayIframeService", () => {
|
|||||||
autofillOverlayIframeService["iframe"].src = "http://malicious-site.com";
|
autofillOverlayIframeService["iframe"].src = "http://malicious-site.com";
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceClose: true,
|
forceClose: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -471,7 +471,7 @@ describe("AutofillOverlayIframeService", () => {
|
|||||||
autofillOverlayIframeService["iframe"].src = "http://malicious-site.com";
|
autofillOverlayIframeService["iframe"].src = "http://malicious-site.com";
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceClose: true,
|
forceClose: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ class AutofillOverlayIframeService implements AutofillOverlayIframeServiceInterf
|
|||||||
* mutation observer is triggered excessively.
|
* mutation observer is triggered excessively.
|
||||||
*/
|
*/
|
||||||
private forceCloseAutofillOverlay() {
|
private forceCloseAutofillOverlay() {
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", { forceClose: true });
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", { forceClose: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe("AutofillOverlayButton", () => {
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(globalThis.parent.postMessage).not.toHaveBeenCalledWith({
|
expect(globalThis.parent.postMessage).not.toHaveBeenCalledWith({
|
||||||
command: "closeAutofillOverlay",
|
command: "closeAutofillOverlayMenu",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ describe("AutofillOverlayButton", () => {
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
||||||
{ command: "closeAutofillOverlay", portKey },
|
{ command: "closeAutofillOverlayMenu", portKey },
|
||||||
"*",
|
"*",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AutofillOverlayButton extends AutofillOverlayPageElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.postMessageToParent({ command: "closeAutofillOverlay" });
|
this.postMessageToParent({ command: "closeAutofillOverlayMenu" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export type OpenAutofillOverlayOptions = {
|
|||||||
|
|
||||||
export type AutofillOverlayContentExtensionMessageHandlers = {
|
export type AutofillOverlayContentExtensionMessageHandlers = {
|
||||||
[key: string]: CallableFunction;
|
[key: string]: CallableFunction;
|
||||||
openAutofillOverlay: ({ message }: AutofillExtensionMessageParam) => void;
|
openAutofillOverlayMenu: ({ message }: AutofillExtensionMessageParam) => void;
|
||||||
addNewVaultItemFromOverlay: () => void;
|
addNewVaultItemFromOverlay: () => void;
|
||||||
blurMostRecentOverlayField: () => void;
|
blurMostRecentOverlayField: () => void;
|
||||||
bgUnlockPopoutOpened: () => void;
|
bgUnlockPopoutOpened: () => void;
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
it("closes the autofill overlay when the `Escape` key is pressed", () => {
|
it("closes the autofill overlay when the `Escape` key is pressed", () => {
|
||||||
autofillFieldElement.dispatchEvent(new KeyboardEvent("keyup", { code: "Escape" }));
|
autofillFieldElement.dispatchEvent(new KeyboardEvent("keyup", { code: "Escape" }));
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -364,7 +364,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
);
|
);
|
||||||
const openAutofillOverlaySpy = jest.spyOn(
|
const openAutofillOverlaySpy = jest.spyOn(
|
||||||
autofillOverlayContentService as any,
|
autofillOverlayContentService as any,
|
||||||
"openAutofillOverlay",
|
"openAutofillOverlayMenu",
|
||||||
);
|
);
|
||||||
jest
|
jest
|
||||||
.spyOn(autofillOverlayContentService as any, "isInlineMenuListVisible")
|
.spyOn(autofillOverlayContentService as any, "isInlineMenuListVisible")
|
||||||
@@ -454,7 +454,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("input"));
|
autofillFieldElement.dispatchEvent(new Event("input"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
@@ -475,14 +475,14 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("input"));
|
autofillFieldElement.dispatchEvent(new Event("input"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens the autofill overlay if the form field is empty", async () => {
|
it("opens the autofill overlay if the form field is empty", async () => {
|
||||||
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlay");
|
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlayMenu");
|
||||||
(autofillFieldElement as HTMLInputElement).value = "";
|
(autofillFieldElement as HTMLInputElement).value = "";
|
||||||
|
|
||||||
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
||||||
@@ -492,12 +492,12 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("input"));
|
autofillFieldElement.dispatchEvent(new Event("input"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(autofillOverlayContentService["openAutofillOverlay"]).toHaveBeenCalled();
|
expect(autofillOverlayContentService["openAutofillOverlayMenu"]).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens the autofill overlay if the form field is empty and the user is authed", async () => {
|
it("opens the autofill overlay if the form field is empty and the user is authed", async () => {
|
||||||
jest.spyOn(autofillOverlayContentService as any, "isUserAuthed").mockReturnValue(true);
|
jest.spyOn(autofillOverlayContentService as any, "isUserAuthed").mockReturnValue(true);
|
||||||
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlay");
|
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlayMenu");
|
||||||
(autofillFieldElement as HTMLInputElement).value = "";
|
(autofillFieldElement as HTMLInputElement).value = "";
|
||||||
|
|
||||||
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
||||||
@@ -507,7 +507,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("input"));
|
autofillFieldElement.dispatchEvent(new Event("input"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(autofillOverlayContentService["openAutofillOverlay"]).toHaveBeenCalled();
|
expect(autofillOverlayContentService["openAutofillOverlayMenu"]).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens the autofill overlay if the form field is empty and the overlay ciphers are not populated", async () => {
|
it("opens the autofill overlay if the form field is empty and the overlay ciphers are not populated", async () => {
|
||||||
@@ -515,7 +515,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
jest
|
jest
|
||||||
.spyOn(autofillOverlayContentService as any, "isInlineMenuCiphersPopulated")
|
.spyOn(autofillOverlayContentService as any, "isInlineMenuCiphersPopulated")
|
||||||
.mockResolvedValue(false);
|
.mockResolvedValue(false);
|
||||||
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlay");
|
jest.spyOn(autofillOverlayContentService as any, "openAutofillOverlayMenu");
|
||||||
(autofillFieldElement as HTMLInputElement).value = "";
|
(autofillFieldElement as HTMLInputElement).value = "";
|
||||||
|
|
||||||
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
await autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
||||||
@@ -525,7 +525,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("input"));
|
autofillFieldElement.dispatchEvent(new Event("input"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(autofillOverlayContentService["openAutofillOverlay"]).toHaveBeenCalled();
|
expect(autofillOverlayContentService["openAutofillOverlayMenu"]).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("focus"));
|
autofillFieldElement.dispatchEvent(new Event("focus"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
@@ -652,7 +652,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("focus"));
|
autofillFieldElement.dispatchEvent(new Event("focus"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
@@ -670,7 +670,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("focus"));
|
autofillFieldElement.dispatchEvent(new Event("focus"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlay");
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlayMenu");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens the autofill overlay if the overlay ciphers are not populated and the user is authed", async () => {
|
it("opens the autofill overlay if the overlay ciphers are not populated and the user is authed", async () => {
|
||||||
@@ -686,7 +686,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldElement.dispatchEvent(new Event("focus"));
|
autofillFieldElement.dispatchEvent(new Event("focus"));
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlay");
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlayMenu");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates the overlay button position if the focus event is not opening the overlay", async () => {
|
it("updates the overlay button position if the focus event is not opening the overlay", async () => {
|
||||||
@@ -723,7 +723,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillFieldData,
|
autofillFieldData,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlay");
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("openAutofillOverlayMenu");
|
||||||
expect(autofillOverlayContentService["mostRecentlyFocusedField"]).toEqual(
|
expect(autofillOverlayContentService["mostRecentlyFocusedField"]).toEqual(
|
||||||
autofillFieldElement,
|
autofillFieldElement,
|
||||||
);
|
);
|
||||||
@@ -743,7 +743,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("openAutofillOverlay", () => {
|
describe("openAutofillOverlayMenu", () => {
|
||||||
let autofillFieldElement: ElementWithOpId<FormFieldElement>;
|
let autofillFieldElement: ElementWithOpId<FormFieldElement>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -764,7 +764,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
it("skips opening the overlay if a field has not been recently focused", () => {
|
it("skips opening the overlay if a field has not been recently focused", () => {
|
||||||
autofillOverlayContentService["mostRecentlyFocusedField"] = undefined;
|
autofillOverlayContentService["mostRecentlyFocusedField"] = undefined;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]();
|
autofillOverlayContentService["openAutofillOverlayMenu"]();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).not.toHaveBeenCalled();
|
expect(sendExtensionMessageSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -780,7 +780,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
"focusMostRecentOverlayField",
|
"focusMostRecentOverlayField",
|
||||||
);
|
);
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]({ isFocusingFieldElement: true });
|
autofillOverlayContentService["openAutofillOverlayMenu"]({ isFocusingFieldElement: true });
|
||||||
|
|
||||||
expect(focusMostRecentOverlayFieldSpy).toHaveBeenCalled();
|
expect(focusMostRecentOverlayFieldSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -796,7 +796,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
"focusMostRecentOverlayField",
|
"focusMostRecentOverlayField",
|
||||||
);
|
);
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]({ isFocusingFieldElement: true });
|
autofillOverlayContentService["openAutofillOverlayMenu"]({ isFocusingFieldElement: true });
|
||||||
|
|
||||||
expect(focusMostRecentOverlayFieldSpy).not.toHaveBeenCalled();
|
expect(focusMostRecentOverlayFieldSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -804,7 +804,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
it("stores the user's auth status", () => {
|
it("stores the user's auth status", () => {
|
||||||
autofillOverlayContentService["authStatus"] = undefined;
|
autofillOverlayContentService["authStatus"] = undefined;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]({
|
autofillOverlayContentService["openAutofillOverlayMenu"]({
|
||||||
authStatus: AuthenticationStatus.Unlocked,
|
authStatus: AuthenticationStatus.Unlocked,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
it("opens both autofill overlay elements", () => {
|
it("opens both autofill overlay elements", () => {
|
||||||
autofillOverlayContentService["mostRecentlyFocusedField"] = autofillFieldElement;
|
autofillOverlayContentService["mostRecentlyFocusedField"] = autofillFieldElement;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]();
|
autofillOverlayContentService["openAutofillOverlayMenu"]();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
||||||
overlayElement: AutofillOverlayElement.Button,
|
overlayElement: AutofillOverlayElement.Button,
|
||||||
@@ -828,7 +828,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillOverlayContentService["autofillOverlayVisibility"] =
|
autofillOverlayContentService["autofillOverlayVisibility"] =
|
||||||
AutofillOverlayVisibility.OnButtonClick;
|
AutofillOverlayVisibility.OnButtonClick;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]({ isOpeningFullOverlay: false });
|
autofillOverlayContentService["openAutofillOverlayMenu"]({ isOpeningFullOverlay: false });
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
||||||
overlayElement: AutofillOverlayElement.Button,
|
overlayElement: AutofillOverlayElement.Button,
|
||||||
@@ -842,7 +842,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
autofillOverlayContentService["autofillOverlayVisibility"] =
|
autofillOverlayContentService["autofillOverlayVisibility"] =
|
||||||
AutofillOverlayVisibility.OnButtonClick;
|
AutofillOverlayVisibility.OnButtonClick;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]({ isOpeningFullOverlay: true });
|
autofillOverlayContentService["openAutofillOverlayMenu"]({ isOpeningFullOverlay: true });
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("updateAutofillOverlayPosition", {
|
||||||
overlayElement: AutofillOverlayElement.Button,
|
overlayElement: AutofillOverlayElement.Button,
|
||||||
@@ -856,7 +856,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
jest.spyOn(autofillOverlayContentService as any, "sendExtensionMessage");
|
jest.spyOn(autofillOverlayContentService as any, "sendExtensionMessage");
|
||||||
autofillOverlayContentService.pageDetailsUpdateRequired = true;
|
autofillOverlayContentService.pageDetailsUpdateRequired = true;
|
||||||
|
|
||||||
autofillOverlayContentService["openAutofillOverlay"]();
|
autofillOverlayContentService["openAutofillOverlayMenu"]();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("bgCollectPageDetails", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("bgCollectPageDetails", {
|
||||||
sender: "autofillOverlayContentService",
|
sender: "autofillOverlayContentService",
|
||||||
@@ -1022,7 +1022,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
await autofillOverlayContentService.redirectOverlayFocusOut(RedirectFocusDirection.Current);
|
await autofillOverlayContentService.redirectOverlayFocusOut(RedirectFocusDirection.Current);
|
||||||
jest.advanceTimersByTime(150);
|
jest.advanceTimersByTime(150);
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay");
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("finds all focusable tabs if the focusable elements array is not populated", async () => {
|
it("finds all focusable tabs if the focusable elements array is not populated", async () => {
|
||||||
@@ -1130,7 +1130,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
isOverlayHidden: false,
|
isOverlayHidden: false,
|
||||||
setTransparentOverlay: true,
|
setTransparentOverlay: true,
|
||||||
});
|
});
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1184,7 +1184,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
jest.advanceTimersByTime(800);
|
jest.advanceTimersByTime(800);
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1194,7 +1194,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
it("skips removing the overlay if the document is visible", () => {
|
it("skips removing the overlay if the document is visible", () => {
|
||||||
autofillOverlayContentService["handleVisibilityChangeEvent"]();
|
autofillOverlayContentService["handleVisibilityChangeEvent"]();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).not.toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).not.toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1208,7 +1208,7 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
|
|
||||||
autofillOverlayContentService["handleVisibilityChangeEvent"]();
|
autofillOverlayContentService["handleVisibilityChangeEvent"]();
|
||||||
|
|
||||||
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlay", {
|
expect(sendExtensionMessageSpy).toHaveBeenCalledWith("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
private autofillFieldKeywordsMap: WeakMap<AutofillField, string> = new WeakMap();
|
private autofillFieldKeywordsMap: WeakMap<AutofillField, string> = new WeakMap();
|
||||||
private eventHandlersMemo: { [key: string]: EventListener } = {};
|
private eventHandlersMemo: { [key: string]: EventListener } = {};
|
||||||
readonly extensionMessageHandlers: AutofillOverlayContentExtensionMessageHandlers = {
|
readonly extensionMessageHandlers: AutofillOverlayContentExtensionMessageHandlers = {
|
||||||
openAutofillOverlay: ({ message }) => this.openAutofillOverlay(message),
|
openAutofillOverlayMenu: ({ message }) => this.openAutofillOverlayMenu(message),
|
||||||
addNewVaultItemFromOverlay: () => this.addNewVaultItem(),
|
addNewVaultItemFromOverlay: () => this.addNewVaultItem(),
|
||||||
blurMostRecentOverlayField: () => this.blurMostRecentOverlayField(),
|
blurMostRecentOverlayField: () => this.blurMostRecentOverlayField(),
|
||||||
bgUnlockPopoutOpened: () => this.blurMostRecentOverlayField(true),
|
bgUnlockPopoutOpened: () => this.blurMostRecentOverlayField(true),
|
||||||
@@ -111,7 +111,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
*
|
*
|
||||||
* @param options - Options for opening the autofill overlay.
|
* @param options - Options for opening the autofill overlay.
|
||||||
*/
|
*/
|
||||||
openAutofillOverlay(options: OpenAutofillOverlayOptions = {}) {
|
openAutofillOverlayMenu(options: OpenAutofillOverlayOptions = {}) {
|
||||||
const { isFocusingFieldElement, isOpeningFullOverlay, authStatus } = options;
|
const { isFocusingFieldElement, isOpeningFullOverlay, authStatus } = options;
|
||||||
if (!this.mostRecentlyFocusedField) {
|
if (!this.mostRecentlyFocusedField) {
|
||||||
return;
|
return;
|
||||||
@@ -157,7 +157,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
this.mostRecentlyFocusedField?.blur();
|
this.mostRecentlyFocusedField?.blur();
|
||||||
|
|
||||||
if (isRemovingOverlay) {
|
if (isRemovingOverlay) {
|
||||||
void sendExtensionMessage("closeAutofillOverlay");
|
void sendExtensionMessage("closeAutofillOverlayMenu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
|
|
||||||
if (direction === RedirectFocusDirection.Current) {
|
if (direction === RedirectFocusDirection.Current) {
|
||||||
this.focusMostRecentOverlayField();
|
this.focusMostRecentOverlayField();
|
||||||
setTimeout(() => void this.sendExtensionMessage("closeAutofillOverlay"), 100);
|
setTimeout(() => void this.sendExtensionMessage("closeAutofillOverlayMenu"), 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
private handleFormFieldKeyupEvent = async (event: KeyboardEvent) => {
|
private handleFormFieldKeyupEvent = async (event: KeyboardEvent) => {
|
||||||
const eventCode = event.code;
|
const eventCode = event.code;
|
||||||
if (eventCode === "Escape") {
|
if (eventCode === "Escape") {
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -331,7 +331,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
private async focusOverlayList() {
|
private async focusOverlayList() {
|
||||||
if (this.mostRecentlyFocusedField && !(await this.isInlineMenuListVisible())) {
|
if (this.mostRecentlyFocusedField && !(await this.isInlineMenuListVisible())) {
|
||||||
await this.updateMostRecentlyFocusedField(this.mostRecentlyFocusedField);
|
await this.updateMostRecentlyFocusedField(this.mostRecentlyFocusedField);
|
||||||
this.openAutofillOverlay({ isOpeningFullOverlay: true });
|
this.openAutofillOverlayMenu({ isOpeningFullOverlay: true });
|
||||||
setTimeout(() => this.sendExtensionMessage("focusAutofillOverlayList"), 125);
|
setTimeout(() => this.sendExtensionMessage("focusAutofillOverlayList"), 125);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -366,14 +366,14 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
this.storeModifiedFormElement(formFieldElement);
|
this.storeModifiedFormElement(formFieldElement);
|
||||||
|
|
||||||
if (await this.hideOverlayListOnFilledField(formFieldElement)) {
|
if (await this.hideOverlayListOnFilledField(formFieldElement)) {
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openAutofillOverlay();
|
this.openAutofillOverlayMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -459,7 +459,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
this.autofillOverlayVisibility === AutofillOverlayVisibility.OnButtonClick ||
|
this.autofillOverlayVisibility === AutofillOverlayVisibility.OnButtonClick ||
|
||||||
(formElementHasValue && initiallyFocusedField !== this.mostRecentlyFocusedField)
|
(formElementHasValue && initiallyFocusedField !== this.mostRecentlyFocusedField)
|
||||||
) {
|
) {
|
||||||
await this.sendExtensionMessage("closeAutofillOverlay", {
|
await this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
@@ -470,7 +470,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void this.sendExtensionMessage("openAutofillOverlay");
|
void this.sendExtensionMessage("openAutofillOverlayMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -780,7 +780,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
private triggerOverlayRepositionUpdates = async () => {
|
private triggerOverlayRepositionUpdates = async () => {
|
||||||
if (!this.recentlyFocusedFieldIsCurrentlyFocused()) {
|
if (!this.recentlyFocusedFieldIsCurrentlyFocused()) {
|
||||||
this.toggleOverlayHidden(false, true);
|
this.toggleOverlayHidden(false, true);
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -795,7 +795,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
this.mostRecentlyFocusedField as FillableFormFieldElement,
|
this.mostRecentlyFocusedField as FillableFormFieldElement,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
overlayElement: AutofillOverlayElement.List,
|
overlayElement: AutofillOverlayElement.List,
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
@@ -807,7 +807,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -868,7 +868,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mostRecentlyFocusedField = null;
|
this.mostRecentlyFocusedField = null;
|
||||||
void this.sendExtensionMessage("closeAutofillOverlay", {
|
void this.sendExtensionMessage("closeAutofillOverlayMenu", {
|
||||||
forceCloseOverlay: true,
|
forceCloseOverlay: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user