Closed
Bug 1141255
Opened 11 years ago
Closed 3 years ago
The debugger can modify unaliased consts
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
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();
Comment 2•9 years ago
|
||
Apparently not :/
> Assertion failed: got 3, expected 2
Comment 3•9 years ago
|
||
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)
Updated•5 years ago
|
Blocks: js-debugger
| Assignee | ||
Comment 4•3 years ago
|
||
Updated•3 years ago
|
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Updated•3 years ago
|
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
Comment 6•3 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
status-firefox108:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•