New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebView add asynchronous RunScript variant: RunScriptAsync #2316
Conversation
f1c8917
to
9b1195b
Compare
It seems that it would be nice to merge this (see https://trac.wxwidgets.org/ticket/19293) and I don't think anybody cares about IE by now, so we could well leave this unimplemented for it, but we do need some documentation and showing this in the sample and testing it would be also very nice. Would anybody have time to do this before 3.1.6? |
I meant coming back to this (actually use it in an application of mine). |
0ba9992
to
35a8715
Compare
Edge does not support the about: URL using it in the test resulted in various problems. Just use about:blank for now as the edge backend does not merge them for the history checks.
35a8715
to
47833a6
Compare
@vadz
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks a lot!
I'm fine with merging this as is (maybe after adding the possibly missing initialization), but please let me know if you want, or if I should, apply the minor style/wording comments.
I'll leave this here for at least a few days to give others time to review and maybe test it in any case.
Thanks again!
Co-authored-by: VZ <vz-github@zeitlins.org>
This was no longer used after the changes to the javascript wrapper
@vadz I've added your suggestions. |
Great, thanks! It looks 100% ready to me now, but, as I said, I'll leave it here for a few more days just in case others can/want to test it. I'll merge it next week if there are no comments. |
No comments, so merging, thanks again! |
Add
RunScriptAsync()
towxWebView
My current implementation and proposal is this:
When running
RunScriptAsync()
a new eventwxEVT_WEBVIEW_SCRIPT_RESULT
is triggered on success or failure. It will contain the specifiedclientData
viaGetClientData()
.IsError()
will befalse
if the execution was successful andGetString()
will contain the scripts output/return value. On errorIsError()
will betrue
and an error message is available viaGetString()
.I've simplified the current javascript wrapper code to a single javascript call. Which is especially useful for async operation but also reduces calls to the native API from 3 times per
RunScript()
call to once.I've included a new generic
wxWebView::RunScript()
implementation which will use the backendswxWebView::RunScriptAsync()
to enable synchronous calls. This should unifiy the different backends implementation as the native API is asynchronous anyway (except for IE, where I think async execution will not be implemented).ToDo List:
IsError()
towxWebViewEvent
RunScriptAsync()
As always any ideas feedback is welcome.
I would also like to know how to test easily test the webkit1 backend.