RESOLVED FIXED 198855
Web Inspector: Debugger: support pattern blackboxing
https://bugs.webkit.org/show_bug.cgi?id=198855
Summary Web Inspector: Debugger: support pattern blackboxing
Devin Rousso
Reported 2019-06-14 01:30:00 PDT
(In reply to Emanuele Feliziani from <https://webkit.org/b/17240#c8>) > I'm jumping in to suggest folder-level blackboxing or even pattern-based, just as you have in Chrome. With today's JavaScript stacks, it's more convenient to just blackbox everything within node_modules.
Attachments
Patch (77.10 KB, patch)
2019-09-06 10:59 PDT, Devin Rousso
no flags
Patch (77.10 KB, patch)
2019-09-06 11:00 PDT, Devin Rousso
no flags
[Image] After Patch is applied (Settings) (564.50 KB, image/png)
2019-09-06 11:01 PDT, Devin Rousso
no flags
[Image] After Patch is applied (WI.SourceCodeTreeElement) (117.50 KB, image/png)
2019-09-06 11:04 PDT, Devin Rousso
no flags
Patch (82.68 KB, patch)
2019-09-19 01:19 PDT, Devin Rousso
no flags
[Image] After Patch is applied (Settings Tab) (463.68 KB, image/png)
2019-09-19 01:20 PDT, Devin Rousso
no flags
Patch (82.70 KB, patch)
2019-09-19 01:22 PDT, Devin Rousso
no flags
Patch (89.27 KB, patch)
2019-09-25 19:04 PDT, Devin Rousso
no flags
[Image] After Patch is applied (183.27 KB, image/png)
2019-09-25 19:05 PDT, Devin Rousso
no flags
Patch (89.32 KB, patch)
2019-09-25 19:09 PDT, Devin Rousso
no flags
Patch (89.20 KB, patch)
2019-10-11 19:53 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-09-06 10:59:28 PDT
EWS Watchlist
Comment 2 2019-09-06 11:00:10 PDT Comment hidden (obsolete)
Devin Rousso
Comment 3 2019-09-06 11:00:13 PDT
Created attachment 378208 [details] Patch oops, one minor fix
Devin Rousso
Comment 4 2019-09-06 11:01:12 PDT
Created attachment 378209 [details] [Image] After Patch is applied (Settings) I'm open to suggestions for where we should put the blackbox pattern table, or if there's a different/better UI for it.
Devin Rousso
Comment 5 2019-09-06 11:04:08 PDT
Created attachment 378210 [details] [Image] After Patch is applied (WI.SourceCodeTreeElement) I'm tempted to switch the UI so that regular URL blackboxing uses the "boxed" eye [<(*)>] and pattern blackboxing just has the greyed out eye <(*)>, as the "boxed" one looks more like a click target than the regular eye. Many other apps just use an eye though, so that may be more familiar (precedent). Any ideas of how to distinguish a between toggle-able URL blackbox (e.g. for a specific resource) vs a matched pattern blackbox (which can't be turned off for a specific resource, and instead matches an indeterminate number of URLs) are welcome :)
EWS Watchlist
Comment 6 2019-09-06 13:13:52 PDT Comment hidden (obsolete)
Sam Weinig
Comment 7 2019-09-08 14:04:09 PDT
From the screenshots, it's not clear to me what this feature does. Can we make the UI in the settings more clear about what "blackboxing" is? Can we use a term that perhaps more folks are familiar with?
Devin Rousso
Comment 8 2019-09-10 20:13:37 PDT
(In reply to Sam Weinig from comment #7) > From the screenshots, it's not clear to me what this feature does. Can we make the UI in the settings more clear about what "blackboxing" is? Can we use a term that perhaps more folks are familiar with? I'll add some explanatory text above the table that gives an idea of what blackboxing is, but I'm not sure there is a more applicable/accurate term (at least using just one word) than "blackboxing". If you search for "blackboxing" on the internet, one of the first results that appears is the Chrome DevTools page about script blackboxing. Once the Sources Tab becomes non-experimental, I'm also planning on writing a blog post about this feature so there will be more explanation available online as well.
Sam Weinig
Comment 9 2019-09-10 22:29:46 PDT
(In reply to Devin Rousso from comment #8) > (In reply to Sam Weinig from comment #7) > > From the screenshots, it's not clear to me what this feature does. Can we make the UI in the settings more clear about what "blackboxing" is? Can we use a term that perhaps more folks are familiar with? > I'll add some explanatory text above the table that gives an idea of what > blackboxing is, but I'm not sure there is a more applicable/accurate term > (at least using just one word) than "blackboxing". If you search for > "blackboxing" on the internet, one of the first results that appears is the > Chrome DevTools page about script blackboxing. Once the Sources Tab becomes > non-experimental, I'm also planning on writing a blog post about this > feature so there will be more explanation available online as well. What's the text you plan on adding, maybe it will help me understand, provide feedback.
Devin Rousso
Comment 10 2019-09-18 20:07:17 PDT
(In reply to Sam Weinig from comment #9) > (In reply to Devin Rousso from comment #8) > > (In reply to Sam Weinig from comment #7) > > > From the screenshots, it's not clear to me what this feature does. Can we make the UI in the settings more clear about what "blackboxing" is? Can we use a term that perhaps more folks are familiar with? > > I'll add some explanatory text above the table that gives an idea of what blackboxing is, but I'm not sure there is a more applicable/accurate term (at least using just one word) than "blackboxing". If you search for "blackboxing" on the internet, one of the first results that appears is the Chrome DevTools page about script blackboxing. Once the Sources Tab becomes non-experimental, I'm also planning on writing a blog post about this feature so there will be more explanation available online as well. > > What's the text you plan on adding, maybe it will help me understand, provide feedback. I think something along the lines of: """ If the url of any script matches one of the regular expression patterns below, the debugger will defer any pauses that would've happened in that script until execution has continued outside of that script. """ That's the basic idea of what blackboxing is. Our implementation has one nice feature in that we "carry forward" the pause reason and data (as much as we can) from the original pause in the script (which was deferred) to the new pause location outside of the script. FWIW, individual script blackboxing (e.g. based on a specific load/instance of a specific resource, not just the URL) was added in r249450 <https://webkit.org/b/17240>. This patch allows for URL based pattern blackboxing, which could be useful for situations where the URL slightly changes between sessions (e.g. a timestamp as a query parameter).
Devin Rousso
Comment 11 2019-09-19 01:19:30 PDT
Created attachment 379110 [details] Patch Add explanatory text and fixed an issue where CodeMirror wouldn't show initial content due to being added to the DOM tree before the tree was attached to the main document.
Devin Rousso
Comment 12 2019-09-19 01:20:04 PDT
Created attachment 379111 [details] [Image] After Patch is applied (Settings Tab)
Devin Rousso
Comment 13 2019-09-19 01:22:15 PDT
Created attachment 379112 [details] Patch Slightly adjusted explanation text content grammar and formatting.
Devin Rousso
Comment 14 2019-09-25 19:04:42 PDT
Devin Rousso
Comment 15 2019-09-25 19:05:57 PDT
Created attachment 379604 [details] [Image] After Patch is applied
Devin Rousso
Comment 16 2019-09-25 19:09:26 PDT
Created attachment 379605 [details] Patch Rebase
Timothy Hatcher
Comment 17 2019-10-11 18:24:54 PDT
Comment on attachment 379605 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379605&action=review > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:168 > + const shouldBlackbox = true; > + { > + const caseSensitive = true; Nit: This style bothers me more than it likely should… but I'd add an empty line after const shouldBlackbox. > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:173 > + } > + { > + const isRegex = true; Ditto. I would at least ad an empty line between these blocks (for my sanity.) > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:447 > + console.assert(shouldBlackbox !== ((this.blackboxDataForSourceCode(sourceCode) || {}).type === DebuggerManager.BlackboxType.URL)); Nit: Group the assert with the asserts before and put the blank line below it instead? > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:471 > + let data = { > + url: regex.source, > + caseSensitive: !regex.ignoreCase, > + }; Nit: Blank lines before and after.. > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:478 > + } > + this._blackboxedPatternsSetting.save(); Nit: Blank line between. > Source/WebInspectorUI/UserInterface/Images/Hide.svg:27 > + <symbol id="hide"> "hide" is an odd name, and could be confused. Maybe "eye"? > Source/WebInspectorUI/UserInterface/Images/Hide.svg:36 > + <svg id="currentColor"><use xlink:href="#hide"/></svg> > + <svg id="white"><use xlink:href="#hide"/></svg> > + <svg id="black"><use xlink:href="#hide"/></svg> Clever use of vars, symbols and currentColor! Awesome that all works. > Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:129 > + }); > + this._blackboxPatternCodeMirrorMap.set(regex, urlCodeMirror); Nit: Blank line between. > Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:176 > + }; > + urlCodeMirror.addKeyMap({ Nit: Blank line between. > Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:180 > + }); > + urlCodeMirror.on("blur", update); Nit: Blank line between. > Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:183 > + if (WI.DebuggerManager.supportsBlackboxingScripts()) { > + this._blackboxSettingsView = new WI.BlackboxSettingsView; > + this.addSettingsView(this._blackboxSettingsView); > + } Nit: Blank lines before and after. > Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js:226 > + } > + console.assert(this._toggleBlackboxedImageElement.title); Nit: Blank line between.
Devin Rousso
Comment 18 2019-10-11 19:42:31 PDT
Comment on attachment 379605 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379605&action=review >> Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:471 >> + }; > > Nit: Blank lines before and after.. I'd put one before, but I'd personally not add one after cause it's used right after and only right after, so it's "related". >> Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:129 >> + this._blackboxPatternCodeMirrorMap.set(regex, urlCodeMirror); > > Nit: Blank line between. This is a pretty common pattern we have for adding objects we just created to some sort of collection. I'd also "ditto" my last response. >> Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:176 >> + urlCodeMirror.addKeyMap({ > > Nit: Blank line between. Ditto >> Source/WebInspectorUI/UserInterface/Views/BlackboxSettingsView.js:180 >> + urlCodeMirror.on("blur", update); > > Nit: Blank line between. Ditto
Devin Rousso
Comment 19 2019-10-11 19:53:27 PDT
WebKit Commit Bot
Comment 20 2019-10-11 20:57:51 PDT
Comment on attachment 380811 [details] Patch Clearing flags on attachment: 380811 Committed r251039: <https://trac.webkit.org/changeset/251039>
WebKit Commit Bot
Comment 21 2019-10-11 20:57:53 PDT
All reviewed patches have been landed. Closing bug.
Ling Ho
Comment 22 2019-10-15 14:45:00 PDT
Note You need to log in before you can comment on or make changes to this bug.