Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-14349] Collection of page details on websites with ShadowDOM elem… #11809

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@
const queueLength = this.mutationsQueue.length;

if (!this.domQueryService.pageContainsShadowDomElements()) {
this.domQueryService.checkPageContainsShadowDom();
this.checkPageContainsShadowDom();

Check warning on line 983 in apps/browser/src/autofill/services/collect-autofill-content.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/services/collect-autofill-content.service.ts#L983

Added line #L983 was not covered by tests
}

for (let queueIndex = 0; queueIndex < queueLength; queueIndex++) {
Expand All @@ -999,6 +999,29 @@
this.mutationsQueue = [];
};

/**
* Handles checking if the current page contains a ShadowDOM element and
* flags that a re-collection of page details is required if it does.
*/
private checkPageContainsShadowDom() {
this.domQueryService.checkPageContainsShadowDom();

Check warning on line 1007 in apps/browser/src/autofill/services/collect-autofill-content.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/services/collect-autofill-content.service.ts#L1007

Added line #L1007 was not covered by tests
if (this.domQueryService.pageContainsShadowDomElements()) {
this.flagPageDetailsUpdateIsRequired();

Check warning on line 1009 in apps/browser/src/autofill/services/collect-autofill-content.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/services/collect-autofill-content.service.ts#L1009

Added line #L1009 was not covered by tests
}
}

/**
* Triggers several flags that indicate that a collection of page details should
* occur again on a subsequent call after a mutation has been observed in the DOM.
*/
private flagPageDetailsUpdateIsRequired() {
this.domRecentlyMutated = true;
if (this.autofillOverlayContentService) {
this.autofillOverlayContentService.pageDetailsUpdateRequired = true;
}
this.noFieldsFound = false;
}

/**
* Processes all mutation records encountered by the mutation observer.
*
Expand All @@ -1023,11 +1046,7 @@
(this.isAutofillElementNodeMutated(mutation.removedNodes, true) ||
this.isAutofillElementNodeMutated(mutation.addedNodes))
) {
this.domRecentlyMutated = true;
if (this.autofillOverlayContentService) {
this.autofillOverlayContentService.pageDetailsUpdateRequired = true;
}
this.noFieldsFound = false;
this.flagPageDetailsUpdateIsRequired();
return;
}

Expand Down
Loading