1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

Pass tab onto getClickedElement, no need to look up the current tab

This commit is contained in:
Daniel James Smith 2021-10-19 16:04:32 +02:00
parent 421ab36215
commit 0f000731b9
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726

View File

@ -31,7 +31,7 @@ export default class ContextMenusBackground {
if (info.menuItemId === 'generate-password') {
await this.generatePasswordToClipboard();
} else if (info.menuItemId === 'copy-identifier') {
await this.getClickedElement(info.frameId);
await this.getClickedElement(tab, info.frameId);
} else if (info.parentMenuItemId === 'autofill' ||
info.parentMenuItemId === 'copy-username' ||
info.parentMenuItemId === 'copy-password' ||
@ -48,8 +48,7 @@ export default class ContextMenusBackground {
this.passwordGenerationService.addHistory(password);
}
private async getClickedElement(frameId: number) {
const tab = await BrowserApi.getTabFromCurrentWindow();
private async getClickedElement(tab: chrome.tabs.Tab, frameId: number) {
if (tab == null) {
return;
}