@@ -88,8 +88,6 @@ Global Const $_WD_JSON_Shadow = "[value][" & $_WD_SHADOW_ID & "]"
88
88
Global Const $_WD_JSON_Error = " [value][error]"
89
89
Global Const $_WD_JSON_Message = " [value][message]"
90
90
91
- Global Const $JSON_MLREFORMAT = 1048576 ; Addition to constants from json.au3
92
-
93
91
Global Enum _
94
92
$_WD_DEBUG_None = 0 , _ ; No logging
95
93
$_WD_DEBUG_Error , _ ; logging in case of Error
@@ -896,7 +894,7 @@ Func _WD_ExecuteScript($sSession, $sScript, $sArguments = Default, $bAsync = Def
896
894
If IsBool ($vSubNode ) Then $vSubNode = ($vSubNode ) ? $_WD_JSON_Value : " " ; True = the JSON value node is returned , False = entire JSON response is returned
897
895
898
896
If IsString ($vSubNode ) Then
899
- $sScript = __WD_EscapeString($sScript , $JSON_MLREFORMAT )
897
+ $sScript = __WD_EscapeString($sScript )
900
898
901
899
$sData = ' {"script":"' & $sScript & ' ", "args":[' & $sArguments & ' ]}'
902
900
$sCmd = ($bAsync ) ? ' async' : ' sync'
@@ -1736,23 +1734,21 @@ EndFunc ;==>__WD_CloseDriver
1736
1734
; Syntax ........: __WD_EscapeString($sData[, $iOption = 0])
1737
1735
; Parameters ....: $sData - the string to be escaped
1738
1736
; $iOption - [optional] Any combination of $JSON_* constants. Default is 0.
1737
+ ; Return values..: Success - Escaped string
1738
+ ; Failure - Response from JSON UDF and sets @error to $_WD_ERROR_GeneralError
1739
1739
; Author ........: Danp2
1740
1740
; Modified ......:
1741
- ; Remarks .......: $JSON_MLREFORMAT will strip tabs and CR/LFs from a multiline string.
1742
- ; See $JSON_* constants in json.au3 for other $iOption possibilities.
1741
+ ; Remarks .......: See $JSON_* constants in json.au3 for the possible $iOption combinations.
1743
1742
; Related .......:
1744
1743
; Link ..........:
1745
1744
; Example .......: No
1746
1745
; ===============================================================================================================================
1747
1746
Func __WD_EscapeString($sData , $iOption = 0 )
1748
- If BitAND ($iOption , $JSON_MLREFORMAT ) Then
1749
- $sData = StringRegExpReplace ($sData , ' [\v\t]' , ' ' ) ; Strip tabs and CR/LFs
1750
- $iOption = BitXOR ($iOption , $JSON_MLREFORMAT ) ; Flip bit off
1751
- EndIf
1752
-
1747
+ Local $iErr = $_WD_ERROR_Success
1753
1748
$sData = Json_StringEncode($sData , $iOption ) ; Escape JSON Strings
1754
1749
1755
- Return SetError ($_WD_ERROR_Success , 0 , $sData )
1750
+ If @error Then $iErr = $_WD_ERROR_GeneralError
1751
+ Return SetError ($iErr , 0 , $sData )
1756
1752
EndFunc ; ==>__WD_EscapeString
1757
1753
1758
1754
; #INTERNAL_USE_ONLY# ===========================================================================================================
0 commit comments