Closed Bug 2056615 Opened 2 months ago Closed 1 month ago

List own property names for uncaught non-Error exception objects instead of bare "Object"

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
relnote-firefox --- 155+
firefox155 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 3 open bugs)

Details

Attachments

(3 files)

Attached image image.png

When a non-Error value (a plain object, or a promise rejected with one) reaches the error reporter in NoSideEffects mode — unhandled promise rejections, window.onerror, worker errors — the console shows the unhelpful "uncaught exception: Object".

This lists the object's own string-keyed data property names, e.g. "uncaught exception: Object (code, message)", without running user code (no getters/proxy traps; cross-origin wrappers stay opaque). Adds a jsapi-test

Assignee: nobody → sledru
Status: NEW → ASSIGNED
Blocks: sm-runtime
Severity: -- → N/A
Priority: -- → P3
Attachment #9614041 - Attachment description: Bug 2056615 - List own property names for uncaught non-Error exception objects instead of bare "Object" r?#spidermonkey-reviewers → Bug 2056615 - List own property names for uncaught non-Error exception objects reported to the console r?#spidermonkey-reviewers,#dom-core
Attached image what is see now

Test case:

<!DOCTYPE html>
<meta charset="utf-8">
<title>bug 2056615</title>
<script>
// Unhandled rejection with a non-Error object -> Promise::ReportRejectedPromise
Promise.reject({ code: 42, message: "nope" });
// no own data properties -> falls back to bare "Object"
Promise.reject({});
// getter only -> not listed, no user code run
Promise.reject({ get reason() { return "boom"; } });
// plain throw still uses NoSideEffects (window.onerror path), unchanged
setTimeout(() => { throw { thrown: 1 }; }, 0);
</script>
Pushed by sledru@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1720c1c30def https://hg.mozilla.org/integration/autoland/rev/eebe25a47cf0 List own property names for uncaught non-Error exception objects reported to the console r=spidermonkey-reviewers,jandem
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch

Did you want to nominate this for the Fx155 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination

Possible wording:

Uncaught non-Error exceptions now list their property names in the Console instead of showing only "Object".

Flags: needinfo?(sledru)

Maybe? Matthew, wdyt ? :)

Flags: needinfo?(sledru) → needinfo?(mgaudet)

I don't think this is a relnote feature, as happy as I am for this to have landed?

Flags: needinfo?(mgaudet)

Release Note Request (optional, but appreciated)
[Why is this notable]: Nicer to deal with errors for web developers
[Affects Firefox for Android]: Probably
[Suggested wording]: "Rejected objects are viewable in devtools" ??
[Links (documentation, blog post, etc)]:

Oh. Ok, re-reading this affects content mode; so will flag for relnote.

relnote-firefox: --- → ?

Added to the Fx155 relnotes.

QA Whiteboard: [qa-triage-done-c156/b155]
Blocks: 2067236
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: