Open Bug 552007 Opened 15 years ago Updated 3 months ago

Implement some way to catch accidental return false without setting an exception or error

Categories

(Core :: JavaScript Engine, enhancement, P5)

x86
Linux
enhancement

Tracking

()

People

(Reporter: mrbkap, Unassigned)

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.
Assignee: general → nobody
See Also: → 1730426
Severity: normal → S3

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
No longer blocks: sm-meta
You need to log in before you can comment on or make changes to this bug.