|
Rank: Advanced Member Groups: Member
Joined: 1/31/2015 Posts: 70
|
Hello,
What is the expected behaviour of the wpf wrapper when we try to EvalScript() ? Should we get an exception?
I mean, for example, if we are trying to get a member of an undefined variable ?
We get this strange behaviour on an xp system (I am aware that it's not officially supported but we are trying to support xp users for a little more time). When javascript crashes, the browser stays frozen. Does not crash and shows the javascript "exceptions" to the console (we also handle the ConsoleMessage event). Win 7/8 runs fine.
Kind regards,
Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
When a JavaScript error occurs, the ConsoleMessage event suppose to be called. If you call EvalScript with throwOnError as true, then you will get an exception.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/31/2015 Posts: 70
|
Thanks for replying.
In our code, we have a thread that checks if a certain javascript condition is met while the ui thread with the WPF Web view is loading e.g. an Ajax result.
If this code has a javascript error, in Windows xp we do not get an exception or console emissions.
Any idea? Can threadrunner work under a Web control?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
You can not call a WebView's method in a thread other than the thread that creates the WebView. That means if you create your WebView in the UI thread, you can ONLY call any method on that WebView from the UI thread. If you create your WebView through a ThreadRunner, then you must call all methods on that WebView through ThreadRunner.Send/Post except for WebView.Destroy.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/31/2015 Posts: 70
|
Isn't ThreadRunner supposed to work only for "head-less" browsers (without ui) ?
We have WPF Webcontrol so can we attach the webview from ThreadRunner to this control?
Thanks for replying!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
We have already said this very clearly in our previous reply: You can not directly call method/property of a WebView that belongs to another thread. The WebView created by a ThreadRunner "belongs" to a separate thread (managed by the ThreadRunner). You can not attach that WebView to a control in the UI thread.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/31/2015 Posts: 70
|
Thanks for replying.
You are very clear, just wanted to make sure. So how would you implement a visible and user controllable wpf application with an EO browser that runs automated actions (clicks, waits for ajax responses etc) if you cannot "control" or "ask" the component from another thread?
Thanks again for your time.
Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi Jim,
You need to marshal the call from your worker thread into the UI thread (or whatever thread your WebView is created in). In WPF to marshal call to UI thread you would usually use Dispatcher.Invoke. However this part is completely unrelated to our product, so please do not hold onto us if you run into problems on this part. This is generic .NET/WPF programming technology. We are just giving you the pointers and hope it would be helpful to you. If you run into problems, you will need to resolve that part yourself.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 1/31/2015 Posts: 70
|
Hello,
Yes, this is exactly the way we have already implemented our application with the CefSharp component (which we tried to replace with eo but doesn't work yet). We create the wpf ui and then delegate the control to another thread which in turn manages a set of other threads to monitor and control the browser component. Your suggestion is exactly the same and we don't require any assistance with this.
However, regarding my opening post, we are getting some weird behaviour with xp. I totally understand that you will not support xp any more. I was wondering if you have any idea on where the "lost" javascript errors go. I mean, having a "worker" thread perform some mal-formed evalScript(script,true) on our webview we do not get the Exception (or the console emission) that you say. This only happens in xp and through the "worker" thread. Again, I know it's all unsupported and I agree with you in advance :)
I am hoping for an idea on where to look, some gut feeling from your experience. The machine is .net 4/sp3 enabled but it lives on a slow machine (1gb ram, slow hdd, single-core atom etc). On the other hand, a virtual windows-xp machine on a fast host does not have this problem at all! Why is this slow xp sending the errors and events to oblivion?
Thanks for reading, I really appreciate it and you guys make one of the most supporting forums I have seen for a commercial product.
Kind regards,
Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Jim B wrote:Yes, this is exactly the way we have already implemented our application with the CefSharp component (which we tried to replace with eo but doesn't work yet). We create the wpf ui and then delegate the control to another thread which in turn manages a set of other threads to monitor and control the browser component. Your suggestion is exactly the same and we don't require any assistance with this. We don't really have anything else to tell you on this. We feel that we keep explaining it one way and you keep phrasing it the other way. For our component you can not call any of the methods except for Destroy from another thread. We do not care how many other threads you have as long as you don't touch our controls from another thread. So I am puzzled that you keep saying "delegate the control to another thread" or "another thread monitor and control the browser component". If the browser component is created by the UI thread, then it belongs to the UI thread and no other thread can touch it, Period. This is as clear as it can get and we have nothing more to tell you and will no longer rely on this issue.
|
|