Closed Bug 1942684 Opened 1 year ago Closed 1 year ago

Add Stack Accessor Telemetry

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: mgaudet, Assigned: dminor)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

https://github.com/ljharb/proposal-error-stack-accessor/ is a proposal for a standard Error.prototype.stack accessor

We diverge from the standard text in at least couple of ways, but we should try and identify via telemetry how important these divergences are:

  1. Our getter walks the proto chain itself, looking for anything with an [[ErrorData]] internal slot (aka, hunting for ErrorObject instance). Standard getter would just check this
  2. There's interest in making the setter throw on a non-string input: How often is that done?
  3. The setter is specced to throw if it doesn't have an ErrorData internal slot... how often does that happen?

A good model for this patch would be https://phabricator.services.mozilla.com/D233438

Assignee: nobody → dminor
Severity: -- → S3
Priority: -- → P3

This adds five new use counters to determine whether the error
stack accessor proposal would be web compatible. It counts each
use of the Error.stack getter and setter. It also tracks if the
this object doesn't have an [[ErrorData]] slot, a situation that
currently works, but under the new proposal, would no longer
access the stack. Finally, it tracks attempts to set Error.stack to
a non-string value, something that would throw under the new proposal.

It was manually tested in the developer console using code like this:

var e = new Error()
e.stack
e.stack = "hi"

var e2 = new Error()
e2.stack = 42

var obj = Object.create(Error.prototype)
obj.stack
obj.stack = "hi"

Note that the Error.isError proposal added [[ErrorData]] to
DOMException, but this is excluded from this telemetry. Testing
was done with instances of DOMException to ensure it would not affect
these results.

Blocks: 1943623
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/17bc5ae71789 Add stack accessor telemetry; r=mgaudet
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: