|
Rank: Advanced Member Groups: Member
Joined: 1/15/2015 Posts: 48
|
Hello,
We recently updated to the latest version and we are now finding that CanEvalScript returns false in a section of our web app that it normally didn't before.
We have been using EO for some time now, I think before the "QueueScriptCall" method was available. So in the past we would check CanEvalScript before calling EvalScript. Then later we changed EvalScript to QueueScriptCall when it was released, but kept the CanEvalScript check.
Is it necessary to check CanEvalScript before calling QueueScripCall? I am under the impression it will queue the script and run when it can eval script, so checking if it can eval script is not necessary. Is that assumption correct?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
The latest build disallowed calling EvalScript inside JSExtInvoke event handler because this could cause JavaScript engine re-entering, which should not be allowed.
Your assumption is correct. It is not necessary to check CanEvalScript when calling QueueScriptCall because the purpose of QueueScriptCall is to submit the JavaScript and then run it whenever the script engine is ready to run script code. This means that even if at the current moment the script engine is not ready (thus CanEvalScript is false), you would still be allowed to submit the script. It will just be called at a later time when the script engine is ready.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/15/2015 Posts: 48
|
Thank you for your (as usual) quick response.
It's good to know that EvalScript is not allowed in JSExtInvoke. Does that mean CanEvalScript would always return false in JSExtInvoke?
Also, is it safe to use QueueScriptCall in JSExtInvoke?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Yes to both of your questions. :)
|
|