From e3fc4547ae55ccf24f36acb09c216f4c83358bac Mon Sep 17 00:00:00 2001 From: md-5 Date: Sat, 7 Sep 2024 07:22:43 +1000 Subject: [PATCH] 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. --- .../src/autofill/services/collect-autofill-content.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/browser/src/autofill/services/collect-autofill-content.service.ts b/apps/browser/src/autofill/services/collect-autofill-content.service.ts index 2cdcbd6702..efacafbe88 100644 --- a/apps/browser/src/autofill/services/collect-autofill-content.service.ts +++ b/apps/browser/src/autofill/services/collect-autofill-content.service.ts @@ -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;