Skip to content

Commit 1d253fb

Browse files
authored
$WEBVIEW2__NAVSTATUS__NAV_ERROR
I've updated the Global Enum and the OnMessageReceived function to include a NAV_ERROR state. This prevents the _NetWebView2_LoadWait function from getting stuck in an infinite loop when a navigation fails, which previously caused the GUI to become unresponsive.
1 parent 1d90326 commit 1d253fb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

NetWebView2Lib.au3

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Global Enum _
2929
$WEBVIEW2__NAVSTATUS__STARTING, _
3030
$WEBVIEW2__NAVSTATUS__URL_CHANGED, _
3131
$WEBVIEW2__NAVSTATUS__COMPLETED, _
32-
$WEBVIEW2__NAVSTATUS__TITLE_CHANGED
32+
$WEBVIEW2__NAVSTATUS__TITLE_CHANGED, _
33+
$WEBVIEW2__NAVSTATUS__NAV_ERROR ; 👈
3334

3435
#Region ; NetWebView2Lib UDF - core function
3536
; #FUNCTION# ====================================================================================================================
@@ -584,6 +585,10 @@ Func __NetWebView2_WebViewEvents__OnMessageReceived($sMsg)
584585
; Filter minor resize glitches
585586
If $iW > 50 And $iH > 50 Then __NetWebView2_Log(@ScriptLineNumber, $s_Prefix & $iW & "x" & $iH, 1)
586587
EndIf
588+
589+
Case "NAV_ERROR"
590+
__NetWebView2_NavigationStatus($WEBVIEW2__NAVSTATUS__NAV_ERROR) ; Consider it complete, even if with an error ; 👈
591+
587592
Case Else
588593
__NetWebView2_Log(@ScriptLineNumber, $s_Prefix & (StringLen($sMsg) > 150 ? StringLeft($sMsg, 150) & "..." : $sMsg), 1)
589594
EndSwitch
@@ -710,3 +715,4 @@ Func __NetWebView2_WebViewEvents__OnContextMenu($sMenuData)
710715
EndFunc ;==>__NetWebView2_WebViewEvents__OnContextMenu
711716
#EndRegion ; NetWebView2Lib UDF - === EVENT HANDLERS ===
712717

718+

0 commit comments

Comments
 (0)