mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Safari Web Extension Port from App Extension (#1531)
This commit is contained in:
@@ -167,8 +167,8 @@ export default class MainBackground {
|
||||
return promise.then((result) => result.response === 'unlocked');
|
||||
}
|
||||
});
|
||||
this.storageService = new BrowserStorageService(this.platformUtilsService);
|
||||
this.secureStorageService = new BrowserStorageService(this.platformUtilsService);
|
||||
this.storageService = new BrowserStorageService();
|
||||
this.secureStorageService = new BrowserStorageService();
|
||||
this.i18nService = new I18nService(BrowserApi.getUILanguage(window));
|
||||
this.cryptoFunctionService = new WebCryptoFunctionService(window, this.platformUtilsService);
|
||||
this.consoleLogService = new ConsoleLogService(false);
|
||||
@@ -252,21 +252,18 @@ export default class MainBackground {
|
||||
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
|
||||
this.platformUtilsService, this.analytics, this.vaultTimeoutService);
|
||||
|
||||
if (!this.isSafari) {
|
||||
this.tabsBackground = new TabsBackground(this);
|
||||
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
||||
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.vaultTimeoutService,
|
||||
this.eventService, this.totpService);
|
||||
this.idleBackground = new IdleBackground(this.vaultTimeoutService, this.storageService,
|
||||
this.notificationsService);
|
||||
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
|
||||
this.vaultTimeoutService);
|
||||
this.windowsBackground = new WindowsBackground(this);
|
||||
}
|
||||
this.tabsBackground = new TabsBackground(this);
|
||||
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
||||
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.vaultTimeoutService,
|
||||
this.eventService, this.totpService);
|
||||
this.idleBackground = new IdleBackground(this.vaultTimeoutService, this.storageService,
|
||||
this.notificationsService);
|
||||
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
|
||||
this.vaultTimeoutService);
|
||||
this.windowsBackground = new WindowsBackground(this);
|
||||
}
|
||||
|
||||
async bootstrap() {
|
||||
SafariApp.init();
|
||||
this.analytics.ga('send', 'pageview', '/background.html');
|
||||
this.containerService.attachToWindow(window);
|
||||
|
||||
@@ -276,13 +273,11 @@ export default class MainBackground {
|
||||
await this.runtimeBackground.init();
|
||||
await this.commandsBackground.init();
|
||||
|
||||
if (!this.isSafari) {
|
||||
await this.tabsBackground.init();
|
||||
await this.contextMenusBackground.init();
|
||||
await this.idleBackground.init();
|
||||
await this.webRequestBackground.init();
|
||||
await this.windowsBackground.init();
|
||||
}
|
||||
await this.tabsBackground.init();
|
||||
await this.contextMenusBackground.init();
|
||||
await this.idleBackground.init();
|
||||
await this.webRequestBackground.init();
|
||||
await this.windowsBackground.init();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(async () => {
|
||||
@@ -297,7 +292,7 @@ export default class MainBackground {
|
||||
}
|
||||
|
||||
async setIcon() {
|
||||
if (this.isSafari || (!chrome.browserAction && !this.sidebarAction)) {
|
||||
if (!chrome.browserAction && !this.sidebarAction) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,7 +311,7 @@ export default class MainBackground {
|
||||
}
|
||||
|
||||
async refreshBadgeAndMenu(forLocked: boolean = false) {
|
||||
if (this.isSafari || !chrome.windows || !chrome.contextMenus) {
|
||||
if (!chrome.windows || !chrome.contextMenus) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -447,7 +442,7 @@ export default class MainBackground {
|
||||
}
|
||||
|
||||
private async buildContextMenu() {
|
||||
if (this.isSafari || !chrome.contextMenus || this.buildingContextMenu) {
|
||||
if (!chrome.contextMenus || this.buildingContextMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user