diff --git a/apps/browser/src/autofill/content/autofill-init.ts b/apps/browser/src/autofill/content/autofill-init.ts index 55ca3efde64..048173a6cb2 100644 --- a/apps/browser/src/autofill/content/autofill-init.ts +++ b/apps/browser/src/autofill/content/autofill-init.ts @@ -86,7 +86,7 @@ class AutofillInit implements AutofillInitInterface { const sendCollectDetailsMessage = () => { this.clearCollectPageDetailsOnLoadTimeout(); this.collectPageDetailsOnLoadTimeout = setTimeout( - () => sendExtensionMessage("bgCollectPageDetails", { sender: "autofillInit" }), + () => this.sendExtensionMessage("bgCollectPageDetails", { sender: "autofillInit" }), 250, ); }; @@ -202,15 +202,6 @@ class AutofillInit implements AutofillInitInterface { return true; }; - /** - * Clears the send collect details message timeout. - */ - private clearSendCollectDetailsMessageTimeout() { - if (this.sendCollectDetailsMessageTimeout) { - clearTimeout(this.sendCollectDetailsMessageTimeout as number); - } - } - /** * Handles destroying the autofill init content script. Removes all * listeners, timeouts, and object instances to prevent memory leaks. @@ -221,7 +212,6 @@ class AutofillInit implements AutofillInitInterface { this.collectAutofillContentService.destroy(); this.autofillOverlayContentService?.destroy(); this.inlineMenuElements?.destroy(); - this.clearSendCollectDetailsMessageTimeout(); } } diff --git a/apps/browser/src/vault/fido2/background/fido2.background.spec.ts b/apps/browser/src/vault/fido2/background/fido2.background.spec.ts index 534d8a99c5b..13eab00665c 100644 --- a/apps/browser/src/vault/fido2/background/fido2.background.spec.ts +++ b/apps/browser/src/vault/fido2/background/fido2.background.spec.ts @@ -12,7 +12,7 @@ import { Fido2ClientService } from "@bitwarden/common/vault/services/fido2/fido2 import { createPortSpyMock } from "../../../autofill/spec/autofill-mocks"; import { flushPromises, - sendExtensionRuntimeMessage, + sendMockExtensionMessage, triggerPortOnDisconnectEvent, triggerRuntimeOnConnectEvent, } from "../../../autofill/spec/testing-utils"; @@ -263,7 +263,7 @@ describe("Fido2Background", () => { it("ignores messages that do not have a handler associated with a command within the message", () => { const message = mock({ command: "nonexistentCommand" }); - sendExtensionRuntimeMessage(message); + sendMockExtensionMessage(message); expect(abortManagerMock.abort).not.toHaveBeenCalled(); }); @@ -274,7 +274,7 @@ describe("Fido2Background", () => { const sendResponse = jest.fn(); fido2ClientService.createCredential.mockRejectedValue(new Error("error")); - sendExtensionRuntimeMessage(message, sender, sendResponse); + sendMockExtensionMessage(message, sender, sendResponse); await flushPromises(); expect(sendResponse).toHaveBeenCalledWith({ error: { message: "error" } }); @@ -287,7 +287,7 @@ describe("Fido2Background", () => { abortedRequestId: "123", }); - sendExtensionRuntimeMessage(message); + sendMockExtensionMessage(message); await flushPromises(); expect(abortManagerMock.abort).toHaveBeenCalledWith(message.abortedRequestId); @@ -302,7 +302,7 @@ describe("Fido2Background", () => { data: mock(), }); - sendExtensionRuntimeMessage(message, senderMock); + sendMockExtensionMessage(message, senderMock); await flushPromises(); expect(fido2ClientService.createCredential).toHaveBeenCalledWith( @@ -323,7 +323,7 @@ describe("Fido2Background", () => { data: mock(), }); - sendExtensionRuntimeMessage(message, senderMock); + sendMockExtensionMessage(message, senderMock); await flushPromises(); expect(fido2ClientService.assertCredential).toHaveBeenCalledWith(