From 74b8b5d3c142d76ebb97290a55a41b3a7c61260e Mon Sep 17 00:00:00 2001 From: Miles Blackwood Date: Tue, 16 Dec 2025 10:33:49 -0500 Subject: [PATCH] Place detail update at handler level [WIP]. --- .../services/collect-autofill-content.service.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 2213a59bf74..8ac56425c81 100644 --- a/apps/browser/src/autofill/services/collect-autofill-content.service.ts +++ b/apps/browser/src/autofill/services/collect-autofill-content.service.ts @@ -964,6 +964,13 @@ export class CollectAutofillContentService implements CollectAutofillContentServ return; } + if (this.domQueryService.checkPageContainsShadowDom()) { + requestIdleCallbackPolyfill( + debounce(() => this.requirePageDetailsUpdate(), 100), + { timeout: 500 }, + ); + } + if (!this.mutationsQueue.length) { requestIdleCallbackPolyfill(debounce(this.processMutations, 100), { timeout: 500 }); } @@ -997,13 +1004,6 @@ export class CollectAutofillContentService implements CollectAutofillContentServ * within an idle callback to help with performance and prevent excessive updates. */ private processMutations = () => { - // If the page contains shadow DOM, we require a page details update from the autofill service. - // Will wait for an idle moment on main thread to execute, unless timeout has passed. - requestIdleCallbackPolyfill( - () => this.domQueryService.checkPageContainsShadowDom() && this.requirePageDetailsUpdate(), - { timeout: 500 }, - ); - const queueLength = this.mutationsQueue.length; for (let queueIndex = 0; queueIndex < queueLength; queueIndex++) {