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

setting eval breaks everyone's client #3

Open
michaelficarra opened this issue Dec 16, 2010 · 6 comments
Open

setting eval breaks everyone's client #3

michaelficarra opened this issue Dec 16, 2010 · 6 comments

Comments

@michaelficarra
Copy link

window.eval = eval = function(){} makes everyones client stop evaluating until they refresh. I don't even want to know what happens when you set it to a non-function.

@airportyh
Copy link
Owner

I had a try at this, but ultimately failed to find a way that works for IE. I tried sandbox = {eval: window.eval} or similar for IE, but for some reason, when IE is doing an indirect eval, it swallows the exceptions and either shows them in a popup dialog, or in the developer tools console only. If anyone has a better idea please let me know.

@michaelficarra
Copy link
Author

Before running an eval, you can save a reference to the native function and set it again after running eval. Maybe not the coolest fix, but it will definitely work.

@airportyh
Copy link
Owner

Fixed in ac75e96

@airportyh
Copy link
Owner

Oops! Spoke too soon. That broke exceptions on IE too. Reverted. Michael: your solution would give the wrong value for 'eval' when referenced - it would always return the actual eval function as supposed to the assigned value.

@michaelficarra
Copy link
Author

Are you saying you want to keep proper semantics when people assign to window.eval, but without it breaking the evaling in others' browsers? Then instead of referencing window.eval when you call it, you should be caching a reference to it in a local variable and calling that function instead. Does that fix work for you?

@airportyh
Copy link
Owner

That's the thing that doesn't work. When I do that, IE will have the weird behavior wrt exceptions that I mentioned.

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