1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-20 09:35:22 +02:00

[PM-669] Right Click Autofill List Contains Incorrect Entries (#5711)

This commit is contained in:
Cesar Gonzalez 2023-08-08 15:56:42 -05:00 committed by GitHub
parent eca060d7e6
commit a7cce1a3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 0 deletions

View File

@ -21,6 +21,8 @@ export default class TabsBackground {
}
this.focusedWindowId = windowId;
await this.main.refreshBadge();
await this.main.refreshMenu();
this.main.messagingService.send("windowChanged");
});

View File

@ -81,6 +81,12 @@ export class CipherContextMenuHandler {
);
}
static async windowsOnFocusChangedListener(windowId: number, serviceCache: CachedServices) {
const cipherContextMenuHandler = await CipherContextMenuHandler.create(serviceCache);
const tab = await BrowserApi.getTabFromCurrentWindow();
await cipherContextMenuHandler.update(tab?.url);
}
static async tabsOnActivatedListener(
activeInfo: chrome.tabs.TabActiveInfo,
serviceCache: CachedServices

View File

@ -8,6 +8,7 @@ import {
onCommandListener,
onInstallListener,
runtimeMessageListener,
windowsOnFocusChangedListener,
tabsOnActivatedListener,
tabsOnReplacedListener,
tabsOnUpdatedListener,
@ -18,6 +19,7 @@ if (BrowserApi.manifestVersion === 3) {
chrome.runtime.onInstalled.addListener(onInstallListener);
chrome.alarms.onAlarm.addListener(onAlarmListener);
registerAlarms();
chrome.windows.onFocusChanged.addListener(windowsOnFocusChangedListener);
chrome.tabs.onActivated.addListener(tabsOnActivatedListener);
chrome.tabs.onReplaced.addListener(tabsOnReplacedListener);
chrome.tabs.onUpdated.addListener(tabsOnUpdatedListener);

View File

@ -6,6 +6,11 @@ import { onCommandListener } from "./on-command-listener";
import { onInstallListener } from "./on-install-listener";
import { UpdateBadge } from "./update-badge";
const windowsOnFocusChangedListener = combine([
UpdateBadge.windowsOnFocusChangedListener,
CipherContextMenuHandler.windowsOnFocusChangedListener,
]);
const tabsOnActivatedListener = combine([
UpdateBadge.tabsOnActivatedListener,
CipherContextMenuHandler.tabsOnActivatedListener,
@ -33,6 +38,7 @@ const runtimeMessageListener = combine<
]);
export {
windowsOnFocusChangedListener,
tabsOnActivatedListener,
tabsOnReplacedListener,
tabsOnUpdatedListener,

View File

@ -42,6 +42,13 @@ export class UpdateBadge {
"deletedCipher",
];
static async windowsOnFocusChangedListener(
windowId: number,
serviceCache: Record<string, unknown>
) {
await new UpdateBadge(self).run({ windowId, existingServices: serviceCache });
}
static async tabsOnActivatedListener(
activeInfo: chrome.tabs.TabActiveInfo,
serviceCache: Record<string, unknown>