RESOLVED FIXED 195777
Web Inspector: provide a debug setting button to reset all settings for easier testing/presentation
https://bugs.webkit.org/show_bug.cgi?id=195777
Summary Web Inspector: provide a debug setting button to reset all settings for easie...
Devin Rousso
Reported 2019-03-14 16:02:33 PDT
If I've set a ton of breakpoints, it can be really annoying to have to try to visit all the sites (or open inspector2) that have breakpoints and delete them.
Attachments
Patch (15.94 KB, patch)
2019-03-14 18:02 PDT, Devin Rousso
no flags
[Image] After Patch is applied (Dark) (535.83 KB, image/png)
2019-03-14 18:02 PDT, Devin Rousso
no flags
[Image] After Patch is applied (Light) (525.59 KB, image/png)
2019-03-14 18:02 PDT, Devin Rousso
no flags
Patch (16.21 KB, patch)
2019-03-14 19:13 PDT, Devin Rousso
no flags
Patch (16.33 KB, patch)
2019-03-15 17:12 PDT, Devin Rousso
no flags
Patch (3.07 KB, patch)
2019-05-22 00:53 PDT, Devin Rousso
no flags
Patch (3.04 KB, patch)
2019-05-22 15:32 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-03-14 18:02:15 PDT
Devin Rousso
Comment 2 2019-03-14 18:02:32 PDT
Created attachment 364741 [details] [Image] After Patch is applied (Dark)
Devin Rousso
Comment 3 2019-03-14 18:02:43 PDT
Created attachment 364742 [details] [Image] After Patch is applied (Light)
Devin Rousso
Comment 4 2019-03-14 19:13:47 PDT
Radar WebKit Bug Importer
Comment 5 2019-03-14 23:45:54 PDT
Joseph Pecoraro
Comment 6 2019-03-15 11:54:09 PDT
Comment on attachment 364754 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364754&action=review > Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:281 > + for (let i = 0; i < window.localStorage.length; ++i) { > + let key = window.localStorage.key(i); > + if (key.startsWith(prefix)) > + window.localStorage.removeItem(key); > + } Doesn't this miss every other item? localStorage.clear() localStorage.a = 1; localStorage.b = 2; localStorage.c = 3; for (let i = 0; i < window.localStorage.length; ++i) { let key = window.localStorage.key(i); window.localStorage.removeItem(key); } console.log(localStorage.length); // => 1 You are mutating the thing that you are iterating over. A safer way would be to get a list of keys to remove and then remove them: localStorage.clear() localStorage.a = 1; localStorage.b = 2; localStorage.c = 3; let keysToRemove = []; for (let i = 0; i < window.localStorage.length; ++i) { let key = window.localStorage.key(i); keysToRemove.push(key) } for (let key of keysToRemove) window.localStorage.removeItem(key); console.log(localStorage.length); // => 0
Joseph Pecoraro
Comment 7 2019-03-15 11:55:36 PDT
The modal looks pretty good but does seem a bit out of place for macOS.
Devin Rousso
Comment 8 2019-03-15 12:02:59 PDT
Comment on attachment 364754 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364754&action=review >> Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:281 >> + } > > Doesn't this miss every other item? > > localStorage.clear() > localStorage.a = 1; > localStorage.b = 2; > localStorage.c = 3; > > for (let i = 0; i < window.localStorage.length; ++i) { > let key = window.localStorage.key(i); > window.localStorage.removeItem(key); > } > > console.log(localStorage.length); // => 1 > > You are mutating the thing that you are iterating over. > > A safer way would be to get a list of keys to remove and then remove them: > > localStorage.clear() > localStorage.a = 1; > localStorage.b = 2; > localStorage.c = 3; > > let keysToRemove = []; > for (let i = 0; i < window.localStorage.length; ++i) { > let key = window.localStorage.key(i); > keysToRemove.push(key) > } > > for (let key of keysToRemove) > window.localStorage.removeItem(key); > > console.log(localStorage.length); // => 0 Crap! Good catch!
Devin Rousso
Comment 9 2019-03-15 17:12:26 PDT
Timothy Hatcher
Comment 10 2019-03-20 09:16:18 PDT
Comment on attachment 364885 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364885&action=review I think we need a dialog UI for Web Inspector — maybe WI.Modal is that but as WI.ModalDialog. Blurring the entire window is not ideal and not something found in other apps. This would be a dialog with Reset and Cancel buttons. Having one button makes it hard to reason how to exit without resetting. > Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:261 > + resetModalButton.addEventListener("click", (event) => { This handler is big for being inline. I would expect this to be moved to a member function. It also is more Manager like than View like code. Main.js would be a better place for this logic to be maintained.
Devin Rousso
Comment 11 2019-05-22 00:53:53 PDT
Devin Rousso
Comment 12 2019-05-22 00:55:16 PDT
Comment on attachment 370385 [details] Patch Moved the reset button to be inside the Debug panel, as that's we don't want users to ever hit this (especially not accidentally). It's mainly for engineers to use for testing/presenting :P
Joseph Pecoraro
Comment 13 2019-05-22 10:35:51 PDT
Comment on attachment 370385 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=370385&action=review r=me > Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:364 > + WI.ObjectStore.reset(); > + InspectorFrontendHost.reopen(); ObjectStore.reset() is async and we should probably wait for it. Should this instead be: resetInspectorButton.addEventListener("click", async (event) => { WI.Setting.reset(); await WI.ObjectStore.reset(); InspectorFrontendHost.reopen(); });
Devin Rousso
Comment 14 2019-05-22 15:32:59 PDT
WebKit Commit Bot
Comment 15 2019-05-22 16:12:13 PDT
Comment on attachment 370454 [details] Patch Clearing flags on attachment: 370454 Committed r245657: <https://trac.webkit.org/changeset/245657>
WebKit Commit Bot
Comment 16 2019-05-22 16:12:15 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.