Closed Bug 1921780 Opened 5 days ago Closed 4 days ago

Add some assertions for exception handling

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In bug 1921215 I added a cx->hadUncatchableException() flag. We can also use this to assert that if a JSNative (or scripted function execution) returns false, we're either throwing an exception or have reported an uncatchable exception. This helps catch some JSAPI footguns: see bug 552007 and bug 1408013.

Longer-term we should track uncatchable exceptions using the ExceptionStatus enum because it's more precise, but this is a step in that direction.

Initially I'll probably only enable this for the JS shell, but if that's green we can see what happens in the browser.

If a JSNative or script execution returns false, we now assert we have a pending exception
or at some point an uncatchable exception was reported. Bug 1921215 added the hadUncatchableException_
flag to JSContext.

For now enable this only in the JS shell. If that's green we can try enabling it everywhere.

Blocks: 1921963
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de8b96102f94 Improve exception handling assertions in the JS shell. r=arai
Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: