1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Fix Copy Custom Field Name on pages with iframes (#2091)

* Improve error messages

* Send getClickedElement msg to specific frameId

* Add support for finding input element from label

* Use i18n for error messages

* Fix unrelated linting
This commit is contained in:
Thomas Rittson
2021-10-07 09:52:33 +10:00
committed by GitHub
parent bbcbcf2b40
commit cffd4b3515
5 changed files with 40 additions and 9 deletions

View File

@@ -30,7 +30,7 @@ export default class ContextMenusBackground {
if (info.menuItemId === 'generate-password') {
await this.generatePasswordToClipboard();
} else if (info.menuItemId === 'copy-identifier') {
await this.getClickedElement();
await this.getClickedElement(info.frameId);
} else if (info.parentMenuItemId === 'autofill' ||
info.parentMenuItemId === 'copy-username' ||
info.parentMenuItemId === 'copy-password' ||
@@ -47,13 +47,13 @@ export default class ContextMenusBackground {
this.passwordGenerationService.addHistory(password);
}
private async getClickedElement() {
private async getClickedElement(frameId: number) {
const tab = await BrowserApi.getTabFromCurrentWindow();
if (tab == null) {
return;
}
BrowserApi.tabSendMessageData(tab, 'getClickedElement');
BrowserApi.tabSendMessage(tab, { command: 'getClickedElement' }, { frameId: frameId });
}
private async cipherAction(info: any) {