New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 5 users

Issue metadata

Status: Duplicate
Merged: issue chromium:60240
Email to this user bounced
Closed: Mar 2013
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: ----

Sign in to add a comment

Incorrect stack trace.

Reported by, Jun 30 2010

Issue description

This script does not seem to produce the correct output:

  function f() {

  function g() {
    try {
    } catch (err) {
      throw err;


You would expect f() to show up in the stacktrace. Firefox reports: 

  f()@ g()@
  ("with(_FirebugCommandLine){g();\n};")@ _firebugEvalEvent([object Event])@ 
Status: Assigned
Currently JSON.parse(undefined) throws the string "illegal access" because of the argument check at  The spec says that the 'text' argument should be converted to a string before parsing (15.12.2 step 1, p. 202) so that is incorrect.  We should do the conversion and then, in this case, throw a proper SyntaxError.  Note that if you do JSON.parse("undefined") you get:

SyntaxError: Unexpected token ILLEGAL
    at Object.parse (native)
    at f (<...>)
    at g (<...>)
    at <...>

which is slightly incorrect -- the top frame should be JSON.parse, not Object.parse.  We can fix that by clearing the JSON.constructor property when creating the JSON object.

Assigning to Mads (as suggested by Erik).

Comment 2 by, Jul 13 2010

Thanks Christian! I'm fixing the string conversion problem first (which is caused by a simple typo). It seems that the slightly incorrect formatting goes a little deeper. The problem is that JSON.__proto__ === Object.prototype and therefore the constructor property is the Object function.

We do have a class name set to "JSON" so we could probably use that to fix the printing issue.

Comment 3 by, Jul 13 2010

Conversion problem fixed in r5051.

Comment 4 by, Feb 1 2011

I'm seeing this behavior even for a ReferenceError, in that if I re-throw the caught error object, it loses the original source context for the error and overrides it with where the error was thrown.

This gist illustrates:
Mergedinto: chromium:60240
Status: Duplicate
The stack trace issue for rethrown Error objects has long been solved.

Sign in to add a comment