[PM-8519] Inline menu fails to update credentials after saving credentials when unlocking extension (#9462)
* Add Back Foreground & Background Derived State * Do Dependency Injection * Defend `map` Calls * Remove Folder Change * Add Helper For Preparing a Record For Use in `forkJoin` * Update & Test CryptoService Changes * Delete Unused Code * Update DeviceTrustService * Update CipherService * Make `userPublicKey$` Public * Rename convertValues File * Switch to `MonoTypeOperatorFunction` * Remove Unnecessary `async` * Remove Unnecessary Mock * Update libs/common/src/platform/abstractions/crypto.service.ts Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com> * Add `convertValues` Tests * Add Doc Comments * Convert to `function`'s Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com> * Fix Test Typos * Add param doc * Update Test Name * Add `@throws` Docs * [PM-8519] Inline Menu fails to Update Credentials After Saving New Cipher When Unlocking Extension * Revert "Merge branch 'reintroduce-foreground-background-derived' into autofill/pm-8519-inline-menu-fails-to-update-credentials-after-saving-credentials-when-unlocking-extension" This reverts commit53b060dac1
, reversing changes made to15b9a237b8
. --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
This commit is contained in:
parent
917c5fff5b
commit
ce69b25d54
|
@ -77,7 +77,9 @@ type OverlayBackgroundExtensionMessageHandlers = {
|
||||||
updateFocusedFieldData: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
updateFocusedFieldData: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
||||||
collectPageDetailsResponse: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
collectPageDetailsResponse: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
||||||
unlockCompleted: ({ message }: BackgroundMessageParam) => void;
|
unlockCompleted: ({ message }: BackgroundMessageParam) => void;
|
||||||
|
addedCipher: () => void;
|
||||||
addEditCipherSubmitted: () => void;
|
addEditCipherSubmitted: () => void;
|
||||||
|
editedCipher: () => void;
|
||||||
deletedCipher: () => void;
|
deletedCipher: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1000,29 +1000,23 @@ describe("OverlayBackground", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("addEditCipherSubmitted message handler", () => {
|
describe("extension messages that trigger an update of the inline menu ciphers", () => {
|
||||||
it("updates the overlay ciphers", () => {
|
const extensionMessages = [
|
||||||
const message = {
|
"addedCipher",
|
||||||
command: "addEditCipherSubmitted",
|
"addEditCipherSubmitted",
|
||||||
};
|
"editedCipher",
|
||||||
jest.spyOn(overlayBackground as any, "updateOverlayCiphers").mockImplementation();
|
"deletedCipher",
|
||||||
|
];
|
||||||
|
|
||||||
sendMockExtensionMessage(message);
|
beforeEach(() => {
|
||||||
|
jest.spyOn(overlayBackground, "updateOverlayCiphers").mockImplementation();
|
||||||
expect(overlayBackground["updateOverlayCiphers"]).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe("deletedCipher message handler", () => {
|
extensionMessages.forEach((message) => {
|
||||||
it("updates the overlay ciphers", () => {
|
it(`triggers an update of the overlay ciphers when the ${message} message is received`, () => {
|
||||||
const message = {
|
sendMockExtensionMessage({ command: message });
|
||||||
command: "deletedCipher",
|
expect(overlayBackground.updateOverlayCiphers).toHaveBeenCalled();
|
||||||
};
|
});
|
||||||
jest.spyOn(overlayBackground as any, "updateOverlayCiphers").mockImplementation();
|
|
||||||
|
|
||||||
sendMockExtensionMessage(message);
|
|
||||||
|
|
||||||
expect(overlayBackground["updateOverlayCiphers"]).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -72,7 +72,9 @@ class OverlayBackground implements OverlayBackgroundInterface {
|
||||||
updateFocusedFieldData: ({ message, sender }) => this.setFocusedFieldData(message, sender),
|
updateFocusedFieldData: ({ message, sender }) => this.setFocusedFieldData(message, sender),
|
||||||
collectPageDetailsResponse: ({ message, sender }) => this.storePageDetails(message, sender),
|
collectPageDetailsResponse: ({ message, sender }) => this.storePageDetails(message, sender),
|
||||||
unlockCompleted: ({ message }) => this.unlockCompleted(message),
|
unlockCompleted: ({ message }) => this.unlockCompleted(message),
|
||||||
|
addedCipher: () => this.updateOverlayCiphers(),
|
||||||
addEditCipherSubmitted: () => this.updateOverlayCiphers(),
|
addEditCipherSubmitted: () => this.updateOverlayCiphers(),
|
||||||
|
editedCipher: () => this.updateOverlayCiphers(),
|
||||||
deletedCipher: () => this.updateOverlayCiphers(),
|
deletedCipher: () => this.updateOverlayCiphers(),
|
||||||
};
|
};
|
||||||
private readonly overlayButtonPortMessageHandlers: OverlayButtonPortMessageHandlers = {
|
private readonly overlayButtonPortMessageHandlers: OverlayButtonPortMessageHandlers = {
|
||||||
|
|
Loading…
Reference in New Issue