Open Bug 638044 Opened 13 years ago Updated 1 year ago

JavaScript needs whole-object watchpoints

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: jimb, Unassigned)

References

(Blocks 2 open bugs)

Details

It would be neat to have watchpoints that watch all properties on a particular object, watchpoints on property additions, deletions, reconfigurations, and so on.
Blocks: 638053
See also Andreas Gal's comment on 
See also https://bugzilla.mozilla.org/show_bug.cgi?id=579342

The 'recursion' problem, or the extension of watchpoint to variables is critical:
   var foo ={};
   foo.bar ="baz";
We need to know both that foo.bar was created *and* that foo was created. If the developer is concerned with 'foo' they don't want to have two different approaches if 'foo' is a property or a variable.
Component: JavaScript Debugging/Profiling APIs → JavaScript Engine
As bug 637913 indicates this issue is having a high priority for Firebug. Our use case is to stop the script execution on property addition and removal[1].

Sebastian

[1] http://code.google.com/p/fbug/issues/detail?id=4162
I believe implementing Object.observe (bug 800355) would work here.
Depends on: 800355
So maybe this bug should be merged into bug 800355?
Or do "watchpoints" cover something additional or different?

Sebastian
Perhaps not additional, but different. Object.observe reports activity on some subsequent event loop tick, whereas debugger watchpoints need to trigger immediately when the modification takes place.
I'm not quite sure what you mean with "some subsequent event loop tick" but it sounds like we really need watchpoints as you describe them for our use case.

Sebastian
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.