1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-23 03:22:50 +02:00

Handle detached table cells in autofill service (#10880)

Fixes errors and high CPU usage / browser lockup on offending webpages.

HTMLTableCellElement.cellIndex will be -1 if the cell is not part of any row, which will cause getTextContentFromElement to fail since it will not receive a valid sibling cell.
This commit is contained in:
md-5 2024-09-07 07:22:43 +10:00 committed by GitHub
parent 4e1912e24e
commit e3fc4547ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -644,6 +644,10 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
}
const tableDataElementIndex = tableDataElement.cellIndex;
if (tableDataElementIndex < 0) {
return null;
}
const parentSiblingTableRowElement = tableDataElement.closest("tr")
?.previousElementSibling as HTMLTableRowElement;