File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ async Task<Navigation> WaitForEventNavigationAsync()
114114 var navigationTcs = new TaskCompletionSource < Navigation > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
115115
116116 // TODO: Async void is not safe. Refactor code.
117- BrowsingContext . Navigation += ( sender , args ) => navigationTcs . SetResult ( args . Navigation ) ;
117+ BrowsingContext . Navigation += ( sender , args ) => navigationTcs . TrySetResult ( args . Navigation ) ;
118118
119119 await navigationTcs . Task . ConfigureAwait ( false ) ;
120120
@@ -182,14 +182,14 @@ private Task WaitForLoadAsync(NavigationOptions options)
182182 if ( waitUntil . Contains ( WaitUntilNavigation . Load ) )
183183 {
184184 var loadTcs = new TaskCompletionSource < bool > ( ) ;
185- BrowsingContext . Load += ( sender , args ) => loadTcs . SetResult ( true ) ;
185+ BrowsingContext . Load += ( sender , args ) => loadTcs . TrySetResult ( true ) ;
186186 tasks . Add ( loadTcs . Task ) ;
187187 }
188188
189189 if ( waitUntil . Contains ( WaitUntilNavigation . DOMContentLoaded ) )
190190 {
191191 var domContentLoadedTcs = new TaskCompletionSource < bool > ( ) ;
192- BrowsingContext . DomContentLoaded += ( sender , args ) => domContentLoadedTcs . SetResult ( true ) ;
192+ BrowsingContext . DomContentLoaded += ( sender , args ) => domContentLoadedTcs . TrySetResult ( true ) ;
193193 tasks . Add ( domContentLoadedTcs . Task ) ;
194194 }
195195
You can’t perform that action at this time.
0 commit comments