Rename RunScriptInternal() to RunScriptSync() in wxGTK

This helper function runs a JavaScript script and blocks until it
finishes executing, so try to use a name at least hinting at this
instead of being totally generic and useless.
This commit is contained in:
Vadim Zeitlin
2017-10-21 23:12:21 +02:00
parent 8c6ce2cd59
commit b309487ef6
2 changed files with 6 additions and 5 deletions

View File

@@ -160,7 +160,7 @@ private:
#if wxUSE_WEBVIEW_WEBKIT2 #if wxUSE_WEBVIEW_WEBKIT2
bool CanExecuteEditingCommand(const gchar* command) const; bool CanExecuteEditingCommand(const gchar* command) const;
void SetupWebExtensionServer(); void SetupWebExtensionServer();
bool RunScriptInternal(const wxString& javascript, wxString* output = NULL); bool RunScriptSync(const wxString& javascript, wxString* output = NULL);
#endif #endif
WebKitWebView *m_web_view; WebKitWebView *m_web_view;

View File

@@ -1141,7 +1141,8 @@ bool JSResultToString(GObject *object, GAsyncResult *result, wxString* output)
return true; return true;
} }
bool wxWebViewWebKit::RunScriptInternal(const wxString& javascript, wxString* output) // Run the given script synchronously and return its result in output.
bool wxWebViewWebKit::RunScriptSync(const wxString& javascript, wxString* output)
{ {
GAsyncResult *result = NULL; GAsyncResult *result = NULL;
webkit_web_view_run_javascript(m_web_view, webkit_web_view_run_javascript(m_web_view,
@@ -1163,12 +1164,12 @@ bool wxWebViewWebKit::RunScript(const wxString& javascript, wxString* output)
wxJSScriptWrapper wrapJS(javascript, &m_runScriptCount); wxJSScriptWrapper wrapJS(javascript, &m_runScriptCount);
wxString result; wxString result;
bool isValidJS = RunScriptInternal(wrapJS.GetWrappedCode(), &result); bool isValidJS = RunScriptSync(wrapJS.GetWrappedCode(), &result);
if ( isValidJS && result == "true" ) if ( isValidJS && result == "true" )
{ {
RunScriptInternal(wrapJS.GetOutputCode(), output); RunScriptSync(wrapJS.GetOutputCode(), output);
RunScriptInternal(wrapJS.GetCleanUpCode()); RunScriptSync(wrapJS.GetCleanUpCode());
return true; return true;
} }