Created attachment 365269 [details] [Video] Bug Steps: 1. Navigate to https://stackoverflow.com 2. Press Command-Shift-C and inspect some element 3. In the styles sidebar, click on "primary.css" link of one of the CSS rules. Expected: Resources tab shows "primary.css". Actual: Resources tab shows some other resource (the one selected by default?).
<rdar://problem/49043191>
I added console.trace inside of WI.ContentViewContainer.prototype.showContentView. When clicking on "SpreadsheetCSSStyleDeclarationSection.css" link in the styles sidebar, GeneralStyleDetailsSidebarPanel.css got selected instead. [Log] Trace: showContentView – "SpreadsheetCSSStyleDeclarationSection.css" showContentView (ContentViewContainer.js:90) showRepresentedObject (ContentBrowserTabContentView.js:231) tabChanged (Main.js:1331) showRepresentedObject (Main.js:1338) showSourceCode (Main.js:1380) showSourceCodeLocation (Main.js:1385) showSourceCodeLocation (Main.js:2869) showSourceCodeLocation [Log] Trace: showContentView – "GeneralStyleDetailsSidebarPanel.css" showContentView (ContentViewContainer.js:90) showDefaultContentViewForTreeElement (NavigationSidebarPanel.js:201:83) _checkElementsForPendingViewStateCookie (NavigationSidebarPanel.js:723) _treeElementAddedOrChanged (NavigationSidebarPanel.js:618) dispatch (Object.js:165) dispatchEventToListeners (Object.js:172) insertChild (TreeOutline.js:348) _insertChildTreeElement (FolderizedTreeElement.js:248) _addTreeElement (FolderizedTreeElement.js:218) addChildForRepresentedObject (FolderizedTreeElement.js:105) onpopulate (FrameTreeElement.js:167) expand (TreeElement.js:407) _attach (TreeElement.js:287) insertChild (TreeOutline.js:345) _mainFrameMainResourceDidChange (ResourceSidebarPanel.js:290) initialLayout (ResourceSidebarPanel.js:201) _layoutSubtree (View.js:283) _visitViewTreeForLayout (View.js:386) (showContentView was actually called 8 times (!), but these two items above are relevant to this bug.)
This could've regressed in https://trac.webkit.org/changeset/217750/webkit, because this is where _mainFrameMainResourceDidChange was moved to initialLayout. I'm not certain because simply undoing the patch breaks other things now.
Created attachment 367596 [details] WIP This could be the right solution. I'm looking if it breaks anything.
Created attachment 367600 [details] Patch
Comment on attachment 367600 [details] Patch Clearing flags on attachment: 367600 Committed r244412: <https://trac.webkit.org/changeset/244412>
All reviewed patches have been landed. Closing bug.