Welcome Guest Search | Active Topics | Sign In | Register

called EvalScript() but no object returned Options
xw
Posted: Friday, August 3, 2018 5:06:31 AM
Rank: Newbie
Groups: Member

Joined: 8/3/2018
Posts: 3
I found about 10% chance EvalScript() will return a null object.
Of course i called CanEvalScript() before calling EvalScript(), and i set exception flag as true so EvalScript(script, true) will throw exception if it fails. However I didnt see any exception while the return object is null.
When i launch two EOBrowsers simultaneously and try to call EvalScript(), the chance of getting null pointer increases dramatically (from what i observe it has 30% chance), then i tried to run this on an old computer which is kind slow, about 80% chance i got null object on calling EvalScript().
How this was happened? How do I debug it? How to solve the issue?
eo_support
Posted: Friday, August 3, 2018 10:05:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

It is possible that EvalScript succeeds but still returns null. For example, if you call EvalScript("document.body") immediately after loading a new page, you may receive null because the script engine hasn't initialized the body element yet. In such case you just have to check the return value and call again at a later time. Another reason why it returns null can be that the object you are trying to get is indeed null. This would have to do with your JavaScript code and typically you would need to fix the JavaScript code in the page.

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.