Closed Bug 1647437 Opened 1 year ago Closed 1 year ago

Allow accessing private fields via Debugger.Frame.prototype.eval

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: mgaudet, Assigned: avandolder)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

The basic private field support in Bug 1642476 will not correctly run the following test case (as js/src/jit-test/tests/fields/private-eval-in-frame.js)

// |jit-test| --enable-private-fields;
load(libdir + 'asserts.js');
load(libdir + 'evalInFrame.js');

class B {
  #x = 12
  x = 'his'
  ef(str) {
    return evalInFrame(0, str);
  }
}
var b = new B;
assertEq(b.ef(`this.x`), 'his');
assertEq(b.ef(`this.#x`), 12); // Will throw syntax error

This code will throw a syntax error where it ought not to. This is because of the peculiar scope chain used (see this bug for some of the details).

To fix this, we need to generalize this code to allow us to compute the effective scope for these in the general case.

Note: Bug 793345 argues we ought to instead just remove the non-syntactic scope from the debugger which would be the general fix.

Severity: -- → N/A
Priority: -- → P2
Assignee: nobody → avandolder
Status: NEW → ASSIGNED
Depends on: 1660853
Depends on: 1661482
Pushed by avandolder@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a81d7124a27b
Allow accessing private fields and methods via Debugger.Frame.eval. r=mgaudet
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.