mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
[PM-14349] Collection of page details on websites with ShadowDOM elements might not capture form elements (#11809)
This commit is contained in:
parent
00e1c936fb
commit
227e9c4c22
@ -980,7 +980,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
||||
const queueLength = this.mutationsQueue.length;
|
||||
|
||||
if (!this.domQueryService.pageContainsShadowDomElements()) {
|
||||
this.domQueryService.checkPageContainsShadowDom();
|
||||
this.checkPageContainsShadowDom();
|
||||
}
|
||||
|
||||
for (let queueIndex = 0; queueIndex < queueLength; queueIndex++) {
|
||||
@ -999,6 +999,29 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
||||
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();
|
||||
if (this.domQueryService.pageContainsShadowDomElements()) {
|
||||
this.flagPageDetailsUpdateIsRequired();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -1023,11 +1046,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
|
||||
(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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user