Skip to content

Commit c68c356

Browse files
gave92Marco Gavelli
authored andcommitted
Call AddWebAllowedObject after navigation
1 parent 762b298 commit c68c356

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/Files.App/UserControls/TerminalView.xaml.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ private async void WebViewControl_Loaded(object sender, Microsoft.UI.Xaml.Routed
131131
await WebViewControl.EnsureCoreWebView2Async(environment);
132132
//WebViewControl.CoreWebView2.OpenDevToolsWindow();
133133
WebViewControl.NavigationCompleted += WebViewControl_NavigationCompleted;
134-
WebViewControl.NavigationStarting += WebViewControl_NavigationStarting;
135134
WebViewControl.CoreWebView2.SetVirtualHostNameToFolderMapping(
136135
"terminal.files",
137136
Path.Combine(Package.Current.InstalledLocation.Path, "Utils", "Terminal", "UI"),
@@ -196,14 +195,10 @@ private Task<TerminalSize> CreateXtermViewAsync(TerminalOptions options, Termina
196195
.ContinueWith(t => JsonSerializer.Deserialize<TerminalSize>(t.Result)!);
197196
}
198197

199-
private void WebViewControl_NavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
198+
private async void WebViewControl_NavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args)
200199
{
201200
var _terminalBridge = new TerminalBridge(this);
202-
_ = WebViewControl.AddWebAllowedObject("terminalBridge", _terminalBridge);
203-
}
204-
205-
private void WebViewControl_NavigationCompleted(WebView2 sender, CoreWebView2NavigationCompletedEventArgs args)
206-
{
201+
await WebViewControl.AddWebAllowedObject("terminalBridge", _terminalBridge);
207202
_tcsNavigationCompleted.TrySetResult(null);
208203
}
209204

0 commit comments

Comments
 (0)