Closed Bug 1780158 Opened 2 years ago Closed 2 years ago

Exclude JSOp::SetAliasedVar ".generator" from Debugger.Script.getEffectfulOffsets

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- unaffected
firefox102 --- unaffected
firefox103 --- unaffected
firefox104 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

The following code expects setBreakpoint doesn't throw, but bug 1776376 changed the behavior and now it can throw.

https://searchfox.org/mozilla-central/rev/f6a2ef2f028b8f1eb82fa5dc5cb1e39a3baa8feb/devtools/server/actors/webconsole/eval-with-debugger.js#377-380

const offsets = script.getEffectfulOffsets();
for (const offset of offsets) {
  script.setBreakpoint(offset, handler);
}

The issue here is the following:

  • Bug 1776376 patch wants to hide the JSOp::SetAliasedVar ".generator" from consumer
  • getEffectfulOffsets doesn't hide it because it thinks the instruction is effectful

Then, JSOp::SetAliasedVar ".generator" isn't actually "effectful" in term of getEffectfulOffsets method's definition.

https://searchfox.org/mozilla-central/rev/fa71140041c5401b80a11f099cc0cd0653295e2c/js/src/doc/Debugger/Debugger.Script.md#360-365

### `getEffectfulOffsets()`
**If the instance refers to a `JSScript`**, return an array
containing the offsets of all bytecodes in the script which can have direct
side effects that are visible outside the currently executing frame.  This
includes, for example, operations that set properties or elements on
objects, or that may set names in environments created outside the frame.

JSOp::SetAliasedVar ".generator" sets engine-internal variable, and it's not visible outside the frame.

We can change getEffectfulOffsets not to return the JSOp::SetAliasedVar ".generator", so that the above code in devtools keeps working.

Set release status flags based on info from the regressing bug 1776376

The Bugbug bot thinks this bug is a defect, but please change it back in case of error.

Type: task → defect
Severity: -- → N/A
Priority: -- → P1
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/bbe1d96dc63d
Exclude JSOp::SetAliasedVar .generator from Debugger.Script.getEffectfulOffsets. r=mgaudet
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: