fix gecko view initialization issues

This commit is contained in:
Fabian Freund
2026-08-09 03:17:24 +02:00
parent 00e8ae7ff0
commit d7055a6f44
3 changed files with 114 additions and 26 deletions
@@ -281,21 +281,15 @@ class _BrowserViewState extends ConsumerState<BrowserView>
child: Visibility(
visible: isGeckoViewVisible,
child: GeckoView(
preInitializationStep: () async {
await ref
.read(eventServiceProvider)
.viewReadyStateEvents
.firstWhere((state) => state == true)
.timeout(
const Duration(seconds: 3),
onTimeout: () {
logger.e(
'Browser fragement not reported ready, trying to intitialize anyways',
);
return true;
},
);
},
// Reports when the native container enters the window, which
// under the [Offstage] above is not until the home surface is
// dismissed. [GeckoView] attaches the browser fragment on every
// such report, so an engine kept alive but unpainted for the
// whole of startup still gets its fragment the moment it is
// shown. See https://github.com/FaFre/WebLibre/issues/557.
viewReadyEvents: ref
.read(eventServiceProvider)
.viewReadyStateEvents,
postInitializationStep: () async {
await widget.postInitializationStep?.call();