Skip to content

Commit

Permalink
Handle detached table cells in autofill service (#10880)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
md-5 committed Sep 6, 2024
1 parent 4e1912e commit e3fc454
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e3fc454

Please sign in to comment.