Open Bug 1829609 Opened 1 year ago Updated 1 year ago

Add watchpoints for variables, not only object properties

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: Honza, Unassigned)

References

(Blocks 1 open bug)

Details

Originally reported here:
https://connect.mozilla.org/t5/ideas/firefox-developer-add-watchpoints-for-variables-not-only-object/idi-p/28845

It would be great to be able to use watchpoints also for variables that are not object properties and therefore also for module variables.

Honza

Alex, do you know how feasible this is to support?

Flags: needinfo?(poirot.alex)

It sounds hard to even imagine as each module is having its own scope.
Modules are similar to saying watchpoint should see foo variable in these codes:
``
<script>
function myFun() {
let foo = 42;
}
function myOtherFun() {
let foo = 43;
}
</script>
<script src=MyModule.esm type=module />
<script src=MyOtherModule.esm type=module />

MyModule.esm:

let foo = 44;

MyOtherModule.esm:

let foo = 45;


Which `foo` would you want to display out of these 4?
It sounds very complex to be able to display function scoped variable without pausing in them.
For modules... you can already see them by pausing in them.
We might be able to display them if we were able to select them as the current inspected scope/global, but this would involve some significant UX work to make that clear!
Flags: needinfo?(poirot.alex)
You need to log in before you can comment on or make changes to this bug.