Bug 195978 - Web Inspector: Navigating to resource sometimes shows different resource
Summary: Web Inspector: Navigating to resource sometimes shows different resource
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: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-19 17:26 PDT by Nikita Vasilyev
Modified: 2019-04-17 16:47 PDT (History)
4 users (show)

See Also:


Attachments
[Video] Bug (4.72 MB, video/quicktime)
2019-03-19 17:26 PDT, Nikita Vasilyev
no flags Details
WIP (2.10 KB, patch)
2019-04-16 17:43 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Details | Formatted Diff | Diff
Patch (3.87 KB, patch)
2019-04-16 19:25 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2019-03-19 17:26:53 PDT
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?).
Comment 1 Radar WebKit Bug Importer 2019-03-19 17:27:11 PDT
<rdar://problem/49043191>
Comment 2 Nikita Vasilyev 2019-04-16 16:59:06 PDT
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.)
Comment 3 Nikita Vasilyev 2019-04-16 17:32:03 PDT
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.
Comment 4 Nikita Vasilyev 2019-04-16 17:43:47 PDT
Created attachment 367596 [details]
WIP

This could be the right solution. I'm looking if it breaks anything.
Comment 5 Nikita Vasilyev 2019-04-16 19:25:42 PDT
Created attachment 367600 [details]
Patch
Comment 6 WebKit Commit Bot 2019-04-17 16:47:22 PDT
Comment on attachment 367600 [details]
Patch

Clearing flags on attachment: 367600

Committed r244412: <https://trac.webkit.org/changeset/244412>
Comment 7 WebKit Commit Bot 2019-04-17 16:47:24 PDT
All reviewed patches have been landed.  Closing bug.