"Assertion failure: !cx->isExceptionPending()" with JSON.parse

RESOLVED FIXED

Status

()

Core
JavaScript Engine
--
critical
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jandem, Unassigned)

Tracking

({assertion, testcase})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
--
function f() {
    throw 2;
}
JSON.parse(f, f);
--
$ ./js test.js
Assertion failure: !cx->isExceptionPending(), at ../jsinterp.cpp:6178

In a release build this prints
uncaught exception: 2
The new parser fixes this.  I'm not 100% sure why the old parser was broken here, might also possibly be the scaffolding around the parsing code that was at fault (and got reorganized slightly in the rewrite).

We need to add this test before closing this out as WFM:

try
{
  var r = JSON.parse("function f() {\n throw 2;\n}", function() { throw 2; });
  throw new Error("didn't throw, returned " + r);
}
catch (e)
{
  assertEq(e instanceof SyntaxError, true);
}
Depends on: 589664
Fixed by the new parser.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.