skeeto / skewer-mode

Live web development in Emacs
The Unlicense
1.1k stars 57 forks source link

EvalError when using Safari #14

Closed thevole closed 11 years ago

thevole commented 11 years ago

Thanks for skewer-mode. It is a great tool and help.

I had difficulty (i.e. failed to) get it working using Apple Safari Version 6.0.3 (8536.28.10) on this MacBookPro. When I tried to evaluate any js form I got the error message

EvalError: The "this" value passed to eval must be the global object from which eval originated

eval@[native code]
eval@http://127.0.0.1:8888/skewer:101
callback@http://127.0.0.1:8888/skewer:14
onreadystatechange@http://127.0.0.1:8888/skewer:39
[native code]

Expression: 

42 / 7;

In the above case, I was obviously evaluating a bit of simple arithmetic. I also had to change httpd-port to 8888.

All works fine in Google Chrome - but not in Safari. Is this something that I can help on?

skeeto commented 11 years ago

This broke when I added support for IE8 a few days ago, but since I don't test Safari very frequently I didn't realize I broke it. The problem is that every browser, no exceptions, is buggy when it comes to the behavior of eval. It turns out there's no overlap in global eval functionality between Safari and IE8, so I had to get a little bit more sophisticated in ac7e7bb. Tell me if this version works for you.

As for the port 8080 thing, I was also experiencing this just now while working on this. It seems like Safari is trying to use that port as well and it freezes up when Emacs is using it? It was unclear what exactly was going on but switching to 8888 made things better for me, too. You can use whatever port you like, just remember you need to modify the port hardcoded in the userscript if you intend to use it.

thevole commented 11 years ago

Chris:

Thanks for the reply. The new commit works fine at this end.

On the matter of the custom (i.e. non 8080) port, I found that having the default of 8080 also didn't work for me on Chrome either. So I reviewed (as an improving Emacs novice) the configuration for simple_httpd.el and picked another memorable port numbers. I simply(!) customized the value for https_port in my customizations.el file - which I assume is the correct thing to do.

Thanks again Martin

skeeto commented 11 years ago

If you meant "httpd-port" then that's correct way to set the port. Thanks for the bug report!

thevole commented 11 years ago

I did of course mean httpd-port.

I need to type better. Thanks for fixing this so quickly. And... as I'm trying to be a better citizen in the open source space, please let me know if there is anything that I can help with.