﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3563	Function _IEBodyReadText() from IE.au3 needs to check .innerText is a valid property	John.D.Rainbow@…	mLipok	"To avoid this (albeit infrequent) problem:

{{{
Return SetError($_IESTATUS_Success, 0, $oObject.document.body.innerText)
Return SetError($_IESTATUS_Success, 0, $oObject.document.body^ ERROR
}}}

which is related to function _IEBodyReadText() from IE.au3 
the missing property checking (similar as done in other IE.au3 functions which need it) is respectfully asked to be included with the correction offered for this function as follows for your consideration please:


{{{
Func _IEBodyReadText(ByRef $oObject)
    If Not IsObj($oObject) Then
        __IEConsoleWriteError(""Error"", ""_IEBodyReadText"", ""$_IESTATUS_InvalidDataType"")
        Return SetError($_IESTATUS_InvalidDataType, 1, 0)
    EndIf
    If Not __IEIsObjType($oObject, ""browserdom"") Then
        __IEConsoleWriteError(""Error"", ""_IEBodyReadText"", ""$_IESTATUS_InvalidObjectType"", ""Expected document element"")
        Return SetError($_IESTATUS_InvalidObjectType, 1, 0)
    EndIf

    ;------------------------------------------------------------------------------------------
    ; Check to verify that the document body object has an innerText property, if not, skip trying to return its contents
    ;
    ; Setup internal error handler to Trap COM errors, turn off error notification,
    ;     check object property validity, set a flag and reset error handler and notification
    ;
    Local $bIsInnerText = True
    ; Trap COM errors and turn off error notification
    $bStatus = __IEInternalErrorHandlerRegister()
    If Not $bStatus Then __IEConsoleWriteError(""Warning"", ""_IEBodyReadText"", _
            ""Cannot register internal error handler, cannot trap COM errors"", _
            ""Use _IEErrorHandlerRegister() to register a user error handler"")
    ; Turn off error notification for internal processing
    $iNotifyStatus = _IEErrorNotify() ; save current error notify status
    _IEErrorNotify(False)

    ; Check conditions to verify that the property exists
    If $bIsInnerText Then
        $sTmp = $oObject.document.body.innerText ; Is .innerText a valid property?
        If @error Then $bIsInnerText = False
    EndIf

    ; restore error notify
    _IEErrorNotify($iNotifyStatus) ; restore notification status
    __IEInternalErrorHandlerDeRegister()
    ;------------------------------------------------------------------------------------------

    If $bIsInnerText Then   
        Return SetError($_IESTATUS_Success, 0, $oObject.document.body.innerText)
    Else
        __IEConsoleWriteError(""Error"", ""_IEBodyReadText"", ""$_IESTATUS_InvalidObjectType"", ""Expected innerText element"")
        Return SetError($_IESTATUS_InvalidObjectType, 1, 0)     
    EndIf
        
EndFunc   ;==>_IEBodyReadText
}}}


 "	Bug	closed		AutoIt	3.3.15.0	None	Fixed	_IEBodyReadText, .innerText	
