Bug 200652

Summary: Web Inspector: Debugger: add a global breakpoint for pausing in the next microtask
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, hi, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
joepeck: review+
[Image] After Patch is applied
none
Patch
none
Patch none

Devin Rousso
Reported 2019-08-12 18:20:24 PDT
This would be similar to the "All Animation Frames"/"All Timeouts"/"All Intervals"/"All Events" breakpoints, except that it would also work for JSContext inspection.
Attachments
Patch (64.75 KB, patch)
2019-08-19 00:20 PDT, Devin Rousso
joepeck: review+
[Image] After Patch is applied (49.18 KB, image/png)
2019-08-19 00:49 PDT, Devin Rousso
no flags
Patch (64.75 KB, patch)
2019-08-19 23:09 PDT, Devin Rousso
no flags
Patch (64.82 KB, patch)
2019-08-19 23:14 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-08-19 00:20:11 PDT
EWS Watchlist
Comment 2 2019-08-19 00:21:39 PDT Comment hidden (obsolete)
Devin Rousso
Comment 3 2019-08-19 00:49:12 PDT
Created attachment 376671 [details] [Image] After Patch is applied
Joseph Pecoraro
Comment 4 2019-08-19 22:27:06 PDT
Comment on attachment 376667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376667&action=review Nice! Good tests. r=me Seems like perhaps the only remaining script entry points (that I know of) are: (1) API Entry points - Ex. JSEvaluteScript / -[JSContext evaluteScript:] (2) Normal Script entry points for a Program / Module - Ex. <script src="..." async> - Ex. eval('...') (3) Observer Script handlers - Ex. PerformanceObserver, IntersectionObserver, handlers (4) APIs with callbacks that aren't events or Observers - Ex. geolocation callbacks (1) and (2) seem useful for users to break on. Maybe a Breakpoint on script entry "All Script Entries" / "All Script Evaluations" would be good. (3) and (4) cases seem like Events / specific functions akin to setTimeout. Seems overkill to call them out specifically though. Anything I missed worth considering? > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:152 > + // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseOnMicrotasks did not exist yet. Nit: I think we should use (iOS 13) in all of these compatibility comments, as it did not exist in iOS 13.0. > Source/WebInspectorUI/UserInterface/Images/Microtask.svg:3 > +<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> Sometimes we have `id="root"` and other times we don't. Not sure why... I normally remove it if I don't see a need for it.
Devin Rousso
Comment 5 2019-08-19 23:09:05 PDT
Comment on attachment 376667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376667&action=review > Seems like perhaps the only remaining script entry points (that I know of) are: > > (1) API Entry points > - Ex. JSEvaluteScript / -[JSContext evaluteScript:] > (2) Normal Script entry points for a Program / Module > - Ex. <script src="..." async> > - Ex. eval('...') > > (3) Observer Script handlers > - Ex. PerformanceObserver, IntersectionObserver, handlers > (4) APIs with callbacks that aren't events or Observers > - Ex. geolocation callbacks > > > (1) and (2) seem useful for users to break on. Maybe a Breakpoint on script entry "All Script Entries" / "All Script Evaluations" would be good. I like it! I see this being useful along the lines (somewhat) of the Inspector Bootstrap Script concept <https://webkit.org/b/195847>. > (3) and (4) cases seem like Events / specific functions akin to setTimeout. Seems overkill to call them out specifically though. Perhaps we should consider these as microtasks. It looks like `MutationObserver` actually uses a form of microtask, whereas `IntersectionObserver` uses a timer and `PerformanceObserver` uses a task queue (run loop). I'm not against the idea of creating a "Observer Callback..." breakpoint that can be customized by observer type (like "Event Breakpoint..."), but if we create a "All Script Entries" breakpoint then these would likely be covered by that as well (microtasks and events too). > Anything I missed worth considering? I feel like with the addition of the "All Microtasks" breakpoint, all of the various ways to enter script (other than (1) and (2) above) are covered as part of one of the "categories" we already have breakpoints for (e.g. events, timers, etc). I think the next useful thing to do is to provide breakpoint actions for all of the non-JavaScript breakpoints, as well as getting full stack trace information (where applicable). I also have been pondering the idea of extending URL breakpoints to work for _any_ situation where network activity is triggered by script (e.g. `img.src = "..."`). >> Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:152 >> + // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseOnMicrotasks did not exist yet. > > Nit: I think we should use (iOS 13) in all of these compatibility comments, as it did not exist in iOS 13.0. LOL 😂 bad copypasta. Nice catch! >> Source/WebInspectorUI/UserInterface/Images/Microtask.svg:3 >> +<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 16 16"> > > Sometimes we have `id="root"` and other times we don't. Not sure why... I normally remove it if I don't see a need for it. This is needed by `WI.ImageUtilities.useSVGSymbol`. ``` // URL must contain a fragment reference to a graphical element, like a symbol. If none is given // append #root which all of our SVGs have on the top level <svg> element. if (!url.includes("#")) url += "#root"; ```
Devin Rousso
Comment 6 2019-08-19 23:09:37 PDT
WebKit Commit Bot
Comment 7 2019-08-19 23:12:09 PDT Comment hidden (obsolete)
Devin Rousso
Comment 8 2019-08-19 23:14:51 PDT
WebKit Commit Bot
Comment 9 2019-08-19 23:58:21 PDT
Comment on attachment 376749 [details] Patch Clearing flags on attachment: 376749 Committed r248894: <https://trac.webkit.org/changeset/248894>
WebKit Commit Bot
Comment 10 2019-08-19 23:58:23 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2019-08-19 23:59:18 PDT
Note You need to log in before you can comment on or make changes to this bug.