1
0
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:
Jason Ng
2024-03-06 10:48:27 -05:00
committed by GitHub
parent 06993594cc
commit e2a543506a
8 changed files with 56 additions and 8 deletions

View File

@@ -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}`);
}
}
}