generate and execute javascript at runtime?

110 views
Skip to first unread message

Dennis Haupt

unread,
Nov 2, 2012, 10:09:46 AM11/2/12
to google-we...@googlegroups.com
i'm trying to integrate jqxgrid and write a gwt wrapper around it. (it's some jquery grid) i know i can write native js methods, but this isn't enough. i need to dynamically build the call and then execute it as if it was sent from the server inside a script tag. how can i do that?

Sebastian Rothbucher

unread,
Nov 3, 2012, 6:35:11 AM11/3/12
to google-we...@googlegroups.com
Hi, is it not possible to make a function like eval() (doing just that) available via JSNI?

Dennis Haupt

unread,
Nov 5, 2012, 4:00:15 AM11/5/12
to google-we...@googlegroups.com
i remember there being some magic rules, but i'll try


2012/11/3 Sebastian Rothbucher <sebastian....@clarities.de>
Hi, is it not possible to make a function like eval() (doing just that) available via JSNI?


On Friday, November 2, 2012 3:10:23 PM UTC+1, HamsterofDeath wrote:
i'm trying to integrate jqxgrid and write a gwt wrapper around it. (it's some jquery grid) i know i can write native js methods, but this isn't enough. i need to dynamically build the call and then execute it as if it was sent from the server inside a script tag. how can i do that?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/o_U-m97CRW4J.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Joseph Lust

unread,
Nov 7, 2012, 12:16:43 PM11/7/12
to google-we...@googlegroups.com
True, but eval() is one of the Cardinal sins of programming. Think deeply if there is any way around it. But then again, you are the Hamster of Death, so you may be prone to sin.


Sincerely,
Joseph

Dennis Haupt

unread,
Nov 8, 2012, 7:27:08 AM11/8/12
to google-we...@googlegroups.com
the reason i am using the GWT is so that i do NOT have use javascript. so obviously, eval seems like totally harmless to me :) what's wrong with it?


2012/11/7 Joseph Lust <lifeo...@gmail.com>
True, but eval() is one of the Cardinal sins of programming. Think deeply if there is any way around it. But then again, you are the Hamster of Death, so you may be prone to sin.


Sincerely,
Joseph

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Joseph Lust

unread,
Nov 8, 2012, 12:28:00 PM11/8/12
to google-we...@googlegroups.com
It is just a good way to create a security hole and allow for malicious code execution. And it also prevent compiler optimizations since the compiler cannot divine what you're going to run. However, your use case is likely a valid one for eval since you're wrapping a JS lib.


Sincerely,
Joseph
Reply all
Reply to author
Forward
0 new messages