Commit a07954a
[Edge] Use getWebView(false) in registerFunctionScript to avoid pumping past NavigationCompleted
Previously, registerFunctionScript called getWebView(true), which pumps
the event loop until all pending WebView2 tasks in lastWebViewTask are
done — including any Navigate call scheduled by a preceding setUrl().
This caused NavigationCompleted to fire during the pump, before the
caller of createFunction() had a chance to register a ProgressListener.
The NavigationCompleted event was therefore lost and the ProgressListener
never fired, causing tests that register the listener after creating a
BrowserFunction to time out.
Using getWebView(false) limits the pump to waiting only for WebView2
initialization (webViewWrapperFuture::isDone). The Navigate call is
chained on the ForkJoinPool after initialization completes and cannot
have run yet when getWebView(false) returns, so NavigationCompleted
cannot fire during registerFunctionScript. AddScriptToExecuteOnDocumentCreated
is still called on a fully initialized WebView2 instance.
The currently loaded document is not affected: super.createFunction()
already injects the function script into it via nonBlockingExecute()
before registerFunctionScript is entered.
See #3254
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 99e5332 commit a07954a
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1858 | 1858 | | |
1859 | 1859 | | |
1860 | 1860 | | |
1861 | | - | |
| 1861 | + | |
1862 | 1862 | | |
1863 | 1863 | | |
1864 | 1864 | | |
| |||
0 commit comments