Boris Zbarsky (2014-03-27T18:59:33.000Z)
On 3/27/14 12:31 PM, Mark Miller wrote:
> Mozillians, why did you add this extra information?

Looks like it was added in 
https://bugzilla.mozilla.org/show_bug.cgi?id=332176

Before that, the stack claimed the url of the caller of eval() but a 
line number which was the sum of the line number of the eval() call 
itself and the line number of the code throwing the exception inside the 
eval string, I believe, or some such insanity.

There's a lot of noise there in the discussion, but I think the key 
recent part is https://bugzilla.mozilla.org/show_bug.cgi?id=332176#c40 
which summarizes what I think we implemented.  Note that per 
https://bugzilla.mozilla.org/show_bug.cgi?id=332176#c42 we do something 
similar for new Function() as well, so you can get a stack trace like so:

anonymous at http://example.com line 3 > Function:1:1 @http://example.com:3:5

for a testcase like this:

<script>
   try {
     new Function("throw new Error()")();
   } catch (e) {
     document.write(e.stack);
   }
</script>

-Boris
domenic at domenicdenicola.com (2014-03-30T16:14:03.682Z)
On 3/27/14 12:31 PM, Mark Miller wrote:
> Mozillians, why did you add this extra information?

Looks like it was added in 
https://bugzilla.mozilla.org/show_bug.cgi?id=332176

Before that, the stack claimed the url of the caller of eval() but a 
line number which was the sum of the line number of the eval() call 
itself and the line number of the code throwing the exception inside the 
eval string, I believe, or some such insanity.

There's a lot of noise there in the discussion, but I think the key 
recent part is https://bugzilla.mozilla.org/show_bug.cgi?id=332176#c40 
which summarizes what I think we implemented.  Note that per 
https://bugzilla.mozilla.org/show_bug.cgi?id=332176#c42 we do something 
similar for new Function() as well, so you can get a stack trace like so:

```
anonymous at http://example.com line 3 > Function:1:1 @http://example.com:3:5
```

for a testcase like this:

```html
<script>
   try {
     new Function("throw new Error()")();
   } catch (e) {
     document.write(e.stack);
   }
</script>
```