-
-
Notifications
You must be signed in to change notification settings - Fork 129
Manifest v3 update #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Manifest v3 update #528
Changes from 5 commits
0d1b213
e056238
3d15e68
69a3ef9
e59869a
bd13796
264cddb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,40 @@ | ||
| import angular from 'angular'; | ||
| import { NgModule } from 'angular-ts-decorators'; | ||
| import { WebExtBackgroundModule } from '../../webext-background/webext-background.module'; | ||
| /** | ||
| * Chromium background entry point for MV3 service worker. | ||
| * Replaces the AngularJS bootstrap with a manual DI container. | ||
| */ | ||
|
|
||
| import browser from 'webextension-polyfill'; | ||
| import { WebExtV160UpgradeProviderService } from '../../shared/webext-upgrade/webext-v1.6.0-upgrade-provider.service'; | ||
| import { setupAngularShim } from '../../webext-background/angular-shims'; | ||
| import { createBackgroundContainer } from '../../webext-background/background-container'; | ||
| import { ChromiumBookmarkService } from '../shared/chromium-bookmark/chromium-bookmark.service'; | ||
| import { ChromiumPlatformService } from '../shared/chromium-platform/chromium-platform.service'; | ||
|
|
||
| @NgModule({ | ||
| id: 'ChromiumBackgroundModule', | ||
| imports: [WebExtBackgroundModule], | ||
| providers: [ChromiumBookmarkService, ChromiumPlatformService] | ||
| }) | ||
| class ChromiumBackgroundModule {} | ||
| // Set up angular shim before any service code runs | ||
| setupAngularShim(); | ||
|
|
||
|
Comment on lines
+13
to
+15
|
||
| // Mark this as the background context | ||
| // eslint-disable-next-line no-undef, no-restricted-globals | ||
| (self as any).__xbs_isBackground = true; | ||
|
|
||
| // Create the DI container with Chromium-specific services | ||
| const { backgroundSvc } = createBackgroundContainer({ | ||
| BookmarkServiceClass: ChromiumBookmarkService, | ||
| PlatformServiceClass: ChromiumPlatformService, | ||
| UpgradeProviderServiceClass: WebExtV160UpgradeProviderService | ||
| }); | ||
|
|
||
| // Register event handlers synchronously (required for MV3 service workers) | ||
| let startupInitiated = false; | ||
|
|
||
| browser.runtime.onInstalled.addListener((details) => { | ||
| if (startupInitiated) return; | ||
| startupInitiated = true; | ||
| backgroundSvc.onInstall(details.reason); | ||
| }); | ||
|
|
||
| angular.element(document).ready(() => { | ||
| angular.bootstrap(document, [(ChromiumBackgroundModule as NgModule).module.name]); | ||
| browser.runtime.onStartup.addListener(() => { | ||
| if (startupInitiated) return; | ||
| startupInitiated = true; | ||
| backgroundSvc.init(); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.