Merge commit '63f83c096ccf7b16ed96d60e56d08caacaaa6771'

This commit is contained in:
2021-11-29 14:55:52 +01:00
13 changed files with 390 additions and 324 deletions

View File

@@ -485,6 +485,10 @@ public:
Process a @c wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED event
only available in wxWidgets 3.1.5 or later. For usage details see
AddScriptMessageHandler().
@event{wxEVT_WEBVIEW_SCRIPT_RESULT(id, func)}
Process a @c wxEVT_WEBVIEW_SCRIPT_RESULT event
only available in wxWidgets 3.1.6 or later. For usage details see
RunScriptAsync().
@endEventTable
@since 2.9.3
@@ -710,6 +714,11 @@ public:
/**
Runs the given JavaScript code.
@note Because of various potential issues it's recommended to use
RunScriptAsync() instead of this method. This is especially true
if you plan to run code from a webview event and will also prevent
unintended side effects on the UI outside of the webview.
JavaScript code is executed inside the browser control and has full
access to DOM and other browser-provided functionality. For example,
this code
@@ -764,9 +773,32 @@ public:
@NULL if it is not needed. This parameter is new since wxWidgets
version 3.1.1.
@return @true if there is a result, @false if there is an error.
@see RunScriptAsync()
*/
virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const = 0;
/**
Runs the given JavaScript code asynchronously and returns the result
via a @c wxEVT_WEBVIEW_SCRIPT_RESULT.
The script result value can be retrieved via wxWebViewEvent::GetString().
If the execution fails wxWebViewEvent::IsError() will return @true. In this
case additional script execution error information maybe available
via wxWebViewEvent::GetString().
@param javascript JavaScript code to execute.
@param clientData Arbirary pointer to data that can be retrieved from
the result event.
@note The IE backend does not support async script execution.
@since 3.1.6
@see RunScript()
*/
virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const;
/**
Add a script message handler with the given name.
@@ -1279,6 +1311,10 @@ public:
Process a @c wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED event
only available in wxWidgets 3.1.5 or later. For usage details see
wxWebView::AddScriptMessageHandler().
@event{wxEVT_WEBVIEW_SCRIPT_RESULT(id, func)}
Process a @c wxEVT_WEBVIEW_SCRIPT_RESULT event
only available in wxWidgets 3.1.6 or later. For usage details see
wxWebView::RunScriptAsync().
@endEventTable
@since 2.9.3
@@ -1323,6 +1359,14 @@ public:
@since 3.1.5
*/
const wxString& GetMessageHandler() const;
/**
Returns true the script execution failed. Only valid for events of type
@c wxEVT_WEBVIEW_SCRIPT_RESULT
@since 3.1.6
*/
bool IsError() const;
};