Bug 142914
| Summary: | Web Inspector: Add Function Breakpoints/Tracepoints (like Symbolic Breakpoints) | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
| Component: | Web Inspector | Assignee: | Devin Rousso <hi> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | graouts, inspector-bugzilla-changes, joepeck, jonowells, mark.lam, saam, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
| Bug Depends on: | |||
| Bug Blocks: | 243717, 244642, 243716, 244717 | ||
Joseph Pecoraro
* SUMMARY
Add Function Breakpoints/Tracepoints (like Symbolic Breakpoints).
Often something you want to do is "pause when window.focus is called", or "do a console.trace every time Element.prototype.querySelector is called". It is possible to swizzle these functions out and get the functionality but that is cumbersome and doesn't play well with the inspector.
It would be awesome if you could create a function breakpoint in Web Inspector's UI. Or via the console like `debug(window.focus)` or `trace(Element.prototype, "querySelector")` which would show up as a Breakpoint in Web Inspector and managed by Web Inspector. We may be able to avoid swizzling if the feature is in the engine.
By having Web Inspector know about and manage these function breakpoints it has the opportunity to persist the breakpoints, carry them forward through navigations so you don't need to re-set them, and apply them to sub-frames automatically.
- If the function breakpoints is set on a Native Function that is not a JSBoundFunction, then e should be able to restore the breakpoint immediately after navigation (when the global object is cleared).
- Tricky with native getters/setters (Object.getOwnPropertyDescriptor(MouseEvent.prototype, "altKey").get) but that could be made to work.
* NOTES
Existing snippets that do things like this:
- https://github.com/NV/captureCalls.js
- https://gist.github.com/NV/5376464
- https://github.com/paulirish/break-on-access
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/20242025>
Joseph Pecoraro
> - https://github.com/paulirish/break-on-access
I believe this will even swizzle out a value descriptor with a getter/setter so that you can break on any access to the original property. That also sounds useful.
Also, integration with the text editor to quickly set these breakpoints on member variables sounds useful as well.
Joseph Pecoraro
Mark mentioned this may be easy with Native functions by inserting a middle thunk into the JITCode entry for Native Functions. This wouldn't work for built-in / Intrinsic functions though.
Devin Rousso
Pull request: https://github.com/WebKit/WebKit/pull/3140
EWS
Committed 253374@main (631ebd578bab): <https://commits.webkit.org/253374@main>
Reviewed commits have been landed. Closing PR #3140 and removing active labels.