Closed Bug 1141255 Opened 11 years ago Closed 3 years ago

The debugger can modify unaliased consts

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: jandem, Assigned: anba)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

We fail the testcase below because setVariable sets the const's value to 3. However, if the const is aliased (just add a debugger-statement or a lambda that uses 'x'), the debugger is no longer able to modify it and it throws TypeError: "x" is read-only. var g = newGlobal(); g.parent = this; g.eval("(" + function() { var dbg = new Debugger(parent); dbg.onEnterFrame = function(frame) { frame.onStep = function() { if (frame.environment.getVariable("x") === 2) frame.environment.setVariable("x", 3); } }; } + ")()"); function f() { const x = 2; assertEq(x, 2); } f();
Blocks: 1077945
Is this maybe fixed by the frontend rewrite?
Flags: needinfo?(shu)
Apparently not :/ > Assertion failed: got 3, expected 2
This should be consistent, either both frame and env bindings can be modified or neither can be. But I'm still unclear if this should be allowed or disallowed. I'll chat with jimb.
Flags: needinfo?(shu)
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Severity: normal → S3
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/9c7cd2409020 Prevent debugger from modifying unaliased const bindings. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: