1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-02 17:53:41 +00:00

[PM-25615] Handle missing autofillOverlayContentService case (#18369)

* handle missing autofillOverlayContentService case

* additional checks autofillOverlayContentService
This commit is contained in:
Jonathan Prusik
2026-01-22 17:10:47 -05:00
committed by GitHub
parent a28193f880
commit dafa00346c

View File

@@ -96,7 +96,9 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
*/
async getPageDetails(): Promise<AutofillPageDetails> {
// Set up listeners on top-layer candidates that predate Mutation Observer setup
this.setupInitialTopLayerListeners();
if (this.autofillOverlayContentService) {
this.setupInitialTopLayerListeners();
}
if (!this.mutationObserver) {
this.setupMutationObserver();
@@ -1072,19 +1074,21 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
}
private setupTopLayerCandidateListener = (element: Element) => {
const ownedTags = this.autofillOverlayContentService.getOwnedInlineMenuTagNames() || [];
this.ownedExperienceTagNames = ownedTags;
if (this.autofillOverlayContentService) {
const ownedTags = this.autofillOverlayContentService.getOwnedInlineMenuTagNames() || [];
this.ownedExperienceTagNames = ownedTags;
if (!ownedTags.includes(element.tagName)) {
element.addEventListener("toggle", (event: ToggleEvent) => {
if (event.newState === "open") {
// Add a slight delay (but faster than a user's reaction), to ensure the layer
// positioning happens after any triggered toggle has completed.
setTimeout(this.autofillOverlayContentService.refreshMenuLayerPosition, 100);
}
});
if (!ownedTags.includes(element.tagName)) {
element.addEventListener("toggle", (event: ToggleEvent) => {
if (event.newState === "open") {
// Add a slight delay (but faster than a user's reaction), to ensure the layer
// positioning happens after any triggered toggle has completed.
setTimeout(this.autofillOverlayContentService.refreshMenuLayerPosition, 100);
}
});
this.autofillOverlayContentService.refreshMenuLayerPosition();
this.autofillOverlayContentService.refreshMenuLayerPosition();
}
}
};