Bug 174047

Summary: Web Inspector: Initial search is sometimes performed twice, produces duplicate results
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hi, inspector-bugzilla-changes, jbedard, joepeck, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2017-06-30 15:06:28 PDT
Summary:
Initial search is sometimes performed twice

Steps to Reproduce:
1. Setup: Ensure opening inspector will not have a search tab.
2. Inspect <http://bogojoker.com/shell/>
3. Perform a global search for "reset.css"
  => Search tab is created and there are two results for "reset.css" in the same file
4. Re-perform the search
  => Just 1 result. As expected.

Notes:
- Seems to be related to opening the tab the first time.
Comment 1 Joseph Pecoraro 2017-06-30 15:09:17 PDT
Here are the traces for the initial case:

    [Log] Trace: PageAgent.searchInResources - reset.css
    	performSearch (SearchSidebarPanel.js:284)
    	performSearch (SearchTabContentView.js:88)
    	_searchTextDidChange (Main.js:1272)
    	dispatch (Object.js:170)
    	dispatchEventToListeners (Object.js:177)
    	_handleSearchEvent (SearchBar.js:75)
    	_handleSearchEvent

    [Log] Trace: PageAgent.searchInResources - reset.css
    	performSearch (SearchSidebarPanel.js:284)
    	focusSearchField (SearchSidebarPanel.js:74)
    	focusSearchField (SearchTabContentView.js:81)
    	focusSearchField

And normal case once inside of the sidebar:

    [Log] Trace: PageAgent.searchInResources - reset.css
    	performSearch (SearchSidebarPanel.js:284)
    	_searchFieldChanged (SearchSidebarPanel.js:309)
    	_searchFieldChanged
Comment 2 Joseph Pecoraro 2017-06-30 15:11:57 PDT
>     [Log] Trace: PageAgent.searchInResources - reset.css
>     	performSearch (SearchSidebarPanel.js:284)
>     	focusSearchField (SearchSidebarPanel.js:74)
>     	focusSearchField (SearchTabContentView.js:81)
>     	focusSearchField

SearchTabContentView's initialLayout sets this._forcePerformSearch which should not be necessary if the Global Search opened the tab + triggered a search.
Comment 3 Joseph Pecoraro 2017-06-30 15:17:55 PDT
Created attachment 314300 [details]
[PATCH] Proposed Fix
Comment 4 Devin Rousso 2017-06-30 15:19:23 PDT
Comment on attachment 314300 [details]
[PATCH] Proposed Fix

r=me
Comment 5 WebKit Commit Bot 2017-06-30 15:45:11 PDT
Comment on attachment 314300 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 314300

Committed r219021: <http://trac.webkit.org/changeset/219021>
Comment 6 WebKit Commit Bot 2017-06-30 15:45:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Jonathan Bedard 2017-06-30 15:45:59 PDT
<rdar://problem/33086273>