Pass wxAutomationObject by reference to CallEval()
Using pointer here makes no sense: this parameter can never be null and we don't even have the excuse of making it simpler to call like this as the caller has an object and not a pointer to it, so this even results in extra typing.
This commit is contained in:
@@ -880,10 +880,10 @@ bool wxWebViewIE::MSWSetModernEmulationLevel(bool modernLevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
bool CallEval(wxVariant varJavascript, wxAutomationObject* scriptAO,
|
bool CallEval(wxVariant varJavascript, wxAutomationObject& scriptAO,
|
||||||
wxVariant* varResult)
|
wxVariant* varResult)
|
||||||
{
|
{
|
||||||
if ( !scriptAO->Invoke("eval", DISPATCH_METHOD, *varResult, 1, &varJavascript) )
|
if ( !scriptAO.Invoke("eval", DISPATCH_METHOD, *varResult, 1, &varJavascript) )
|
||||||
{
|
{
|
||||||
wxLogWarning(_("Can't run JavaScript"));
|
wxLogWarning(_("Can't run JavaScript"));
|
||||||
return false;
|
return false;
|
||||||
@@ -915,20 +915,20 @@ bool wxWebViewIE::RunScript(const wxString& javascript, wxString* output)
|
|||||||
wxVariant varJavascript(wrapJS.GetWrappedCode());
|
wxVariant varJavascript(wrapJS.GetWrappedCode());
|
||||||
wxVariant varResult;
|
wxVariant varResult;
|
||||||
|
|
||||||
if ( !CallEval(varJavascript, &scriptAO, &varResult) )
|
if ( !CallEval(varJavascript, scriptAO, &varResult) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( varResult.IsType("bool") && varResult.GetBool() )
|
if ( varResult.IsType("bool") && varResult.GetBool() )
|
||||||
{
|
{
|
||||||
varJavascript = wrapJS.GetOutputCode();
|
varJavascript = wrapJS.GetOutputCode();
|
||||||
if ( !CallEval(varJavascript, &scriptAO, &varResult) )
|
if ( !CallEval(varJavascript, scriptAO, &varResult) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( output != NULL )
|
if ( output != NULL )
|
||||||
*output = varResult.MakeString();
|
*output = varResult.MakeString();
|
||||||
|
|
||||||
varJavascript = wrapJS.GetCleanUpCode();
|
varJavascript = wrapJS.GetCleanUpCode();
|
||||||
if ( !CallEval(varJavascript, &scriptAO, &varResult) )
|
if ( !CallEval(varJavascript, scriptAO, &varResult) )
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user