Title: [226380] trunk/Source/WebInspectorUI
Revision
226380
Author
commit-qu...@webkit.org
Date
2018-01-03 16:46:52 -0800 (Wed, 03 Jan 2018)

Log Message

Web Inspector: Find banner sometimes does not work (when already populated and shown for first time on resource)
https://bugs.webkit.org/show_bug.cgi?id=181255
<rdar://problem/36248855>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2018-01-03
Reviewed by Matt Baker.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.set string):
Defer any early searches until the initial content of a TextEditor has been set.
Such searches can happen when the FindBanner already has content when a
ContentView is first opened and needs to load its content from the backend.
Further, even though the content may be loaded from the backend before the
search results, microtask hops might cause the content to get to the TextEditor
after the search results.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (226379 => 226380)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-01-04 00:44:37 UTC (rev 226379)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-01-04 00:46:52 UTC (rev 226380)
@@ -1,5 +1,22 @@
 2018-01-03  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Find banner sometimes does not work (when already populated and shown for first time on resource)
+        https://bugs.webkit.org/show_bug.cgi?id=181255
+        <rdar://problem/36248855>
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/TextEditor.js:
+        (WI.TextEditor.prototype.set string):
+        Defer any early searches until the initial content of a TextEditor has been set.
+        Such searches can happen when the FindBanner already has content when a
+        ContentView is first opened and needs to load its content from the backend.
+        Further, even though the content may be loaded from the backend before the
+        search results, microtask hops might cause the content to get to the TextEditor
+        after the search results.
+
+2018-01-03  Joseph Pecoraro  <pecor...@apple.com>
+
         REGRESSION: Web Inspector: Debugger tab doesn't restore selected resource on reload
         https://bugs.webkit.org/show_bug.cgi?id=181253
         <rdar://problem/36280564>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (226379 => 226380)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-01-04 00:44:37 UTC (rev 226379)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-01-04 00:46:52 UTC (rev 226380)
@@ -129,7 +129,15 @@
             if (this._initialStringNotSet) {
                 this._codeMirror.clearHistory();
                 this._codeMirror.markClean();
+
                 this._initialStringNotSet = false;
+
+                // There may have been an attempt at a search before the initial string was set. If so, reperform it now that we have content.
+                if (this._searchQuery) {
+                    let query = this._searchQuery;
+                    this._searchQuery = null;
+                    this.performSearch(query);
+                }
             }
 
             // Update the execution line now that we might have content for that line.
@@ -294,6 +302,10 @@
 
         this._searchQuery = query;
 
+        // Defer until the initial string is set.
+        if (this._initialStringNotSet)
+            return;
+
         // Allow subclasses to handle the searching if they have a better way.
         // If we are formatted, just use CodeMirror's search.
         if (typeof this.customPerformSearch === "function" && !this.formatted) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to