1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

replace Autofill-owned enums (#15031)

This commit is contained in:
Jonathan Prusik
2025-06-03 16:38:51 -04:00
committed by GitHub
parent ce3ce17010
commit 6dabdd73cb
24 changed files with 118 additions and 116 deletions

View File

@@ -4,7 +4,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { InlineMenuFillTypes } from "../../enums/autofill-overlay.enum"; import { InlineMenuFillType } from "../../enums/autofill-overlay.enum";
import AutofillPageDetails from "../../models/autofill-page-details"; import AutofillPageDetails from "../../models/autofill-page-details";
import { PageDetail } from "../../services/abstractions/autofill.service"; import { PageDetail } from "../../services/abstractions/autofill.service";
@@ -43,7 +43,7 @@ export type UpdateOverlayCiphersParams = {
export type FocusedFieldData = { export type FocusedFieldData = {
focusedFieldStyles: Partial<CSSStyleDeclaration>; focusedFieldStyles: Partial<CSSStyleDeclaration>;
focusedFieldRects: Partial<DOMRect>; focusedFieldRects: Partial<DOMRect>;
inlineMenuFillType?: InlineMenuFillTypes; inlineMenuFillType?: InlineMenuFillType;
tabId?: number; tabId?: number;
frameId?: number; frameId?: number;
accountCreationFieldType?: string; accountCreationFieldType?: string;

View File

@@ -45,7 +45,7 @@ import {
AutofillOverlayElement, AutofillOverlayElement,
AutofillOverlayPort, AutofillOverlayPort,
InlineMenuAccountCreationFieldType, InlineMenuAccountCreationFieldType,
InlineMenuFillType, InlineMenuFillTypes,
MAX_SUB_FRAME_DEPTH, MAX_SUB_FRAME_DEPTH,
RedirectFocusDirection, RedirectFocusDirection,
} from "../enums/autofill-overlay.enum"; } from "../enums/autofill-overlay.enum";
@@ -1025,7 +1025,7 @@ describe("OverlayBackground", () => {
overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({ overlayBackground["focusedFieldData"] = createFocusedFieldDataMock({
tabId: tab.id, tabId: tab.id,
accountCreationFieldType: "text", accountCreationFieldType: "text",
inlineMenuFillType: InlineMenuFillType.AccountCreationUsername, inlineMenuFillType: InlineMenuFillTypes.AccountCreationUsername,
}); });
cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, identityCipher]); cipherService.getAllDecryptedForUrl.mockResolvedValue([loginCipher1, identityCipher]);
cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1); cipherService.sortCiphersByLastUsedThenName.mockReturnValue(-1);
@@ -1383,7 +1383,7 @@ describe("OverlayBackground", () => {
{ {
command: "updateFocusedFieldData", command: "updateFocusedFieldData",
focusedFieldData: createFocusedFieldDataMock({ focusedFieldData: createFocusedFieldDataMock({
inlineMenuFillType: InlineMenuFillType.CurrentPasswordUpdate, inlineMenuFillType: InlineMenuFillTypes.CurrentPasswordUpdate,
}), }),
}, },
mock<chrome.runtime.MessageSender>({ tab }), mock<chrome.runtime.MessageSender>({ tab }),
@@ -2045,7 +2045,7 @@ describe("OverlayBackground", () => {
}); });
it("displays the password generator when the focused field is for password generation", async () => { it("displays the password generator when the focused field is for password generation", async () => {
focusedFieldData.inlineMenuFillType = InlineMenuFillType.PasswordGeneration; focusedFieldData.inlineMenuFillType = InlineMenuFillTypes.PasswordGeneration;
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender); sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
await flushPromises(); await flushPromises();
@@ -2103,7 +2103,7 @@ describe("OverlayBackground", () => {
}); });
it("shows the save login menu when the focused field type is for password generation and the field is filled", async () => { it("shows the save login menu when the focused field type is for password generation and the field is filled", async () => {
focusedFieldData.inlineMenuFillType = InlineMenuFillType.PasswordGeneration; focusedFieldData.inlineMenuFillType = InlineMenuFillTypes.PasswordGeneration;
sendMockExtensionMessage( sendMockExtensionMessage(
{ command: "updateFocusedFieldData", focusedFieldData, focusedFieldHasValue: true }, { command: "updateFocusedFieldData", focusedFieldData, focusedFieldHasValue: true },
@@ -3409,7 +3409,7 @@ describe("OverlayBackground", () => {
{ {
command: "updateFocusedFieldData", command: "updateFocusedFieldData",
focusedFieldData: createFocusedFieldDataMock({ focusedFieldData: createFocusedFieldDataMock({
inlineMenuFillType: InlineMenuFillType.CurrentPasswordUpdate, inlineMenuFillType: InlineMenuFillTypes.CurrentPasswordUpdate,
}), }),
}, },
sender, sender,
@@ -3607,7 +3607,7 @@ describe("OverlayBackground", () => {
describe("fillGeneratedPassword", () => { describe("fillGeneratedPassword", () => {
const focusedFieldData = createFocusedFieldDataMock({ const focusedFieldData = createFocusedFieldDataMock({
inlineMenuFillType: InlineMenuFillType.PasswordGeneration, inlineMenuFillType: InlineMenuFillTypes.PasswordGeneration,
}); });
beforeEach(() => { beforeEach(() => {

View File

@@ -797,7 +797,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
* @param focusedFieldData - Optional focused field data to validate against * @param focusedFieldData - Optional focused field data to validate against
*/ */
private focusedFieldMatchesFillType( private focusedFieldMatchesFillType(
fillType: InlineMenuFillTypes, fillType: InlineMenuFillType,
focusedFieldData?: FocusedFieldData, focusedFieldData?: FocusedFieldData,
) { ) {
const focusedFieldFillType = focusedFieldData const focusedFieldFillType = focusedFieldData
@@ -806,7 +806,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
// When updating the current password for a field, it should fill with a login cipher // When updating the current password for a field, it should fill with a login cipher
if ( if (
focusedFieldFillType === InlineMenuFillType.CurrentPasswordUpdate && focusedFieldFillType === InlineMenuFillTypes.CurrentPasswordUpdate &&
fillType === CipherType.Login fillType === CipherType.Login
) { ) {
return true; return true;
@@ -819,7 +819,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
* Identifies whether the inline menu is being shown on an account creation field. * Identifies whether the inline menu is being shown on an account creation field.
*/ */
private shouldShowInlineMenuAccountCreation(): boolean { private shouldShowInlineMenuAccountCreation(): boolean {
if (this.focusedFieldMatchesFillType(InlineMenuFillType.AccountCreationUsername)) { if (this.focusedFieldMatchesFillType(InlineMenuFillTypes.AccountCreationUsername)) {
return true; return true;
} }
@@ -1152,7 +1152,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
} }
let pageDetails = Array.from(pageDetailsForTab.values()); let pageDetails = Array.from(pageDetailsForTab.values());
if (this.focusedFieldMatchesFillType(InlineMenuFillType.CurrentPasswordUpdate)) { if (this.focusedFieldMatchesFillType(InlineMenuFillTypes.CurrentPasswordUpdate)) {
pageDetails = this.getFilteredPageDetails( pageDetails = this.getFilteredPageDetails(
pageDetails, pageDetails,
this.inlineMenuFieldQualificationService.isUpdateCurrentPasswordField, this.inlineMenuFieldQualificationService.isUpdateCurrentPasswordField,
@@ -1705,7 +1705,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
private shouldUpdatePasswordGeneratorMenuOnFieldFocus() { private shouldUpdatePasswordGeneratorMenuOnFieldFocus() {
return ( return (
this.isInlineMenuButtonVisible && this.isInlineMenuButtonVisible &&
this.focusedFieldMatchesFillType(InlineMenuFillType.PasswordGeneration) this.focusedFieldMatchesFillType(InlineMenuFillTypes.PasswordGeneration)
); );
} }
@@ -1767,9 +1767,9 @@ export class OverlayBackground implements OverlayBackgroundInterface {
private shouldUpdateAccountCreationMenuOnFieldFocus(previousFocusedFieldData: FocusedFieldData) { private shouldUpdateAccountCreationMenuOnFieldFocus(previousFocusedFieldData: FocusedFieldData) {
const accountCreationFieldBlurred = const accountCreationFieldBlurred =
this.focusedFieldMatchesFillType( this.focusedFieldMatchesFillType(
InlineMenuFillType.AccountCreationUsername, InlineMenuFillTypes.AccountCreationUsername,
previousFocusedFieldData, previousFocusedFieldData,
) && !this.focusedFieldMatchesFillType(InlineMenuFillType.AccountCreationUsername); ) && !this.focusedFieldMatchesFillType(InlineMenuFillTypes.AccountCreationUsername);
return accountCreationFieldBlurred || this.shouldShowInlineMenuAccountCreation(); return accountCreationFieldBlurred || this.shouldShowInlineMenuAccountCreation();
} }
@@ -1876,7 +1876,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
return ( return (
(this.shouldShowInlineMenuAccountCreation() || (this.shouldShowInlineMenuAccountCreation() ||
this.focusedFieldMatchesFillType(InlineMenuFillType.PasswordGeneration)) && this.focusedFieldMatchesFillType(InlineMenuFillTypes.PasswordGeneration)) &&
!!(loginData.password || loginData.newPassword) !!(loginData.password || loginData.newPassword)
); );
} }
@@ -3036,7 +3036,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
} }
const focusFieldShouldShowPasswordGenerator = const focusFieldShouldShowPasswordGenerator =
this.focusedFieldMatchesFillType(InlineMenuFillType.PasswordGeneration) || this.focusedFieldMatchesFillType(InlineMenuFillTypes.PasswordGeneration) ||
(showInlineMenuAccountCreation && (showInlineMenuAccountCreation &&
this.focusedFieldMatchesAccountCreationType(InlineMenuAccountCreationFieldType.Password)); this.focusedFieldMatchesAccountCreationType(InlineMenuAccountCreationFieldType.Password));
if (!focusFieldShouldShowPasswordGenerator) { if (!focusFieldShouldShowPasswordGenerator) {

View File

@@ -20,7 +20,7 @@ It is designed with accessibility and responsive design in mind.
| `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. | | `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. |
| `buttonText` | `string` | Yes | The text to display on the button. | | `buttonText` | `string` | Yes | The text to display on the button. |
| `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. | | `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. |
| `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` type. |
## Installation and Setup ## Installation and Setup

View File

@@ -20,7 +20,7 @@ handling, and a disabled state. The component is optimized for accessibility and
| `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. | | `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. |
| `buttonText` | `string` | Yes | The text to display on the badge button. | | `buttonText` | `string` | Yes | The text to display on the badge button. |
| `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. | | `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. |
| `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` type. |
## Installation and Setup ## Installation and Setup

View File

@@ -19,7 +19,7 @@ presenting actionable information.
| ------------------ | ------------------ | ------------ | --------------------------------------------------------------------------------------------------------- | | ------------------ | ------------------ | ------------ | --------------------------------------------------------------------------------------------------------- |
| `ciphers` | `CipherData[]` | Yes | An array of cipher data objects. Each cipher includes metadata such as ID, name, type, and login details. | | `ciphers` | `CipherData[]` | Yes | An array of cipher data objects. Each cipher includes metadata such as ID, name, type, and login details. |
| `notificationType` | `NotificationType` | Yes | Specifies the type of notification, such as `add`, `change`, `unlock`, or `fileless-import`. | | `notificationType` | `NotificationType` | Yes | Specifies the type of notification, such as `add`, `change`, `unlock`, or `fileless-import`. |
| `theme` | `Theme` | Yes | Defines the theme used for styling the notification. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | Defines the theme used for styling the notification. Must match the `Theme` type. |
--- ---

View File

@@ -17,7 +17,7 @@ a close icon for visual clarity. The component is designed to be intuitive and a
| **Prop** | **Type** | **Required** | **Description** | | **Prop** | **Type** | **Required** | **Description** |
| ------------------------- | -------------------- | ------------ | ----------------------------------------------------------- | | ------------------------- | -------------------- | ------------ | ----------------------------------------------------------- |
| `handleCloseNotification` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. | | `handleCloseNotification` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. |
| `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` type. |
## Installation and Setup ## Installation and Setup

View File

@@ -20,7 +20,7 @@ or settings where inline editing is required.
| `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. | | `buttonAction` | `(e: Event) => void` | Yes | The function to execute when the button is clicked. |
| `buttonText` | `string` | Yes | The text displayed as the button's tooltip. | | `buttonText` | `string` | Yes | The text displayed as the button's tooltip. |
| `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. | | `disabled` | `boolean` (default: false) | No | Disables the button when set to `true`. |
| `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | The theme to style the button. Must match the `Theme` type. |
## Installation and Setup ## Installation and Setup

View File

@@ -17,7 +17,7 @@ customization based on the `theme` and `notificationType`.
| **Prop** | **Type** | **Required** | **Description** | | **Prop** | **Type** | **Required** | **Description** |
| ------------------ | ------------------ | ------------ | -------------------------------------------------------------------------------------------------- | | ------------------ | ------------------ | ------------ | -------------------------------------------------------------------------------------------------- |
| `notificationType` | `NotificationType` | Yes | The type of notification footer to display. Options: `add`, `change`, `unlock`, `fileless-import`. | | `notificationType` | `NotificationType` | Yes | The type of notification footer to display. Options: `add`, `change`, `unlock`, `fileless-import`. |
| `theme` | `Theme` | Yes | Defines the theme of the notification footer. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | Defines the theme of the notification footer. Must match the `Theme` type. |
--- ---

View File

@@ -19,7 +19,7 @@ and an optional close button. This component is versatile and can be styled dyna
| ------------------------- | -------------------- | ------------ | ------------------------------------------------------------------- | | ------------------------- | -------------------- | ------------ | ------------------------------------------------------------------- |
| `message` | `string` | Yes | The text message to be displayed in the notification. | | `message` | `string` | Yes | The text message to be displayed in the notification. |
| `standalone` | `boolean` | No | Determines if the notification is displayed independently. | | `standalone` | `boolean` | No | Determines if the notification is displayed independently. |
| `theme` | `Theme` | Yes | Defines the theme of the notification. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | Defines the theme of the notification. Must match the `Theme` type. |
| `handleCloseNotification` | `(e: Event) => void` | No | A callback function triggered when the close button is clicked. | | `handleCloseNotification` | `(e: Event) => void` | No | A callback function triggered when the close button is clicked. |
--- ---

View File

@@ -28,7 +28,7 @@ like size, color, and theme. Each story is an example of how a specific icon can
| `iconLink` | `URL` | No | Defines an external URL associated with the icon, prop exclusive to `Brand Icon`. | | `iconLink` | `URL` | No | Defines an external URL associated with the icon, prop exclusive to `Brand Icon`. |
| `color` | `string` | No | Sets the color of the icon. | | `color` | `string` | No | Sets the color of the icon. |
| `disabled` | `boolean` | No | Disables the icon visually and functionally. | | `disabled` | `boolean` | No | Disables the icon visually and functionally. |
| `theme` | `Theme` | Yes | Defines the theme used to style the icons. Must match the `Theme` enum. | | `theme` | `Theme` | Yes | Defines the theme used to style the icons. Must match the `Theme` type. |
| `size` | `number` | Yes | Sets the width and height of the icon in pixels. | | `size` | `number` | Yes | Sets the width and height of the icon in pixels. |
--- ---

View File

@@ -21,14 +21,16 @@ export const RedirectFocusDirection = {
Next: "next", Next: "next",
} as const; } as const;
// FIXME: update to use a const object instead of a typescript enum export const InlineMenuFillTypes = {
// eslint-disable-next-line @bitwarden/platform/no-enums AccountCreationUsername: 5,
export enum InlineMenuFillType { PasswordGeneration: 6,
AccountCreationUsername = 5, CurrentPasswordUpdate: 7,
PasswordGeneration = 6, } as const;
CurrentPasswordUpdate = 7,
} export type InlineMenuFillTypeValue =
export type InlineMenuFillTypes = InlineMenuFillType | CipherType; (typeof InlineMenuFillTypes)[keyof typeof InlineMenuFillTypes];
export type InlineMenuFillType = InlineMenuFillTypeValue | CipherType;
export const InlineMenuAccountCreationFieldType = { export const InlineMenuAccountCreationFieldType = {
Text: "text", Text: "text",

View File

@@ -6,7 +6,7 @@ import { createPortSpyMock } from "../../../autofill/spec/autofill-mocks";
import { triggerPortOnDisconnectEvent } from "../../../autofill/spec/testing-utils"; import { triggerPortOnDisconnectEvent } from "../../../autofill/spec/testing-utils";
import { Fido2PortName } from "../enums/fido2-port-name.enum"; import { Fido2PortName } from "../enums/fido2-port-name.enum";
import { InsecureCreateCredentialParams, MessageType } from "./messaging/message"; import { InsecureCreateCredentialParams, MessageTypes } from "./messaging/message";
import { MessageWithMetadata, Messenger } from "./messaging/messenger"; import { MessageWithMetadata, Messenger } from "./messaging/messenger";
jest.mock("../../../autofill/utils", () => ({ jest.mock("../../../autofill/utils", () => ({
@@ -71,7 +71,7 @@ describe("Fido2 Content Script", () => {
it("handles a FIDO2 credential creation request message from the window message listener, formats the message and sends the formatted message to the extension background", async () => { it("handles a FIDO2 credential creation request message from the window message listener, formats the message and sends the formatted message to the extension background", async () => {
const message = mock<MessageWithMetadata>({ const message = mock<MessageWithMetadata>({
type: MessageType.CredentialCreationRequest, type: MessageTypes.CredentialCreationRequest,
data: mock<InsecureCreateCredentialParams>(), data: mock<InsecureCreateCredentialParams>(),
}); });
const mockResult = { credentialId: "mock" } as CreateCredentialResult; const mockResult = { credentialId: "mock" } as CreateCredentialResult;
@@ -92,14 +92,14 @@ describe("Fido2 Content Script", () => {
requestId: expect.any(String), requestId: expect.any(String),
}); });
expect(response).toEqual({ expect(response).toEqual({
type: MessageType.CredentialCreationResponse, type: MessageTypes.CredentialCreationResponse,
result: mockResult, result: mockResult,
}); });
}); });
it("handles a FIDO2 credential get request message from the window message listener, formats the message and sends the formatted message to the extension background", async () => { it("handles a FIDO2 credential get request message from the window message listener, formats the message and sends the formatted message to the extension background", async () => {
const message = mock<MessageWithMetadata>({ const message = mock<MessageWithMetadata>({
type: MessageType.CredentialGetRequest, type: MessageTypes.CredentialGetRequest,
data: mock<InsecureCreateCredentialParams>(), data: mock<InsecureCreateCredentialParams>(),
}); });
@@ -121,7 +121,7 @@ describe("Fido2 Content Script", () => {
it("removes the abort handler when the FIDO2 request is complete", async () => { it("removes the abort handler when the FIDO2 request is complete", async () => {
const message = mock<MessageWithMetadata>({ const message = mock<MessageWithMetadata>({
type: MessageType.CredentialCreationRequest, type: MessageTypes.CredentialCreationRequest,
data: mock<InsecureCreateCredentialParams>(), data: mock<InsecureCreateCredentialParams>(),
}); });
const abortController = new AbortController(); const abortController = new AbortController();
@@ -138,16 +138,14 @@ describe("Fido2 Content Script", () => {
it("sends an extension message to abort the FIDO2 request when the abort controller is signaled", async () => { it("sends an extension message to abort the FIDO2 request when the abort controller is signaled", async () => {
const message = mock<MessageWithMetadata>({ const message = mock<MessageWithMetadata>({
type: MessageType.CredentialCreationRequest, type: MessageTypes.CredentialCreationRequest,
data: mock<InsecureCreateCredentialParams>(), data: mock<InsecureCreateCredentialParams>(),
}); });
const abortController = new AbortController(); const abortController = new AbortController();
const abortSpy = jest.spyOn(abortController.signal, "addEventListener"); const abortSpy = jest.spyOn(abortController.signal, "addEventListener");
jest jest.spyOn(chrome.runtime, "sendMessage").mockImplementationOnce(async () => {
.spyOn(chrome.runtime, "sendMessage") abortController.abort();
.mockImplementationOnce(async (extensionId: string, message: unknown, options: any) => { });
abortController.abort();
});
// FIXME: Remove when updating file. Eslint update // FIXME: Remove when updating file. Eslint update
// eslint-disable-next-line @typescript-eslint/no-require-imports // eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -165,7 +163,7 @@ describe("Fido2 Content Script", () => {
it("rejects credential requests and returns an error result", async () => { it("rejects credential requests and returns an error result", async () => {
const errorMessage = "Test error"; const errorMessage = "Test error";
const message = mock<MessageWithMetadata>({ const message = mock<MessageWithMetadata>({
type: MessageType.CredentialCreationRequest, type: MessageTypes.CredentialCreationRequest,
data: mock<InsecureCreateCredentialParams>(), data: mock<InsecureCreateCredentialParams>(),
}); });
const abortController = new AbortController(); const abortController = new AbortController();

View File

@@ -12,7 +12,7 @@ import {
InsecureAssertCredentialParams, InsecureAssertCredentialParams,
InsecureCreateCredentialParams, InsecureCreateCredentialParams,
Message, Message,
MessageType, MessageTypes,
} from "./messaging/message"; } from "./messaging/message";
import { MessageWithMetadata, Messenger } from "./messaging/messenger"; import { MessageWithMetadata, Messenger } from "./messaging/messenger";
@@ -49,21 +49,21 @@ import { MessageWithMetadata, Messenger } from "./messaging/messenger";
abortController.signal.addEventListener("abort", abortHandler); abortController.signal.addEventListener("abort", abortHandler);
try { try {
if (message.type === MessageType.CredentialCreationRequest) { if (message.type === MessageTypes.CredentialCreationRequest) {
return handleCredentialCreationRequestMessage( return handleCredentialCreationRequestMessage(
requestId, requestId,
message.data as InsecureCreateCredentialParams, message.data as InsecureCreateCredentialParams,
); );
} }
if (message.type === MessageType.CredentialGetRequest) { if (message.type === MessageTypes.CredentialGetRequest) {
return handleCredentialGetRequestMessage( return handleCredentialGetRequestMessage(
requestId, requestId,
message.data as InsecureAssertCredentialParams, message.data as InsecureAssertCredentialParams,
); );
} }
if (message.type === MessageType.AbortRequest) { if (message.type === MessageTypes.AbortRequest) {
return sendExtensionMessage("fido2AbortRequest", { abortedRequestId: requestId }); return sendExtensionMessage("fido2AbortRequest", { abortedRequestId: requestId });
} }
} finally { } finally {
@@ -83,7 +83,7 @@ import { MessageWithMetadata, Messenger } from "./messaging/messenger";
): Promise<Message | undefined> { ): Promise<Message | undefined> {
return respondToCredentialRequest( return respondToCredentialRequest(
"fido2RegisterCredentialRequest", "fido2RegisterCredentialRequest",
MessageType.CredentialCreationResponse, MessageTypes.CredentialCreationResponse,
requestId, requestId,
data, data,
); );
@@ -101,7 +101,7 @@ import { MessageWithMetadata, Messenger } from "./messaging/messenger";
): Promise<Message | undefined> { ): Promise<Message | undefined> {
return respondToCredentialRequest( return respondToCredentialRequest(
"fido2GetCredentialRequest", "fido2GetCredentialRequest",
MessageType.CredentialGetResponse, MessageTypes.CredentialGetResponse,
requestId, requestId,
data, data,
); );
@@ -118,7 +118,9 @@ import { MessageWithMetadata, Messenger } from "./messaging/messenger";
*/ */
async function respondToCredentialRequest( async function respondToCredentialRequest(
command: string, command: string,
type: MessageType.CredentialCreationResponse | MessageType.CredentialGetResponse, type:
| typeof MessageTypes.CredentialCreationResponse
| typeof MessageTypes.CredentialGetResponse,
requestId: string, requestId: string,
messageData: InsecureCreateCredentialParams | InsecureAssertCredentialParams, messageData: InsecureCreateCredentialParams | InsecureAssertCredentialParams,
): Promise<Message | undefined> { ): Promise<Message | undefined> {

View File

@@ -2,7 +2,7 @@
// @ts-strict-ignore // @ts-strict-ignore
import { WebauthnUtils } from "../utils/webauthn-utils"; import { WebauthnUtils } from "../utils/webauthn-utils";
import { MessageType } from "./messaging/message"; import { MessageTypes } from "./messaging/message";
import { Messenger } from "./messaging/messenger"; import { Messenger } from "./messaging/messenger";
(function (globalContext) { (function (globalContext) {
@@ -100,13 +100,13 @@ import { Messenger } from "./messaging/messenger";
try { try {
const response = await messenger.request( const response = await messenger.request(
{ {
type: MessageType.CredentialCreationRequest, type: MessageTypes.CredentialCreationRequest,
data: WebauthnUtils.mapCredentialCreationOptions(options, fallbackSupported), data: WebauthnUtils.mapCredentialCreationOptions(options, fallbackSupported),
}, },
options?.signal, options?.signal,
); );
if (response.type !== MessageType.CredentialCreationResponse) { if (response.type !== MessageTypes.CredentialCreationResponse) {
throw new Error("Something went wrong."); throw new Error("Something went wrong.");
} }
@@ -141,19 +141,19 @@ import { Messenger } from "./messaging/messenger";
try { try {
const abortListener = () => const abortListener = () =>
messenger.request({ messenger.request({
type: MessageType.AbortRequest, type: MessageTypes.AbortRequest,
abortedRequestId: abortSignal.toString(), abortedRequestId: abortSignal.toString(),
}); });
internalAbortController.signal.addEventListener("abort", abortListener); internalAbortController.signal.addEventListener("abort", abortListener);
const response = await messenger.request( const response = await messenger.request(
{ {
type: MessageType.CredentialGetRequest, type: MessageTypes.CredentialGetRequest,
data: WebauthnUtils.mapCredentialRequestOptions(options, fallbackSupported), data: WebauthnUtils.mapCredentialRequestOptions(options, fallbackSupported),
}, },
internalAbortController.signal, internalAbortController.signal,
); );
internalAbortController.signal.removeEventListener("abort", abortListener); internalAbortController.signal.removeEventListener("abort", abortListener);
if (response.type !== MessageType.CredentialGetResponse) { if (response.type !== MessageTypes.CredentialGetResponse) {
throw new Error("Something went wrong."); throw new Error("Something went wrong.");
} }
@@ -182,13 +182,13 @@ import { Messenger } from "./messaging/messenger";
try { try {
const response = await messenger.request( const response = await messenger.request(
{ {
type: MessageType.CredentialGetRequest, type: MessageTypes.CredentialGetRequest,
data: WebauthnUtils.mapCredentialRequestOptions(options, fallbackSupported), data: WebauthnUtils.mapCredentialRequestOptions(options, fallbackSupported),
}, },
options?.signal, options?.signal,
); );
if (response.type !== MessageType.CredentialGetResponse) { if (response.type !== MessageTypes.CredentialGetResponse) {
throw new Error("Something went wrong."); throw new Error("Something went wrong.");
} }
@@ -282,7 +282,7 @@ import { Messenger } from "./messaging/messenger";
const type = message.type; const type = message.type;
// Handle cleanup for disconnect request // Handle cleanup for disconnect request
if (type === MessageType.DisconnectRequest) { if (type === MessageTypes.DisconnectRequest) {
destroy(); destroy();
} }
}; };

View File

@@ -7,7 +7,7 @@ import {
} from "../../../autofill/spec/fido2-testing-utils"; } from "../../../autofill/spec/fido2-testing-utils";
import { WebauthnUtils } from "../utils/webauthn-utils"; import { WebauthnUtils } from "../utils/webauthn-utils";
import { MessageType } from "./messaging/message"; import { MessageTypes } from "./messaging/message";
import { Messenger } from "./messaging/messenger"; import { Messenger } from "./messaging/messenger";
const originalGlobalThis = globalThis; const originalGlobalThis = globalThis;
@@ -71,7 +71,7 @@ describe("Fido2 page script with native WebAuthn support", () => {
describe("creating WebAuthn credentials", () => { describe("creating WebAuthn credentials", () => {
beforeEach(() => { beforeEach(() => {
messenger.request = jest.fn().mockResolvedValue({ messenger.request = jest.fn().mockResolvedValue({
type: MessageType.CredentialCreationResponse, type: MessageTypes.CredentialCreationResponse,
result: mockCreateCredentialsResult, result: mockCreateCredentialsResult,
}); });
}); });
@@ -104,7 +104,7 @@ describe("Fido2 page script with native WebAuthn support", () => {
describe("get WebAuthn credentials", () => { describe("get WebAuthn credentials", () => {
beforeEach(() => { beforeEach(() => {
messenger.request = jest.fn().mockResolvedValue({ messenger.request = jest.fn().mockResolvedValue({
type: MessageType.CredentialGetResponse, type: MessageTypes.CredentialGetResponse,
result: mockCredentialAssertResult, result: mockCredentialAssertResult,
}); });
}); });
@@ -147,7 +147,7 @@ describe("Fido2 page script with native WebAuthn support", () => {
it("should destroy the message listener when receiving a disconnect request", async () => { it("should destroy the message listener when receiving a disconnect request", async () => {
jest.spyOn(globalThis.top, "removeEventListener"); jest.spyOn(globalThis.top, "removeEventListener");
const SENDER = "bitwarden-webauthn"; const SENDER = "bitwarden-webauthn";
void messenger.handler({ type: MessageType.DisconnectRequest, SENDER, senderId: "1" }); void messenger.handler({ type: MessageTypes.DisconnectRequest, SENDER, senderId: "1" });
expect(globalThis.top.removeEventListener).toHaveBeenCalledWith("focus", undefined); expect(globalThis.top.removeEventListener).toHaveBeenCalledWith("focus", undefined);
expect(messenger.destroy).toHaveBeenCalled(); expect(messenger.destroy).toHaveBeenCalled();

View File

@@ -6,7 +6,7 @@ import {
} from "../../../autofill/spec/fido2-testing-utils"; } from "../../../autofill/spec/fido2-testing-utils";
import { WebauthnUtils } from "../utils/webauthn-utils"; import { WebauthnUtils } from "../utils/webauthn-utils";
import { MessageType } from "./messaging/message"; import { MessageTypes } from "./messaging/message";
import { Messenger } from "./messaging/messenger"; import { Messenger } from "./messaging/messenger";
const originalGlobalThis = globalThis; const originalGlobalThis = globalThis;
@@ -65,7 +65,7 @@ describe("Fido2 page script without native WebAuthn support", () => {
describe("creating WebAuthn credentials", () => { describe("creating WebAuthn credentials", () => {
beforeEach(() => { beforeEach(() => {
messenger.request = jest.fn().mockResolvedValue({ messenger.request = jest.fn().mockResolvedValue({
type: MessageType.CredentialCreationResponse, type: MessageTypes.CredentialCreationResponse,
result: mockCreateCredentialsResult, result: mockCreateCredentialsResult,
}); });
}); });
@@ -86,7 +86,7 @@ describe("Fido2 page script without native WebAuthn support", () => {
describe("get WebAuthn credentials", () => { describe("get WebAuthn credentials", () => {
beforeEach(() => { beforeEach(() => {
messenger.request = jest.fn().mockResolvedValue({ messenger.request = jest.fn().mockResolvedValue({
type: MessageType.CredentialGetResponse, type: MessageTypes.CredentialGetResponse,
result: mockCredentialAssertResult, result: mockCredentialAssertResult,
}); });
}); });
@@ -108,7 +108,7 @@ describe("Fido2 page script without native WebAuthn support", () => {
it("should destroy the message listener when receiving a disconnect request", async () => { it("should destroy the message listener when receiving a disconnect request", async () => {
jest.spyOn(globalThis.top, "removeEventListener"); jest.spyOn(globalThis.top, "removeEventListener");
const SENDER = "bitwarden-webauthn"; const SENDER = "bitwarden-webauthn";
void messenger.handler({ type: MessageType.DisconnectRequest, SENDER, senderId: "1" }); void messenger.handler({ type: MessageTypes.DisconnectRequest, SENDER, senderId: "1" });
expect(globalThis.top.removeEventListener).toHaveBeenCalledWith("focus", undefined); expect(globalThis.top.removeEventListener).toHaveBeenCalledWith("focus", undefined);
expect(messenger.destroy).toHaveBeenCalled(); expect(messenger.destroy).toHaveBeenCalled();

View File

@@ -5,19 +5,19 @@ import {
AssertCredentialResult, AssertCredentialResult,
} from "@bitwarden/common/platform/abstractions/fido2/fido2-client.service.abstraction"; } from "@bitwarden/common/platform/abstractions/fido2/fido2-client.service.abstraction";
// FIXME: update to use a const object instead of a typescript enum export const MessageTypes = {
// eslint-disable-next-line @bitwarden/platform/no-enums CredentialCreationRequest: 0,
export enum MessageType { CredentialCreationResponse: 1,
CredentialCreationRequest, CredentialGetRequest: 2,
CredentialCreationResponse, CredentialGetResponse: 3,
CredentialGetRequest, AbortRequest: 4,
CredentialGetResponse, DisconnectRequest: 5,
AbortRequest, ReconnectRequest: 6,
DisconnectRequest, AbortResponse: 7,
ReconnectRequest, ErrorResponse: 8,
AbortResponse, } as const;
ErrorResponse,
} export type MessageType = (typeof MessageTypes)[keyof typeof MessageTypes];
/** /**
* The params provided by the page-script are created in an insecure environment and * The params provided by the page-script are created in an insecure environment and
@@ -30,12 +30,12 @@ export type InsecureCreateCredentialParams = Omit<
>; >;
export type CredentialCreationRequest = { export type CredentialCreationRequest = {
type: MessageType.CredentialCreationRequest; type: typeof MessageTypes.CredentialCreationRequest;
data: InsecureCreateCredentialParams; data: InsecureCreateCredentialParams;
}; };
export type CredentialCreationResponse = { export type CredentialCreationResponse = {
type: MessageType.CredentialCreationResponse; type: typeof MessageTypes.CredentialCreationResponse;
result?: CreateCredentialResult; result?: CreateCredentialResult;
}; };
@@ -50,35 +50,35 @@ export type InsecureAssertCredentialParams = Omit<
>; >;
export type CredentialGetRequest = { export type CredentialGetRequest = {
type: MessageType.CredentialGetRequest; type: typeof MessageTypes.CredentialGetRequest;
data: InsecureAssertCredentialParams; data: InsecureAssertCredentialParams;
}; };
export type CredentialGetResponse = { export type CredentialGetResponse = {
type: MessageType.CredentialGetResponse; type: typeof MessageTypes.CredentialGetResponse;
result?: AssertCredentialResult; result?: AssertCredentialResult;
}; };
export type AbortRequest = { export type AbortRequest = {
type: MessageType.AbortRequest; type: typeof MessageTypes.AbortRequest;
abortedRequestId: string; abortedRequestId: string;
}; };
export type DisconnectRequest = { export type DisconnectRequest = {
type: MessageType.DisconnectRequest; type: typeof MessageTypes.DisconnectRequest;
}; };
export type ReconnectRequest = { export type ReconnectRequest = {
type: MessageType.ReconnectRequest; type: typeof MessageTypes.ReconnectRequest;
}; };
export type ErrorResponse = { export type ErrorResponse = {
type: MessageType.ErrorResponse; type: typeof MessageTypes.ErrorResponse;
error: string; error: string;
}; };
export type AbortResponse = { export type AbortResponse = {
type: MessageType.AbortResponse; type: typeof MessageTypes.AbortResponse;
abortedRequestId: string; abortedRequestId: string;
}; };

View File

@@ -1,6 +1,6 @@
// FIXME: Update this file to be type safe and remove this and next line // FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore // @ts-strict-ignore
import { Message, MessageType } from "./message"; import { Message, MessageTypes } from "./message";
const SENDER = "bitwarden-webauthn"; const SENDER = "bitwarden-webauthn";
@@ -80,7 +80,7 @@ export class Messenger {
const abortListener = () => const abortListener = () =>
localPort.postMessage({ localPort.postMessage({
metadata: { SENDER }, metadata: { SENDER },
type: MessageType.AbortRequest, type: MessageTypes.AbortRequest,
}); });
abortSignal?.addEventListener("abort", abortListener); abortSignal?.addEventListener("abort", abortListener);
@@ -92,7 +92,7 @@ export class Messenger {
abortSignal?.removeEventListener("abort", abortListener); abortSignal?.removeEventListener("abort", abortListener);
if (response.type === MessageType.ErrorResponse) { if (response.type === MessageTypes.ErrorResponse) {
const error = new Error(); const error = new Error();
Object.assign(error, JSON.parse(response.error)); Object.assign(error, JSON.parse(response.error));
throw error; throw error;
@@ -119,7 +119,7 @@ export class Messenger {
const abortController = new AbortController(); const abortController = new AbortController();
port.onmessage = (event: MessageEvent<MessageWithMetadata>) => { port.onmessage = (event: MessageEvent<MessageWithMetadata>) => {
if (event.data.type === MessageType.AbortRequest) { if (event.data.type === MessageTypes.AbortRequest) {
abortController.abort(); abortController.abort();
} }
}; };
@@ -133,7 +133,7 @@ export class Messenger {
} catch (error) { } catch (error) {
port.postMessage({ port.postMessage({
SENDER, SENDER,
type: MessageType.ErrorResponse, type: MessageTypes.ErrorResponse,
error: JSON.stringify(error, Object.getOwnPropertyNames(error)), error: JSON.stringify(error, Object.getOwnPropertyNames(error)),
}); });
} finally { } finally {
@@ -157,7 +157,7 @@ export class Messenger {
} }
private async sendDisconnectCommand() { private async sendDisconnectCommand() {
await this.request({ type: MessageType.DisconnectRequest }); await this.request({ type: MessageTypes.DisconnectRequest });
} }
private generateUniqueId() { private generateUniqueId() {

View File

@@ -4,7 +4,7 @@ import { FieldRect } from "../background/abstractions/overlay.background";
import { AutofillFieldQualifierType } from "../enums/autofill-field.enums"; import { AutofillFieldQualifierType } from "../enums/autofill-field.enums";
import { import {
InlineMenuAccountCreationFieldTypes, InlineMenuAccountCreationFieldTypes,
InlineMenuFillTypes, InlineMenuFillType,
} from "../enums/autofill-overlay.enum"; } from "../enums/autofill-overlay.enum";
/** /**
@@ -118,7 +118,7 @@ export default class AutofillField {
checked?: boolean; checked?: boolean;
inlineMenuFillType?: InlineMenuFillTypes; inlineMenuFillType?: InlineMenuFillType;
showPasskeys?: boolean; showPasskeys?: boolean;

View File

@@ -1,7 +1,7 @@
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status"; import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { InlineMenuCipherData } from "../../../background/abstractions/overlay.background"; import { InlineMenuCipherData } from "../../../background/abstractions/overlay.background";
import { InlineMenuFillTypes } from "../../../enums/autofill-overlay.enum"; import { InlineMenuFillType } from "../../../enums/autofill-overlay.enum";
type AutofillInlineMenuListMessage = { command: string }; type AutofillInlineMenuListMessage = { command: string };
@@ -23,7 +23,7 @@ export type InitAutofillInlineMenuListMessage = AutofillInlineMenuListMessage &
theme: string; theme: string;
translations: Record<string, string>; translations: Record<string, string>;
ciphers?: InlineMenuCipherData[]; ciphers?: InlineMenuCipherData[];
inlineMenuFillType?: InlineMenuFillTypes; inlineMenuFillType?: InlineMenuFillType;
showInlineMenuAccountCreation?: boolean; showInlineMenuAccountCreation?: boolean;
showPasskeysLabels?: boolean; showPasskeysLabels?: boolean;
portKey: string; portKey: string;

View File

@@ -10,7 +10,7 @@ import { EVENTS, UPDATE_PASSKEYS_HEADINGS_ON_SCROLL } from "@bitwarden/common/au
import { CipherRepromptType, CipherType } from "@bitwarden/common/vault/enums"; import { CipherRepromptType, CipherType } from "@bitwarden/common/vault/enums";
import { InlineMenuCipherData } from "../../../../background/abstractions/overlay.background"; import { InlineMenuCipherData } from "../../../../background/abstractions/overlay.background";
import { InlineMenuFillTypes } from "../../../../enums/autofill-overlay.enum"; import { InlineMenuFillType } from "../../../../enums/autofill-overlay.enum";
import { buildSvgDomElement, specialCharacterToKeyMap, throttle } from "../../../../utils"; import { buildSvgDomElement, specialCharacterToKeyMap, throttle } from "../../../../utils";
import { import {
creditCardIcon, creditCardIcon,
@@ -42,7 +42,7 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
private cipherListScrollIsDebounced = false; private cipherListScrollIsDebounced = false;
private cipherListScrollDebounceTimeout: number | NodeJS.Timeout; private cipherListScrollDebounceTimeout: number | NodeJS.Timeout;
private currentCipherIndex = 0; private currentCipherIndex = 0;
private inlineMenuFillType: InlineMenuFillTypes; private inlineMenuFillType: InlineMenuFillType;
private showInlineMenuAccountCreation: boolean; private showInlineMenuAccountCreation: boolean;
private showPasskeysLabels: boolean; private showPasskeysLabels: boolean;
private newItemButtonElement: HTMLButtonElement; private newItemButtonElement: HTMLButtonElement;
@@ -1105,8 +1105,8 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
const svgElement = buildSvgDomElement(` const svgElement = buildSvgDomElement(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29">
<circle fill="none" cx="14.5" cy="14.5" r="12.5" <circle fill="none" cx="14.5" cy="14.5" r="12.5"
stroke-width="3" stroke-dasharray="78.5" stroke-width="3" stroke-dasharray="78.5"
stroke-dashoffset="78.5" transform="rotate(-90 14.5 14.5)"></circle> stroke-dashoffset="78.5" transform="rotate(-90 14.5 14.5)"></circle>
<circle fill="none" cx="14.5" cy="14.5" r="14" stroke-width="1"></circle> <circle fill="none" cx="14.5" cy="14.5" r="14" stroke-width="1"></circle>
</svg> </svg>

View File

@@ -6,7 +6,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
import AutofillInit from "../content/autofill-init"; import AutofillInit from "../content/autofill-init";
import { import {
AutofillOverlayElement, AutofillOverlayElement,
InlineMenuFillType, InlineMenuFillTypes,
MAX_SUB_FRAME_DEPTH, MAX_SUB_FRAME_DEPTH,
RedirectFocusDirection, RedirectFocusDirection,
} from "../enums/autofill-overlay.enum"; } from "../enums/autofill-overlay.enum";
@@ -1383,7 +1383,7 @@ describe("AutofillOverlayContentService", () => {
); );
expect(autofillFieldElement.removeEventListener).toHaveBeenCalled(); expect(autofillFieldElement.removeEventListener).toHaveBeenCalled();
expect(inputAccountFieldData.inlineMenuFillType).toEqual( expect(inputAccountFieldData.inlineMenuFillType).toEqual(
InlineMenuFillType.AccountCreationUsername, InlineMenuFillTypes.AccountCreationUsername,
); );
}); });
@@ -1420,7 +1420,7 @@ describe("AutofillOverlayContentService", () => {
await flushPromises(); await flushPromises();
expect(currentPasswordFieldData.inlineMenuFillType).toEqual( expect(currentPasswordFieldData.inlineMenuFillType).toEqual(
InlineMenuFillType.CurrentPasswordUpdate, InlineMenuFillTypes.CurrentPasswordUpdate,
); );
}); });
}); });

View File

@@ -24,7 +24,7 @@ import { AutofillFieldQualifier, AutofillFieldQualifierType } from "../enums/aut
import { import {
AutofillOverlayElement, AutofillOverlayElement,
InlineMenuAccountCreationFieldType, InlineMenuAccountCreationFieldType,
InlineMenuFillType, InlineMenuFillTypes,
MAX_SUB_FRAME_DEPTH, MAX_SUB_FRAME_DEPTH,
RedirectFocusDirection, RedirectFocusDirection,
} from "../enums/autofill-overlay.enum"; } from "../enums/autofill-overlay.enum";
@@ -789,11 +789,11 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
if (!autofillFieldData.fieldQualifier) { if (!autofillFieldData.fieldQualifier) {
switch (autofillFieldData.inlineMenuFillType) { switch (autofillFieldData.inlineMenuFillType) {
case CipherType.Login: case CipherType.Login:
case InlineMenuFillType.CurrentPasswordUpdate: case InlineMenuFillTypes.CurrentPasswordUpdate:
this.qualifyUserFilledField(autofillFieldData, this.loginFieldQualifiers); this.qualifyUserFilledField(autofillFieldData, this.loginFieldQualifiers);
break; break;
case InlineMenuFillType.AccountCreationUsername: case InlineMenuFillTypes.AccountCreationUsername:
case InlineMenuFillType.PasswordGeneration: case InlineMenuFillTypes.PasswordGeneration:
this.qualifyUserFilledField(autofillFieldData, this.accountCreationFieldQualifiers); this.qualifyUserFilledField(autofillFieldData, this.accountCreationFieldQualifiers);
break; break;
case CipherType.Card: case CipherType.Card:
@@ -1106,18 +1106,18 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
*/ */
private setQualifiedAccountCreationFillType(autofillFieldData: AutofillField) { private setQualifiedAccountCreationFillType(autofillFieldData: AutofillField) {
if (this.inlineMenuFieldQualificationService.isNewPasswordField(autofillFieldData)) { if (this.inlineMenuFieldQualificationService.isNewPasswordField(autofillFieldData)) {
autofillFieldData.inlineMenuFillType = InlineMenuFillType.PasswordGeneration; autofillFieldData.inlineMenuFillType = InlineMenuFillTypes.PasswordGeneration;
this.qualifyAccountCreationFieldType(autofillFieldData); this.qualifyAccountCreationFieldType(autofillFieldData);
return; return;
} }
if (this.inlineMenuFieldQualificationService.isUpdateCurrentPasswordField(autofillFieldData)) { if (this.inlineMenuFieldQualificationService.isUpdateCurrentPasswordField(autofillFieldData)) {
autofillFieldData.inlineMenuFillType = InlineMenuFillType.CurrentPasswordUpdate; autofillFieldData.inlineMenuFillType = InlineMenuFillTypes.CurrentPasswordUpdate;
return; return;
} }
if (this.inlineMenuFieldQualificationService.isUsernameField(autofillFieldData)) { if (this.inlineMenuFieldQualificationService.isUsernameField(autofillFieldData)) {
autofillFieldData.inlineMenuFillType = InlineMenuFillType.AccountCreationUsername; autofillFieldData.inlineMenuFillType = InlineMenuFillTypes.AccountCreationUsername;
this.qualifyAccountCreationFieldType(autofillFieldData); this.qualifyAccountCreationFieldType(autofillFieldData);
} }
} }