Welcome Guest Search | Active Topics | Sign In | Register

EvalScript with style.marginTop locks application Options
KSystems
Posted: Monday, June 20, 2016 8:31:10 PM
Rank: Advanced Member
Groups: Member

Joined: 1/15/2015
Posts: 47
This started happening with the latest version of EO.WebBrowser.

On LoadCompleted() event of a WebView we call EvalScript() to getElementByID and change the style.marginTop to 10px. When EvalScript is called the entire app freezes, and all of Windows become non-responsive, you can't click anything, not even the taskbar of Windows. Eventually it becomes unlocked on its own, or you right-click somewhere, or CTRL+ALT+DEL, and it all comes back. The EvalScript does execute. Oddly enough, it seems to only happen with marginTop, or marginBottom, or any margin is changed. Other style attributes work as they should, but I haven't tried them all.

To test, just drop a EO.WebControl onto a Windows Forms App, and do this:

Code: C#
public Form1()
        {
            InitializeComponent();
            webControl1.WebView.Url = "https://google.com";
            webControl1.WebView.LoadCompleted += new EO.WebBrowser.LoadCompletedEventHandler(WebView_LoadCompleted);
        }

        void WebView_LoadCompleted(object sender, EO.WebBrowser.LoadCompletedEventArgs e)
        {
            if (webControl1.WebView.CanEvalScript)
            {
                webControl1.WebView.EvalScript("document.getElementById('gsr').style.marginTop = '10px';");
            }
        }


The app and all Windows should lock up. At least on Windows 8 and 10.

If you change the EvalScript to this:

Code: C#
webControl1.WebView.EvalScript("document.getElementById('gsr').style.border = 'thick solid #000000';");


.. it doesn't lock up.

Whats going on here? Thanks for the help.



KSystems
Posted: Thursday, June 23, 2016 1:53:03 PM
Rank: Advanced Member
Groups: Member

Joined: 1/15/2015
Posts: 47
Can anyone reproduce this?
KSystems
Posted: Friday, June 24, 2016 3:51:42 PM
Rank: Advanced Member
Groups: Member

Joined: 1/15/2015
Posts: 47
I found that using QueueScriptCall() instead of EvalScript() prevents this issue.
eo_support
Posted: Monday, June 27, 2016 6:15:04 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
KSystems wrote:
I found that using QueueScriptCall() instead of EvalScript() prevents this issue.


Thanks for the update and apologize for the delay. The fact that using QueueScriptCall can prevent issue does make sense since QueueScriptCall is asynchronous and EvalScript is synchronous. However since EvalScript also pumps messages it should not lock up the UI. We have not been able to reproduce this issue with the latest build either. So if you are not using the latest build you can update to the latest build first and see if that resolves the issue. If it still does not resolve the issue, we can investigate further if you can isolate the problem into a test project and send the test project to us. See here for more information on how to send test project to us:

http://www.essentialobjects.com/forum/test_project.aspx

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.