<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>142914</bug_id>
          
          <creation_ts>2015-03-20 11:50:02 -0700</creation_ts>
          <short_desc>Web Inspector: Add Function Breakpoints/Tracepoints (like Symbolic Breakpoints)</short_desc>
          <delta_ts>2022-09-02 10:38:37 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>243717</blocked>
    
    <blocked>244642</blocked>
    
    <blocked>243716</blocked>
    
    <blocked>244717</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Devin Rousso">hi</assigned_to>
          <cc>graouts</cc>
    
    <cc>inspector-bugzilla-changes</cc>
    
    <cc>joepeck</cc>
    
    <cc>jonowells</cc>
    
    <cc>mark.lam</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1078909</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-03-20 11:50:02 -0700</bug_when>
    <thetext>* SUMMARY
Add Function Breakpoints/Tracepoints (like Symbolic Breakpoints).

Often something you want to do is &quot;pause when window.focus is called&quot;, or &quot;do a console.trace every time Element.prototype.querySelector is called&quot;. It is possible to swizzle these functions out and get the functionality but that is cumbersome and doesn&apos;t play well with the inspector.

It would be awesome if you could create a function breakpoint in Web Inspector&apos;s UI. Or via the console like `debug(window.focus)` or `trace(Element.prototype, &quot;querySelector&quot;)` 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&apos;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, &quot;altKey&quot;).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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1078910</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2015-03-20 11:50:24 -0700</bug_when>
    <thetext>&lt;rdar://problem/20242025&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1078911</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-03-20 11:56:13 -0700</bug_when>
    <thetext>&gt; - 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1279183</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2017-02-20 19:03:51 -0800</bug_when>
    <thetext>Mark mentioned this may be easy with Native functions by inserting a middle thunk into the JITCode entry for Native Functions. This wouldn&apos;t work for built-in / Intrinsic functions though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1889931</commentid>
    <comment_count>4</comment_count>
    <who name="Devin Rousso">hi</who>
    <bug_when>2022-08-08 22:14:53 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/3140</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890842</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-08-12 02:17:29 -0700</bug_when>
    <thetext>Committed 253374@main (631ebd578bab): &lt;https://commits.webkit.org/253374@main&gt;

Reviewed commits have been landed. Closing PR #3140 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>