RESOLVED FIXED 144124
Web Inspector: run a customizable bootstrap function after the UI has fully loaded
https://bugs.webkit.org/show_bug.cgi?id=144124
Summary Web Inspector: run a customizable bootstrap function after the UI has fully l...
Brian Burg
Reported 2015-04-23 15:03:29 PDT
The point of a "bootstrap script" is to reduce amount of time clicking on the UI to get the inspector to a useful state for debugging. Instead, you write commands in a function that runs after the inspector has loaded. These commands automate reproduction steps, and can be shared as part of a bug report (if obvious). Some things you might want to do include opening different sidebars, browsing between web pages, evaluating text in the console.
Attachments
Patch (4.47 KB, patch)
2015-04-23 15:52 PDT, Brian Burg
joepeck: review+
Radar WebKit Bug Importer
Comment 1 2015-04-23 15:04:13 PDT
Brian Burg
Comment 2 2015-04-23 15:52:00 PDT
Timothy Hatcher
Comment 3 2015-04-23 16:03:24 PDT
Comment on attachment 251503 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251503&action=review > Source/WebInspectorUI/UserInterface/Main.html:539 > + <script src="Base/Bootstrap.js"></script> Should this file be skipped when combining for Release/Production?
Brian Burg
Comment 4 2015-04-23 16:46:34 PDT
(In reply to comment #3) > Comment on attachment 251503 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=251503&action=review > > > Source/WebInspectorUI/UserInterface/Main.html:539 > > + <script src="Base/Bootstrap.js"></script> > > Should this file be skipped when combining for Release/Production? I suppose that's possible, though I don't think we do that anywhere else? It would require blacklisting in inline-and-minify-stylesheets-and-scripts.py, and maybe other parts to avoid copying the resource. I wasn't planning to have anything in the function body on trunk; developers can revert or exclude their little scripts from patches. Reusable snippets can live in comments in Bootstrap.js (to be stripped out) or on the wiki.
Joseph Pecoraro
Comment 5 2015-04-23 17:06:37 PDT
Comment on attachment 251503 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251503&action=review Seems fine to me. Do you have an example of a bootstrap you might use? > Source/WebInspectorUI/UserInterface/Base/Main.js:361 > + if (this.runBootstrapOperations && typeof this.runBootstrapOperations === "function") > + this.runBootstrapOperations(); No need to if-check? It is guaranteed right now. >>> Source/WebInspectorUI/UserInterface/Main.html:539 >>> + <script src="Base/Bootstrap.js"></script> >> >> Should this file be skipped when combining for Release/Production? > > I suppose that's possible, though I don't think we do that anywhere else? It would require blacklisting in inline-and-minify-stylesheets-and-scripts.py, and maybe other parts to avoid copying the resource. > > I wasn't planning to have anything in the function body on trunk; developers can revert or exclude their little scripts from patches. Reusable snippets can live in comments in Bootstrap.js (to be stripped out) or on the wiki. This should minify down to: WebInspector.runBootstrapOperations=function(){}; So it may be fine to leave in.
Brian Burg
Comment 6 2015-04-23 20:09:39 PDT
Brian Burg
Comment 7 2015-04-23 21:20:05 PDT
(In reply to comment #5) > Comment on attachment 251503 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=251503&action=review > > Seems fine to me. Do you have an example of a bootstrap you might use? Something I did over and over when doing element tracking feature is to load a page, select the same element in the DOM, and invoke "Start Tracking". This could have been automated by doing querySelector to get the node, then passing it to DOMTracingManager.startTracking(). Further work on specific screens could have been automated by programmatically changing the content browser's represented object. I'll update the wiki page (https://trac.webkit.org/wiki/WebInspectorDebugging) as I make use of this feature to help share some useful snippets.
Timothy Hatcher
Comment 8 2015-04-23 23:33:34 PDT
Comment on attachment 251503 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251503&action=review >>>> Source/WebInspectorUI/UserInterface/Main.html:539 >>>> + <script src="Base/Bootstrap.js"></script> >>> >>> Should this file be skipped when combining for Release/Production? >> >> I suppose that's possible, though I don't think we do that anywhere else? It would require blacklisting in inline-and-minify-stylesheets-and-scripts.py, and maybe other parts to avoid copying the resource. >> >> I wasn't planning to have anything in the function body on trunk; developers can revert or exclude their little scripts from patches. Reusable snippets can live in comments in Bootstrap.js (to be stripped out) or on the wiki. > > This should minify down to: > WebInspector.runBootstrapOperations=function(){}; > > So it may be fine to leave in. We skip combining (or combine separately) files in External/*.
Note You need to log in before you can comment on or make changes to this bug.