1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-04 10:43:47 +00:00

Place detail update at handler level [WIP].

This commit is contained in:
Miles Blackwood
2025-12-16 10:33:49 -05:00
parent f61b94bb08
commit 74b8b5d3c1

View File

@@ -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++) {