1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[PM-18039] Add initial verison of IpcServices to client (#13373)

* feat: add foreground ipc service

* refactor: create abstract ipc service in libs

* wip: remove IPC service complexity

The code was making some wrong assumptions about how IPC is going to work. I'm removing everything and starting the content-script instead

* feat: working message sending from page to background

* refactor: move into common

* feat: somewhat complete web <-> browser link

* wip: ping command from web

* fix: import path

* fix: wip urls

* wip: add console log

* feat: successfull message sending (not receiving)

* feat: implement IPC using new refactored framework

* wip: add some console logs

* wip: almost working ping/pong

* feat: working ping/pong

* chore: clean-up ping/pong and some console logs

* chore: remove unused file

* fix: override lint rule

* chore: remove unused ping message

* feat: add tests for message queue

* fix: adapt to name changes and modifications to SDK branch

* fix: missing import

* fix: remove content script from manifest

The feature is not ready for prodution code yet. We will add dynamic injection with feature-flag support in a follow-up PR

* fix: remove fileless lp

* fix: make same changes to manifest v2

* fix: initialization functions

Add missing error handling, wait for the SDK to load and properly depend on the log service

* feat: use named id field

* chore: update sdk version to include IPC changes

* fix: remove messages$ buffer

* fix: forgot to commit package-lock

* feat: add additional destination check

* feat: only import type in ipc-message

* fix: typing issues

* feat: check message origin
This commit is contained in:
Andreas Coroiu
2025-04-08 15:06:39 +02:00
committed by GitHub
parent b488253722
commit 772b42f5b5
16 changed files with 340 additions and 6 deletions

View File

@@ -111,6 +111,7 @@ import {
} from "@bitwarden/common/platform/abstractions/storage.service";
import { SystemService as SystemServiceAbstraction } from "@bitwarden/common/platform/abstractions/system.service";
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
import { IpcService } from "@bitwarden/common/platform/ipc";
import { Message, MessageListener, MessageSender } from "@bitwarden/common/platform/messaging";
// eslint-disable-next-line no-restricted-imports -- Used for dependency creation
import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/internal";
@@ -259,6 +260,7 @@ import { BackgroundBrowserBiometricsService } from "../key-management/biometrics
import VaultTimeoutService from "../key-management/vault-timeout/vault-timeout.service";
import { BrowserApi } from "../platform/browser/browser-api";
import { flagEnabled } from "../platform/flags";
import { IpcBackgroundService } from "../platform/ipc/ipc-background.service";
import { UpdateBadge } from "../platform/listeners/update-badge";
/* eslint-disable no-restricted-imports */
import { ChromeMessageSender } from "../platform/messaging/chrome-message.sender";
@@ -403,6 +405,8 @@ export default class MainBackground {
inlineMenuFieldQualificationService: InlineMenuFieldQualificationService;
taskService: TaskService;
ipcService: IpcService;
onUpdatedRan: boolean;
onReplacedRan: boolean;
loginToAutoFill: CipherView = null;
@@ -1309,6 +1313,8 @@ export default class MainBackground {
);
this.inlineMenuFieldQualificationService = new InlineMenuFieldQualificationService();
this.ipcService = new IpcBackgroundService(this.logService);
}
async bootstrap() {
@@ -1382,6 +1388,7 @@ export default class MainBackground {
}
await this.initOverlayAndTabsBackground();
await this.ipcService.init();
return new Promise<void>((resolve) => {
setTimeout(async () => {