1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00
Files
browser/apps/browser/src/autofill/services/abstractions/collect-autofill-content.service.ts
Cesar Gonzalez bbf1473022 [PM-5295] Improve autofill collection of page details performance (#9063)
* [PM-5295] Improve autofill collection of page details performance

* [PM-5295] Reworking implementation to leverage requestIdleCallback instead of requestAnimationFrame

* [PM-5295] Reworking implementation to leverage requestIdleCallback instead of requestAnimationFrame

* [PM-5295] Incorporating documentation for added methods

* [PM-5295] Reworking how we handle collection of shadowRoot elements

* [PM-5295] Fixing jest tests relating to the defined pseudo selector

* [PM-5295] Fixing jest tests relating to the defined pseudo selector

* [PM-5295] Refactoring

* [PM-5295] Refactoring

* [PM-5295] Refactoring

* [PM-5295] Starting the work to set up the tree walker strategy under a feature flag

* [PM-5295] Incorporating methodology for triggering a fallback to the TreeWalker API if issues arise with the deepQuery approach

* [PM-5295] Fixing jest test
2024-05-23 18:30:37 +00:00

34 lines
1.0 KiB
TypeScript

import AutofillField from "../../models/autofill-field";
import AutofillForm from "../../models/autofill-form";
import AutofillPageDetails from "../../models/autofill-page-details";
import { ElementWithOpId, FormFieldElement } from "../../types";
type AutofillFormElements = Map<ElementWithOpId<HTMLFormElement>, AutofillForm>;
type AutofillFieldElements = Map<ElementWithOpId<FormFieldElement>, AutofillField>;
type UpdateAutofillDataAttributeParams = {
element: ElementWithOpId<HTMLFormElement | FormFieldElement>;
attributeName: string;
dataTarget?: AutofillForm | AutofillField;
dataTargetKey?: string;
};
interface CollectAutofillContentService {
getPageDetails(): Promise<AutofillPageDetails>;
getAutofillFieldElementByOpid(opid: string): HTMLElement | null;
deepQueryElements<T>(
root: Document | ShadowRoot | Element,
selector: string,
isObservingShadowRoot?: boolean,
): T[];
destroy(): void;
}
export {
AutofillFormElements,
AutofillFieldElements,
UpdateAutofillDataAttributeParams,
CollectAutofillContentService,
};