Closed
Bug 552007
Opened 15 years ago
Closed 10 months ago
Implement some way to catch accidental return false without setting an exception or error
Categories
(Core :: JavaScript Engine, enhancement, P5)
Tracking
()
RESOLVED
FIXED
133 Branch
Tracking | Status | |
---|---|---|
firefox133 | --- | fixed |
People
(Reporter: mrbkap, Assigned: jandem)
References
(Blocks 1 open bug)
Details
I spent way too much time the other day tracking down a case where I was returning false from a JS callback without either reporting an uncatchable error (such as out of memory) or setting an exception. The result of this was that a bunch of JS failed to execute, and was only picked up later when some expected side-effects were missed.
It would be nice to have either a static analysis or assertions (e.g. ASSERT_NOT_THROWING) that would catch this kind of problem.
One problem is that in certain cases, returning false without setting an exception is the intended behavior (e.g. if a branch callback decides that a script has been running too long). We could fix this by adding a JS_AbortExecution(JSContext *cx); that is a noop in optimized builds, but sets some sort of flag in debug builds or something like that, though.
Updated•11 years ago
|
Assignee: general → nobody
Updated•3 years ago
|
Severity: normal → S3
Comment 1•2 years ago
|
||
This is still a problem; maybe a clang-plugin could be designed for this, bug it's very low priority for sure.
Severity: S3 → N/A
Type: defect → enhancement
Priority: -- → P5
Assignee | ||
Comment 2•10 months ago
|
||
Bug 1921215, bug 1921780, and bug 1921963 implemented this.
Uncatchable exceptions now require a JS::ReportUncatchableException
call that sets a flag on the context. A plain return false
will cause an assertion failure in debug builds.
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Updated•10 months ago
|
Assignee: nobody → jdemooij
status-firefox133:
--- → fixed
Depends on: 1921215
Target Milestone: --- → 133 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•