Bug 144212

Summary: Web Inspector: Elements tab details sidebar becomes non-expandable after using Console tab
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Joseph Pecoraro 2015-04-25 20:33:19 PDT
* SUMMARY
Elements tab details sidebar becomes non-expandable after using Console tab

* STEPS TO REPRODUCE
1. Inspect <http://bogojoker.com/shell/>
2. Show Elements Tab with Details sidebar collapsed
3. Show Console Tab
4. Reload
5. Show Elements Tab
  => Details Sidebar cannot be expanded, button is disabled

* NOTES
- Apparently at the end of WebInspector.ContentBrowserTabContentView.prototype._contentBrowserRepresentedObjectsDidChange, WebInspector.detailsSidebar.sidebarPanels.length is 0 even though this.detailsSidebarPanels.length is 3. Somehow the sidebar panels were not added to WebInspector.detailsSidebar correctly.
Comment 1 Radar WebKit Bug Importer 2015-04-25 20:33:29 PDT
<rdar://problem/20700543>
Comment 2 Joseph Pecoraro 2015-04-25 20:40:04 PDT
Apparently in this case, the currentRepresentedObjects is an empty list despite the DOM Tree appearing to have a selected node. Selecting a different node fixes the UI.
Comment 3 Joseph Pecoraro 2015-04-25 20:44:23 PDT
Indeed, in this scenario the Path Components are also empty.
Comment 4 Joseph Pecoraro 2015-04-25 20:55:08 PDT
I don't even see WebInspector.FrameResourceManager.Event.MainFrameDidChange getting dispatched at all. I wonder what is broken as a result?
Comment 5 Joseph Pecoraro 2015-04-25 20:58:45 PDT
(In reply to comment #4)
> I don't even see WebInspector.FrameResourceManager.Event.MainFrameDidChange
> getting dispatched at all. I wonder what is broken as a result?

Hmm, maybe that is fine. Maybe the frame isn't changing just the main resource. Something updates the DOM Tree and its selection, whatever does should be updating the current selected represented objects. Just don't know what updates that yet.
Comment 6 Joseph Pecoraro 2015-04-25 22:24:51 PDT
Well this is very weird.

DOMTreeContentView selected node changes trigger the right things. However, during the last of these events, the DOMTreeOutline.selectedTreeElement is null, which of course leads to what we have.

The DOMTreeContentView updates the selected node multiples times, ending up with:

  - <html> (root node?)
  - null (removing all nodes)
  - <body> (restoring selection)

But in the process of revealAndSelect for <body> it fails to create a tree element for it. It looks like during creation it walks up the DOMNode hierarchy, trying to find a DOMTreeElement parent (which should be the DOMTreeElement for the <html> node) and doesn't find one, so it doesn't create a tree element.

I don't know what is different here.
Comment 7 Timothy Hatcher 2015-04-26 05:51:47 PDT
I'm seeing "Error during DOMAgent operation: No node with given path found".

Looks like we might be asking to push the node path for the last selected path component too soon.

Having ElementsTabContentView close and open a new DOMTreeContentView for each main frame main resource change fixes the sidebar issue, but the last DOM node still ins't restored on reload.
Comment 8 Timothy Hatcher 2015-04-26 05:58:12 PDT
Delaying the call to _restoreSelectedNodeAfterUpdate for 1.5-2 seconds makes it work. But I'm not sure what changed here. There is likely two bugs going on.

1) Even when _restoreSelectedNodeAfterUpdate fails, it should still have a selectedTreeElement. The details sidebars work if you reload with Elements tab showing. And a selected element is visible even when switching from Console.

2) InspectorDOMAgent::pushNodeByPathToFrontend is giving an error when pushing a path. The DOM might not be done being built after the load when we call for the push?
Comment 9 Timothy Hatcher 2015-04-26 11:06:13 PDT
Created attachment 251698 [details]
Patch
Comment 10 Timothy Hatcher 2015-04-26 11:19:40 PDT
Filed the DOMAgent error as bug 144231.
Comment 11 Joseph Pecoraro 2015-04-27 13:43:18 PDT
Comment on attachment 251698 [details]
Patch

NicE! R=ME
Comment 12 Joseph Pecoraro 2015-04-27 13:43:37 PDT
> NicE! R=ME

I apparently triggered caps lock while typing this =P
Comment 13 WebKit Commit Bot 2015-04-27 14:32:11 PDT
Comment on attachment 251698 [details]
Patch

Clearing flags on attachment: 251698

Committed r183423: <http://trac.webkit.org/changeset/183423>
Comment 14 WebKit Commit Bot 2015-04-27 14:32:14 PDT
All reviewed patches have been landed.  Closing bug.