mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-27 04:03:00 +02:00
[PM-5295] Incorporating methodology for triggering a fallback to the TreeWalker API if issues arise with the deepQuery approach
This commit is contained in:
parent
c0533c1aca
commit
3eb4f38466
@ -20,6 +20,7 @@ import {
|
|||||||
elementIsTextAreaElement,
|
elementIsTextAreaElement,
|
||||||
nodeIsFormElement,
|
nodeIsFormElement,
|
||||||
nodeIsInputElement,
|
nodeIsInputElement,
|
||||||
|
sendExtensionMessage,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service";
|
import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service";
|
||||||
@ -69,6 +70,11 @@ class CollectAutofillContentService implements CollectAutofillContentServiceInte
|
|||||||
inputQuery += `:not([type="${type}"])`;
|
inputQuery += `:not([type="${type}"])`;
|
||||||
}
|
}
|
||||||
this.formFieldQueryString = `${inputQuery}, textarea:not([data-bwignore]), select:not([data-bwignore]), span[data-bwautofill]`;
|
this.formFieldQueryString = `${inputQuery}, textarea:not([data-bwignore]), select:not([data-bwignore]), span[data-bwautofill]`;
|
||||||
|
|
||||||
|
void sendExtensionMessage("getUseTreeWalkerApiForPageDetailsCollectionFeatureFlag").then(
|
||||||
|
(useTreeWalkerStrategyFlag) =>
|
||||||
|
(this.useTreeWalkerStrategyFlagSet = !!useTreeWalkerStrategyFlag?.result),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,7 @@ import { NotificationsService } from "@bitwarden/common/abstractions/notificatio
|
|||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { AutofillOverlayVisibility } from "@bitwarden/common/autofill/constants";
|
import { AutofillOverlayVisibility } from "@bitwarden/common/autofill/constants";
|
||||||
import { AutofillSettingsServiceAbstraction } from "@bitwarden/common/autofill/services/autofill-settings.service";
|
import { AutofillSettingsServiceAbstraction } from "@bitwarden/common/autofill/services/autofill-settings.service";
|
||||||
|
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||||
@ -65,7 +66,10 @@ export default class RuntimeBackground {
|
|||||||
sender: chrome.runtime.MessageSender,
|
sender: chrome.runtime.MessageSender,
|
||||||
sendResponse: (response: any) => void,
|
sendResponse: (response: any) => void,
|
||||||
) => {
|
) => {
|
||||||
const messagesWithResponse = ["biometricUnlock"];
|
const messagesWithResponse = [
|
||||||
|
"biometricUnlock",
|
||||||
|
"getUseTreeWalkerApiForPageDetailsCollectionFeatureFlag",
|
||||||
|
];
|
||||||
|
|
||||||
if (messagesWithResponse.includes(msg.command)) {
|
if (messagesWithResponse.includes(msg.command)) {
|
||||||
this.processMessageWithSender(msg, sender).then(
|
this.processMessageWithSender(msg, sender).then(
|
||||||
@ -177,6 +181,11 @@ export default class RuntimeBackground {
|
|||||||
const result = await this.main.biometricUnlock();
|
const result = await this.main.biometricUnlock();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
case "getUseTreeWalkerApiForPageDetailsCollectionFeatureFlag": {
|
||||||
|
return await this.configService.getFeatureFlag(
|
||||||
|
FeatureFlag.UseTreeWalkerApiForPageDetailsCollection,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ export enum FeatureFlag {
|
|||||||
EnableDeleteProvider = "AC-1218-delete-provider",
|
EnableDeleteProvider = "AC-1218-delete-provider",
|
||||||
ExtensionRefresh = "extension-refresh",
|
ExtensionRefresh = "extension-refresh",
|
||||||
RestrictProviderAccess = "restrict-provider-access",
|
RestrictProviderAccess = "restrict-provider-access",
|
||||||
|
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AllowedFeatureFlagTypes = boolean | number | string;
|
export type AllowedFeatureFlagTypes = boolean | number | string;
|
||||||
@ -44,6 +45,7 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.EnableDeleteProvider]: FALSE,
|
[FeatureFlag.EnableDeleteProvider]: FALSE,
|
||||||
[FeatureFlag.ExtensionRefresh]: FALSE,
|
[FeatureFlag.ExtensionRefresh]: FALSE,
|
||||||
[FeatureFlag.RestrictProviderAccess]: FALSE,
|
[FeatureFlag.RestrictProviderAccess]: FALSE,
|
||||||
|
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
||||||
} satisfies Record<FeatureFlag, AllowedFeatureFlagTypes>;
|
} satisfies Record<FeatureFlag, AllowedFeatureFlagTypes>;
|
||||||
|
|
||||||
export type DefaultFeatureFlagValueType = typeof DefaultFeatureFlagValue;
|
export type DefaultFeatureFlagValueType = typeof DefaultFeatureFlagValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user