Web Inspector: Search Results tab causes jump to Resources tab on reload
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Nov 2015 19:18:31 +0000 (19:18 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Nov 2015 19:18:31 +0000 (19:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150817

Reviewed by Brian Burg.

Remove the "search on reload" behavior from the Search Results tab. It often didn't find everything
on large pages, since it only searched after 500ms of the main resource changing. The bug here
was caused by performSearch selecting the first result, even if it was a background tab. We now
avoid doing unnecessary search work in the background when the Search Results tab isn't visible.

* UserInterface/Views/SearchSidebarPanel.js:
(WebInspector.SearchSidebarPanel): Deleted.
(WebInspector.SearchSidebarPanel.prototype._mainResourceDidChange): Remove children from the
sidebar since performSearch isn't doing it now and ScriptTreeElements were not being removed.
ResourceTreeElements were already being removed by NavigationSidebarPanel's prune behavior.
Removed the call to performSearch and related code.
(WebInspector.SearchSidebarPanel.prototype._mainResourceDidChange.delayedWork): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192110 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js

index 4256080..f14d9ad 100644 (file)
@@ -1,3 +1,23 @@
+2015-11-06  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Search Results tab causes jump to Resources tab on reload
+        https://bugs.webkit.org/show_bug.cgi?id=150817
+
+        Reviewed by Brian Burg.
+
+        Remove the "search on reload" behavior from the Search Results tab. It often didn't find everything
+        on large pages, since it only searched after 500ms of the main resource changing. The bug here
+        was caused by performSearch selecting the first result, even if it was a background tab. We now
+        avoid doing unnecessary search work in the background when the Search Results tab isn't visible.
+
+        * UserInterface/Views/SearchSidebarPanel.js:
+        (WebInspector.SearchSidebarPanel): Deleted.
+        (WebInspector.SearchSidebarPanel.prototype._mainResourceDidChange): Remove children from the
+        sidebar since performSearch isn't doing it now and ScriptTreeElements were not being removed.
+        ResourceTreeElements were already being removed by NavigationSidebarPanel's prune behavior.
+        Removed the call to performSearch and related code.
+        (WebInspector.SearchSidebarPanel.prototype._mainResourceDidChange.delayedWork): Deleted.
+
 2015-11-05  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: Convert remaining ContentViews to View base class
 2015-11-05  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: Convert remaining ContentViews to View base class
index 1a1b168..40faebc 100644 (file)
@@ -47,8 +47,6 @@ WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.
 
         this.filterBar.placeholder = WebInspector.UIString("Filter Search Results");
 
 
         this.filterBar.placeholder = WebInspector.UIString("Filter Search Results");
 
-        this._lastSearchedPageSetting = new WebInspector.Setting("last-searched-page", null);
-
         this._searchQuerySetting = new WebInspector.Setting("search-sidebar-query", "");
         this._inputElement.value = this._searchQuerySetting.value;
 
         this._searchQuerySetting = new WebInspector.Setting("search-sidebar-query", "");
         this._inputElement.value = this._searchQuerySetting.value;
 
@@ -81,7 +79,6 @@ WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.
 
         this._inputElement.value = searchQuery;
         this._searchQuerySetting.value = searchQuery;
 
         this._inputElement.value = searchQuery;
         this._searchQuerySetting.value = searchQuery;
-        this._lastSearchedPageSetting.value = searchQuery && WebInspector.frameResourceManager.mainFrame ? WebInspector.frameResourceManager.mainFrame.url.hash : null;
 
         this.hideEmptyContentPlaceholder();
 
 
         this.hideEmptyContentPlaceholder();
 
@@ -342,26 +339,11 @@ WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.
             this._delayedSearchTimeout = undefined;
         }
 
             this._delayedSearchTimeout = undefined;
         }
 
+        this.contentTreeOutline.removeChildren();
         this.contentBrowser.contentViewContainer.closeAllContentViews();
 
         if (this.visible)
             this.focusSearchField();
         this.contentBrowser.contentViewContainer.closeAllContentViews();
 
         if (this.visible)
             this.focusSearchField();
-
-        // Only if the last page searched is the same as the current page.
-        var mainFrame = event.target;
-        if (this._lastSearchedPageSetting.value !== mainFrame.url.hash)
-            return;
-
-        function delayedWork()
-        {
-            this._delayedSearchTimeout = undefined;
-
-            // Search for whatever is in the input field. This was populated with the last used search term.
-            this.performSearch(this._inputElement.value);
-        }
-
-        // Perform the search on a delay so we have a better chance of finding subresource results.
-        this._delayedSearchTimeout = setTimeout(delayedWork.bind(this), 500);
     }
 
     _treeElementSelected(treeElement, selectedByUser)
     }
 
     _treeElementSelected(treeElement, selectedByUser)