Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window & document global variables #6

Closed
scriby opened this issue Oct 31, 2011 · 1 comment
Closed

window & document global variables #6

scriby opened this issue Oct 31, 2011 · 1 comment

Comments

@scriby
Copy link

scriby commented Oct 31, 2011

In the first couple statements of the built javascript file, please prefix window and document with var to not create global variables in my node app :)

Also, I'm not sure if you have any control over this, but the "ro" function breaks if Array's prototype is extended. The for in loop will iterate the extra prototype items, which basically makes it so you can't instantiate any BigDecimals or BigIntegers. A normal i++ for loop gets around the problem (hasOwnProperty would also work, etc. etc.).

Thanks,

Chris

@jhs
Copy link
Owner

jhs commented Nov 6, 2011

The global variable pollution is fixed in the latest push, thanks.

About the unsafe loop, as you probably know, the code was generated by GWT. It seems weird that it would be so brittle and vulnerable to extending Array's prototype. Is it possible that they know for sure that this situation can't happen? Surely GWT code is mixed with hand-written Javascript in the wild, right?

Anyway, I think I may have a solution. Instead of using text manipulation to convert the generated code to a CommonJS module, I will use uglify.js. I have had success with it in the past, and it should be a more robust way to convert the code. It might not be too hard to find that bad loop and modify its syntax as well.

@jhs jhs closed this as completed Nov 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants