Bug 179717 - Web Inspector: REGRESSION (r217750): Navigation sidebar broken after closing and re-opening tab
Summary: Web Inspector: REGRESSION (r217750): Navigation sidebar broken after closing ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P1 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-14 21:35 PST by Matt Baker
Modified: 2017-11-15 15:39 PST (History)
4 users (show)

See Also:


Attachments
Patch (6.15 KB, patch)
2017-11-14 22:19 PST, Matt Baker
no flags Details | Formatted Diff | Diff
Patch (5.23 KB, patch)
2017-11-15 14:19 PST, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2017-11-14 21:35:38 PST
Summary:
Navigation sidebar broken after closing and re-opening tab.

Steps to Reproduce:
1. Goto Debugger tab
2. Toggle "disable all breakpoints" in the navigation bar
3. Close and then re-open the Debugger tab
4. Toggle "disable all breakpoints"
  => Nothing happens

The regression was caused by http://trac.webkit.org/changeset/220114:
<https://webkit.org/b/174484> Web Inspector: create Recording tab for displaying recordings

Navigation sidebar creation was changed to use WI.instanceForClass, which keeps the sidebar around instead of recreating it each time. Classes implementing closed() expect to be destroyed and recreated. When the Debugger tab is closed the sidebar panel removes its event listeners. When the Debugger tab is reopened, the sidebar returns as a zombie.
Comment 1 Radar WebKit Bug Importer 2017-11-14 21:38:49 PST
<rdar://problem/35551541>
Comment 2 Radar WebKit Bug Importer 2017-11-14 21:38:50 PST
<rdar://problem/35551542>
Comment 3 Matt Baker 2017-11-14 21:42:12 PST
(In reply to Matt Baker from comment #0)
> Summary:
> Navigation sidebar broken after closing and re-opening tab.
> 
> Steps to Reproduce:
> 1. Goto Debugger tab
> 2. Toggle "disable all breakpoints" in the navigation bar
> 3. Close and then re-open the Debugger tab
> 4. Toggle "disable all breakpoints"
>   => Nothing happens
> 
> The regression was caused by http://trac.webkit.org/changeset/220114:
> <https://webkit.org/b/174484> Web Inspector: create Recording tab for
> displaying recordings

Wrong bug!

It should be http://trac.webkit.org/changeset/217750:
<https://webkit.org/b/172621> Web Inspector: Don't create NavigationSidebarPanel classes until they are needed by a Tab


> Navigation sidebar creation was changed to use WI.instanceForClass, which
> keeps the sidebar around instead of recreating it each time. Classes
> implementing closed() expect to be destroyed and recreated. When the
> Debugger tab is closed the sidebar panel removes its event listeners. When
> the Debugger tab is reopened, the sidebar returns as a zombie.
Comment 4 Matt Baker 2017-11-14 21:48:09 PST
Another consequence of this regression is that `contentBrowser` isn't passed to any of the navigation sidebar panels during construction.
Comment 5 Matt Baker 2017-11-14 21:57:43 PST
(In reply to Matt Baker from comment #4)
> Another consequence of this regression is that `contentBrowser` isn't passed
> to any of the navigation sidebar panels during construction.

Okay, while it's true it caused the constructor arg to be undefined, ContentBrowserTabContentView.prototype.show included a workaround to set the content browser.
Comment 6 Matt Baker 2017-11-14 22:19:30 PST
Created attachment 326970 [details]
Patch
Comment 7 Devin Rousso 2017-11-15 00:39:45 PST
Comment on attachment 326970 [details]
Patch

r-.  The original intent of this change was twofold:
    1) ensure that each sidebar panel is only created once (really only an issue for DetailsSidebarPanel)
    2) allow lazy instantiation of sidebar panels so that when each tab is created, we don't need to do extra work until the tab is shown

This patch will reintroduce (2), and I don't see this as a positive change.  I think that we should either:
    - refactor the existing NavigationSidebarPanels to use shown/hidden (moving any addEventListener to shown) instead of closed (Debugger, Resources, Search, and Storage)
    - allow multiple instances of the sidebars, but still instantiate them lazily (basically have two member variables, one for the constructors and one for the constructed SidebarPanels)

I think the first option is the more future-forward approach, as I don't think we should ever really be doing work in a UI class that isn't visible (I like what we do with FolderizedTreeElement), but the second option is definitely the "faster" solution.
Comment 8 Matt Baker 2017-11-15 14:19:15 PST
Created attachment 327024 [details]
Patch
Comment 9 Matt Baker 2017-11-15 14:20:18 PST
(In reply to Devin Rousso from comment #7)
> Comment on attachment 326970 [details]
> Patch
> 
> r-.  The original intent of this change was twofold:
>     1) ensure that each sidebar panel is only created once (really only an
> issue for DetailsSidebarPanel)
>     2) allow lazy instantiation of sidebar panels so that when each tab is
> created, we don't need to do extra work until the tab is shown
> 
> This patch will reintroduce (2), and I don't see this as a positive change. 
> I think that we should either:
>     - refactor the existing NavigationSidebarPanels to use shown/hidden
> (moving any addEventListener to shown) instead of closed (Debugger,
> Resources, Search, and Storage)
>     - allow multiple instances of the sidebars, but still instantiate them
> lazily (basically have two member variables, one for the constructors and
> one for the constructed SidebarPanels)

I went with this option.
Comment 10 Devin Rousso 2017-11-15 15:18:58 PST
Comment on attachment 327024 [details]
Patch

r=me
Comment 11 WebKit Commit Bot 2017-11-15 15:39:58 PST
Comment on attachment 327024 [details]
Patch

Clearing flags on attachment: 327024

Committed r224905: <https://trac.webkit.org/changeset/224905>
Comment 12 WebKit Commit Bot 2017-11-15 15:39:59 PST
All reviewed patches have been landed.  Closing bug.