mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
PM-6558 Vault Onboarding Extension Check on Install (#8216)
updated browser runtime background to send hasBWInstalled message on installation
This commit is contained in:
@@ -345,10 +345,34 @@ export default class RuntimeBackground {
|
||||
if (await this.environmentService.hasManagedEnvironment()) {
|
||||
await this.environmentService.setUrlsToManagedEnvironment();
|
||||
}
|
||||
|
||||
await this.sendBwInstalledMessageToVault();
|
||||
}
|
||||
|
||||
this.onInstalledReason = null;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
async sendBwInstalledMessageToVault() {
|
||||
try {
|
||||
const vaultUrl = this.environmentService.getWebVaultUrl();
|
||||
const urlObj = new URL(vaultUrl);
|
||||
|
||||
const tabs = await BrowserApi.tabsQuery({ url: `${urlObj.href}*` });
|
||||
|
||||
if (!tabs?.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const tab of tabs) {
|
||||
await BrowserApi.executeScriptInTab(tab.id, {
|
||||
file: "content/send-on-installed-message.js",
|
||||
runAt: "document_end",
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.logService.error(`Error sending on installed message to vault: ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user