add Envjs.eval for platfrom specific script eval implementations
Reported by Thatcher | February 6th, 2010 @ 05:55 AM | in 1.2.x
-- from a message from steven parkes on the envjs list --
What will make this really killer is using evaluateString to load scripts, rather than raw eval():
http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context...
You pass it the window object for the script and it will cause the string to be evaluated in the correct scope. This is the stuff that Glen was using scope manipulation to achieve.
I think it also has the advantage of passing filename/line number info to the compiler, so the error messages are better. I do that on the SpiderMonkey side in some places but I think we can do more. There are places in env.js where we do a straight eval() where I think we might want to do a platform call, to give it the option to do some value added stuff like filenames. (I think everybody hates that when you do XHR/eval instead of document.write(
You can also do what I do in SpiderMonkey which is use separate compile and execute steps which allows me to cache the compiler output so I only have to compile a script once even if it gets execute multiple times.
Comments and changes to this ticket
-
Thatcher March 2nd, 2010 @ 07:34 AM
- State changed from open to resolved
this is done and was helpful in general to allow Envjs on rhino make sure script is evaluated in the correct context
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
a javascript browser environment