mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 18:53:29 +00:00
[PM-26731] Fix feature flag check for "pm-25855-chromium-importer-abe" (#17102)
* Fix feature flag check for "pm-25855-chromium-importer-abe" The old lofgic actually removed all chromium support when the flag was disabled. It should only remove those browser if the flag is disabled and when on Windows. * Extend tests * Update comment * Remove duplicate test * Add test for when device cannot be detected and throws and error * Add descriptive comment to feature flag test case assertions * Better test assertion --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6b3c4f87c7
commit
9fca0b0138
@@ -61,27 +61,28 @@ export class DefaultImportMetadataService implements ImportMetadataServiceAbstra
|
||||
importers: ImportersMetadata,
|
||||
type: ImportType,
|
||||
client: ClientType,
|
||||
enabled: boolean,
|
||||
withABESupport: boolean,
|
||||
): DataLoader[] | undefined {
|
||||
let loaders = availableLoaders(importers, type, client);
|
||||
let includeABE = false;
|
||||
|
||||
if (enabled && (type === "bravecsv" || type === "chromecsv" || type === "edgecsv")) {
|
||||
if (withABESupport) {
|
||||
return loaders;
|
||||
}
|
||||
|
||||
// Special handling for Brave, Chrome, and Edge CSV imports on Windows Desktop
|
||||
if (type === "bravecsv" || type === "chromecsv" || type === "edgecsv") {
|
||||
try {
|
||||
const device = this.system.environment.getDevice();
|
||||
const isWindowsDesktop = device === DeviceType.WindowsDesktop;
|
||||
if (isWindowsDesktop) {
|
||||
includeABE = true;
|
||||
// Exclude the Chromium loader if on Windows Desktop without ABE support
|
||||
loaders = loaders?.filter((loader) => loader !== Loader.chromium);
|
||||
}
|
||||
} catch {
|
||||
includeABE = true;
|
||||
loaders = loaders?.filter((loader) => loader !== Loader.chromium);
|
||||
}
|
||||
}
|
||||
|
||||
// If the browser is unsupported, remove the chromium loader
|
||||
if (!includeABE) {
|
||||
loaders = loaders?.filter((loader) => loader !== Loader.chromium);
|
||||
}
|
||||
return loaders;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user