Bug 198956 - Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
Summary: Web Inspector: Debug: "Reset Web Inspector" should also clear the saved windo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-17 22:42 PDT by Devin Rousso
Modified: 2019-07-02 00:48 PDT (History)
7 users (show)

See Also:


Attachments
Patch (38.51 KB, patch)
2019-06-18 16:02 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (39.37 KB, patch)
2019-06-18 16:27 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (39.15 KB, patch)
2019-06-18 17:33 PDT, Devin Rousso
mattbaker: review+
Details | Formatted Diff | Diff
Patch (39.13 KB, patch)
2019-07-02 00:13 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2019-06-17 22:42:16 PDT
# STEPS TO REPRODUCE:
1. inspect any page
2. change the Web Inspector window size/docking to be different than default
3. enable the debug settings panel (⌥⇧⌘D)
4. click "Reset Web Inspector"
 => Web Inspector window has the same size/docking as before the reset
Comment 1 Devin Rousso 2019-06-18 16:02:54 PDT
Created attachment 372400 [details]
Patch

Lots of plumbing -.-
Comment 2 EWS Watchlist 2019-06-18 16:05:25 PDT Comment hidden (obsolete)
Comment 3 Devin Rousso 2019-06-18 16:27:41 PDT
Created attachment 372403 [details]
Patch

Looks like I missed a few platforms 😅
Comment 4 EWS Watchlist 2019-06-18 16:29:47 PDT Comment hidden (obsolete)
Comment 5 Joseph Pecoraro 2019-06-18 16:37:15 PDT
Comment on attachment 372403 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372403&action=review

> Source/WebCore/inspector/InspectorFrontendHost.cpp:203
> +    if (m_client)
> +        m_client->resetWindowState();

Perhaps this should be `m_client->reset()` or `resetState()`? What if some non-window state creeps in, we would still want to reset it here.

> Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm:128
> +    [m_window removeFrameUsingName:@"WKRemoteWebInspectorWindowFrame"];

The magic string should be shared in this file (perhaps a file static const) to ensure no chance of changing one without the other.

> Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h:86
> +    void deleteInspectorStartsAttached();

Why two calls? I seem unlikely that one will be called without the other.

> Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm:267
> +    [m_frontendWindowController.get() setWindowFrameAutosaveName:@"Web Inspector 2"];

Ditto: magic string.
Comment 6 Devin Rousso 2019-06-18 16:59:53 PDT
Comment on attachment 372403 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372403&action=review

>> Source/WebCore/inspector/InspectorFrontendHost.cpp:203
>> +        m_client->resetWindowState();
> 
> Perhaps this should be `m_client->reset()` or `resetState()`? What if some non-window state creeps in, we would still want to reset it here.

I'd hope that all non-window state is held in the frontend, but good point in case not :)

>> Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h:86
>> +    void deleteInspectorStartsAttached();
> 
> Why two calls? I seem unlikely that one will be called without the other.

I wanted to match the "flexibility" of having each be separate.  Not to mention, there was already a getter/setter specifically for each, so I continued that "pattern".
Comment 7 Devin Rousso 2019-06-18 17:33:49 PDT
Created attachment 372412 [details]
Patch
Comment 8 EWS Watchlist 2019-06-18 17:38:32 PDT Comment hidden (obsolete)
Comment 9 Devin Rousso 2019-06-18 22:04:20 PDT
Comment on attachment 372412 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372412&action=review

> Source/WebInspectorUI/UserInterface/Base/Main.js:3229
> +WI.reset = async function()

This was moved into Main.js primarily to make an easier way of resetting non-engineering builds (assuming you have "access" to inspector2).
Comment 10 Matt Baker 2019-07-01 21:25:26 PDT
Comment on attachment 372412 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372412&action=review

r=me, looks like you addressed Joe's comments.

> Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp:94
> +    CFPreferencesSetAppValue(createKeyForPreferences(key).get(), NULL, kCFPreferencesCurrentApplication);

You can pass nullptr for the CFPropertyListRef argument. Should fix the [style] error.
Comment 11 Devin Rousso 2019-07-02 00:13:51 PDT
Created attachment 373309 [details]
Patch
Comment 12 WebKit Commit Bot 2019-07-02 00:47:20 PDT
Comment on attachment 373309 [details]
Patch

Clearing flags on attachment: 373309

Committed r247043: <https://trac.webkit.org/changeset/247043>
Comment 13 WebKit Commit Bot 2019-07-02 00:47:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Radar WebKit Bug Importer 2019-07-02 00:48:18 PDT
<rdar://problem/52508508>