mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
@@ -21,7 +21,7 @@ jest.mock("../utils", () => {
|
|||||||
const utils = jest.requireActual("../utils");
|
const utils = jest.requireActual("../utils");
|
||||||
return {
|
return {
|
||||||
...utils,
|
...utils,
|
||||||
debounce: jest.fn((fn, wait) => setTimeout(() => fn(), wait)),
|
debounce: jest.fn((fn) => fn),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -947,8 +947,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.mutationsQueue.length) {
|
if (!this.mutationsQueue.length) {
|
||||||
// Collect all mutations and debounce the processing of those mutations by 100ms to ensure we don't process too many mutations at once.
|
requestIdleCallbackPolyfill(debounce(this.processMutations, 100), { timeout: 500 });
|
||||||
debounce(this.processMutations, 100);
|
|
||||||
}
|
}
|
||||||
this.mutationsQueue.push(mutations);
|
this.mutationsQueue.push(mutations);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export function requestIdleCallbackPolyfill(
|
|||||||
return globalThis.requestIdleCallback(() => callback(), options);
|
return globalThis.requestIdleCallback(() => callback(), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return globalThis.setTimeout(() => callback(), 1);
|
const timeoutDelay = options?.timeout || 1;
|
||||||
|
|
||||||
|
return globalThis.setTimeout(() => callback(), timeoutDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user