Open ngoodman opened 11 years ago
http://tobyho.com/2011/06/08/the-javascript-stacktrace-blog/
This page was pretty informative. It shows that we're pretty much out of luck for Safari (it never gives stack traces). I did a quick look at Firefox, and it looks like code executed in eval() actually gives wrong lines. Example:
Given Church code: "((((-))))"
ret<@file:///Users/juliusc/ppl/webchurch/online/webchurch.js:9869 ret<@file:///Users/juliusc/ppl/webchurch/online/webchurch.js:9867 ret<@file:///Users/juliusc/ppl/webchurch/online/webchurch.js:9865 @file:///Users/juliusc/ppl/webchurch/online/webchurch.js:9863 @file:///Users/juliusc/ppl/webchurch/online/webchurch.js:9861
Those line numbers increment by 2 for each level of paren nesting, and have nothing to do with the actual code in webchurch.js at those lines. I'll do a script injecting experiment to see if that could be a potential solution for this.
Note that that blog post is 2 years old.
It looks like more recent versions of Safari do have a stack trace; try running this code:
try { throw new Error('buck stops here') } catch(e) { console.log(e.stack) }
On Mon, Oct 28, 2013 at 11:22 AM, Julius Cheng notifications@github.comwrote:
http://tobyho.com/2011/06/08/the-javascript-stacktrace-blog/
This page was pretty informative. It shows that we're pretty much out of luck for Safari (it never gives stack traces). I did a quick look at Firefox, and it looks like code executed in eval() actually gives wrong lines. Example:
Given Church code: "((((-))))"
ret<@file https://github.com/file :///Users/juliusc/ppl/webchurch/online/webchurch.js:9869 ret<@file https://github.com/file :///Users/juliusc/ppl/webchurch/online/webchurch.js:9867 ret<@file https://github.com/file :///Users/juliusc/ppl/webchurch/online/webchurch.js:9865 @file https://github.com/file :///Users/juliusc/ppl/webchurch/online/webchurch.js:9863 @file https://github.com/file :///Users/juliusc/ppl/webchurch/online/webchurch.js:9861
Those line numbers increment by 2 for each level of paren nesting, and have nothing to do with the actual code in webchurch.js at those lines. I'll do a script injecting experiment to see if that could be a potential solution for this.
— Reply to this email directly or view it on GitHubhttps://github.com/probmods/webchurch/issues/22#issuecomment-27240122 .
Weird, could you use the local WebChurch demo to produce an error and print the stack? I got undefined.
Nvm, I'm on Safari 5, that must be why.
On firefox and safari the new error locating / highlighting stuff doesn't work.
I believe the culprit is
get_sites_from_stack
in evaluate.js, which uses some assumptions (regexp and stuff) that seem to be very specific to chrome.