Closed Bug 1709542 Opened 3 years ago Closed 3 years ago

Evaluating an expression with a private field access while paused in a class method throws


(Core :: JavaScript Engine, defect)




90 Branch
Tracking Status
firefox90 --- verified


(Reporter: nchevobbe, Assigned: mgaudet)




(1 file)

Steps to reproduce

  1. Go to
  2. Open the console
  3. In the page, click on the Create instance and pause button, this should pause
  4. In the console, evaluate this.#secret

Expected results

A result ("mySecret") is displayed in the console

Actual results

The evaluation throws with:

Uncaught Error: private method calls aren't available in this context
Flags: needinfo?(mgaudet)
See Also: → 1709567

So the story at this point: In Bug 1662559, Jason Orendorff and I changed the storage mechanism for private methods in order reduce the storage requirements of methods. Before that patch stack, each object with a private method was required to have slot for that method. So,

class A { 
  #x() { return 1; }
var a = new Array(1000).fill(1).map(() => new A); 

would have each instance of A have a slot dedicated holding #x, consuming 1000 * slotSize of memory.

After those patches, instead, there is only one slot, held in the environment object corresponding to class A, which holds the reference to #x.

The problem is: Our current front end drops too much information, and is unable to reconstruct the correct location of #x in debugger frames.

This is surmountable, but I didn't consider it a blocker to landing the implementation of fields/methods.

I will spend some time this week trying to figure out the cost of hanging on to enough information to correctly make this work. As those comments hint at; we have most of the machinery required already, but there are few obstacles that remain.

(Side note: The error message is bad; originally I had intended to only disable this for private methods. However, it turns out that when we delazify a script inside a debugger eval, we don't have enough information to to disambiguate methods and fields, so I had to disable it for everything, and forgot to change the message)

Matthew, should we move that bug to the Javascript Engine component so it's tracked by your team?

Assignee: nobody → mgaudet

Yes; I'm about to put a patch up.

I'm going to duplicate this bug as well, as the same restriction is going to remain for private methods after this. I have a partial patch, but won't be able to work on it for a while

Component: Console → JavaScript Engine
Flags: needinfo?(mgaudet)
Product: DevTools → Core
Pushed by
Allow accessing private fields and acessor methods inside of Debugger.Frame.eval r=arai
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Blocks: 1710574
Flags: qe-verify+


I can confirm that this issue is fixed on Fx Nightly 91.0a1(20210607214637), Fx 90.0b4 on Windows 10, ubuntu 18.04 and macOS 11.3.

Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.