fix(omnibox): skip engine init in standalone mode
- commit
- 70e775c2e521f8f1b00cacf28382981ed0273e9e
- author
- brice · · 2026-04-16 03:15 UTC
- parent
- 2f5a6d2
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +20 -6
M cmd/dumber/main.go +20 -6
| @@ -237,9 +237,15 @@ func runStandaloneOmnibox() int { | |||
| 237 | 237 | ||
| 238 | 238 | preInitializeAdwaitaForCEF(cfg, initResult, ui.EnsureAdwaitaInitialized) | |
| 239 | 239 | ||
| 240 | - | engine, repos, dbCleanup, err := initStackAndRepos(ctx, cfg, initResult, false) | |
| 240 | + | // Standalone omnibox intentionally skips browser-engine initialization. | |
| 241 | + | // When the main browser is already running under CEF, spinning up another CEF | |
| 242 | + | // engine for the omnibox process triggers Chromium's already-running-app | |
| 243 | + | // relaunch path and can turn the `omnibox` subcommand into a bogus browser | |
| 244 | + | // URL (`omnibox/`). The standalone omnibox only needs repos/use cases/theme; | |
| 245 | + | // actual browser navigation is handed off via LaunchBrowserURL. | |
| 246 | + | repos, dbCleanup, err := initStandaloneOmniboxRepos() | |
| 241 | 247 | if err != nil { | |
| 242 | - | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox runtime") | |
| 248 | + | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox repositories") | |
| 243 | 249 | return 1 | |
| 244 | 250 | } | |
| 245 | 251 | if dbCleanup != nil { | |
| @@ -253,7 +259,7 @@ func runStandaloneOmnibox() int { | |||
| 253 | 259 | initResult.ThemeManager, | |
| 254 | 260 | initResult.ColorResolver, | |
| 255 | 261 | initResult.AdwaitaDetector, | |
| 256 | - | engine, | |
| 262 | + | nil, | |
| 257 | 263 | repos, | |
| 258 | 264 | useCases, | |
| 259 | 265 | nil, | |
| @@ -264,7 +270,7 @@ func runStandaloneOmnibox() int { | |||
| 264 | 270 | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox UI dependencies") | |
| 265 | 271 | return 1 | |
| 266 | 272 | } | |
| 267 | - | runtimeCfg := ui.NewStandaloneOmniboxRuntime(ctx, uiDeps, engine.FaviconDatabase()) | |
| 273 | + | runtimeCfg := ui.NewStandaloneOmniboxRuntime(ctx, uiDeps, nil) | |
| 268 | 274 | ||
| 269 | 275 | return ui.RunStandaloneOmnibox(ctx, runtimeCfg) | |
| 270 | 276 | } | |
| @@ -444,12 +450,20 @@ func initStackAndRepos( | |||
| 444 | 450 | return nil, nil, nil, err | |
| 445 | 451 | } | |
| 446 | 452 | ||
| 447 | - | lazyDB, err := bootstrap.CreateLazyDatabase() | |
| 453 | + | repos, dbCleanup, err := initStandaloneOmniboxRepos() | |
| 448 | 454 | if err != nil { | |
| 449 | 455 | return nil, nil, nil, err | |
| 450 | 456 | } | |
| 457 | + | return engine, repos, dbCleanup, nil | |
| 458 | + | } | |
| 459 | + | ||
| 460 | + | func initStandaloneOmniboxRepos() (*repositories, func(), error) { | |
| 461 | + | lazyDB, err := bootstrap.CreateLazyDatabase() | |
| 462 | + | if err != nil { | |
| 463 | + | return nil, nil, err | |
| 464 | + | } | |
| 451 | 465 | dbCleanup := func() { _ = lazyDB.Close() } | |
| 452 | - | return engine, createLazyRepositories(lazyDB), dbCleanup, nil | |
| 466 | + | return createLazyRepositories(lazyDB), dbCleanup, nil | |
| 453 | 467 | } | |
| 454 | 468 | ||
| 455 | 469 | func configureDeferredInit( | |
| @@ -237,9 +237,15 @@ func runStandaloneOmnibox() int { | |||||
| 237 | 237 | ||||
| 238 | preInitializeAdwaitaForCEF(cfg, initResult, ui.EnsureAdwaitaInitialized) | 238 | preInitializeAdwaitaForCEF(cfg, initResult, ui.EnsureAdwaitaInitialized) | ||
| 239 | 239 | ||||
| 240 | - | engine, repos, dbCleanup, err := initStackAndRepos(ctx, cfg, initResult, false) | 240 | + | // Standalone omnibox intentionally skips browser-engine initialization. |
| 241 | + | // When the main browser is already running under CEF, spinning up another CEF | |||
| 242 | + | // engine for the omnibox process triggers Chromium's already-running-app | |||
| 243 | + | // relaunch path and can turn the `omnibox` subcommand into a bogus browser | |||
| 244 | + | // URL (`omnibox/`). The standalone omnibox only needs repos/use cases/theme; | |||
| 245 | + | // actual browser navigation is handed off via LaunchBrowserURL. | |||
| 246 | + | repos, dbCleanup, err := initStandaloneOmniboxRepos() | |||
| 241 | if err != nil { | 247 | if err != nil { | ||
| 242 | - | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox runtime") | 248 | + | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox repositories") |
| 243 | return 1 | 249 | return 1 | ||
| 244 | } | 250 | } | ||
| 245 | if dbCleanup != nil { | 251 | if dbCleanup != nil { | ||
| @@ -253,7 +259,7 @@ func runStandaloneOmnibox() int { | |||||
| 253 | initResult.ThemeManager, | 259 | initResult.ThemeManager, | ||
| 254 | initResult.ColorResolver, | 260 | initResult.ColorResolver, | ||
| 255 | initResult.AdwaitaDetector, | 261 | initResult.AdwaitaDetector, | ||
| 256 | - | engine, | 262 | + | nil, |
| 257 | repos, | 263 | repos, | ||
| 258 | useCases, | 264 | useCases, | ||
| 259 | nil, | 265 | nil, | ||
| @@ -264,7 +270,7 @@ func runStandaloneOmnibox() int { | |||||
| 264 | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox UI dependencies") | 270 | logging.FromContext(ctx).Error().Err(err).Msg("failed to initialize standalone omnibox UI dependencies") | ||
| 265 | return 1 | 271 | return 1 | ||
| 266 | } | 272 | } | ||
| 267 | - | runtimeCfg := ui.NewStandaloneOmniboxRuntime(ctx, uiDeps, engine.FaviconDatabase()) | 273 | + | runtimeCfg := ui.NewStandaloneOmniboxRuntime(ctx, uiDeps, nil) |
| 268 | 274 | ||||
| 269 | return ui.RunStandaloneOmnibox(ctx, runtimeCfg) | 275 | return ui.RunStandaloneOmnibox(ctx, runtimeCfg) | ||
| 270 | } | 276 | } | ||
| @@ -444,12 +450,20 @@ func initStackAndRepos( | |||||
| 444 | return nil, nil, nil, err | 450 | return nil, nil, nil, err | ||
| 445 | } | 451 | } | ||
| 446 | 452 | ||||
| 447 | - | lazyDB, err := bootstrap.CreateLazyDatabase() | 453 | + | repos, dbCleanup, err := initStandaloneOmniboxRepos() |
| 448 | if err != nil { | 454 | if err != nil { | ||
| 449 | return nil, nil, nil, err | 455 | return nil, nil, nil, err | ||
| 450 | } | 456 | } | ||
| 457 | + | return engine, repos, dbCleanup, nil | |||
| 458 | + | } | |||
| 459 | + | ||||
| 460 | + | func initStandaloneOmniboxRepos() (*repositories, func(), error) { | |||
| 461 | + | lazyDB, err := bootstrap.CreateLazyDatabase() | |||
| 462 | + | if err != nil { | |||
| 463 | + | return nil, nil, err | |||
| 464 | + | } | |||
| 451 | dbCleanup := func() { _ = lazyDB.Close() } | 465 | dbCleanup := func() { _ = lazyDB.Close() } | ||
| 452 | - | return engine, createLazyRepositories(lazyDB), dbCleanup, nil | 466 | + | return createLazyRepositories(lazyDB), dbCleanup, nil |
| 453 | } | 467 | } | ||
| 454 | 468 | ||||
| 455 | func configureDeferredInit( | 469 | func configureDeferredInit( | ||