Find banner sometimes does not work (when already populated and shown for first time on resource) Steps to Reproduce: 1. Inspect webkit.org 2. Show Debugger tab 3. Select "global.js" 4. Show Find Banner (⌘F) 5. Search for "document" => 3 results 6. Reload the page (⌘R) 7. Select global.js again if needed 8. Show Find Banner (⌘F) => Already populated with "document" 9. Hit Enter => No results Notes: - ContentBrowser owns the FindBanner and applies it to whatever ContentView it is showing - When a ContentBrowser opens a TextContentView* for Resource A (1) TextContentView triggers Load Content of Resource A => NetworkAgent.getResponseBody / Debugger.getScriptSource (2) ContentBrowser triggers Perform Search with existing FindBanner value => Page.searchInResource / Debugger.searchInContent While these execute on the backend serially, the result for getting the content body goes through multiple microtask loops. So (1) might be processed in the TextEditor after we attempt to process (2).
<rdar://problem/36248855>
ContentBrowser just does: 1. Open ContentView 2. ContentView.performSearch(query) And here, text based ContentViews does asynchronous work in both of these: 1.1 Load Content from backend 2.1 Search Content on backend --- So really, this can be a problem with automatically performing a search on any content view that loads its content asynchronously. In practice I think that is really only the content views containing a TextEditor, and those proxy the searching to TextEditor. So for now, I'm just going to make TextEditor defer the search until it has loaded its initial content. Ensuring that when it does the search it should be able to show the results. This also might have a minor perf win to avoid performing searches on resources every time you select them, even if the find banner is not visible. --- We also appear to have an issue where ⌘E / ⌘G doesn't work unless the FindBanner is visible, which will be a separate bug.
Created attachment 330411 [details] [PATCH] Proposed Fix
Comment on attachment 330411 [details] [PATCH] Proposed Fix r=me
Comment on attachment 330411 [details] [PATCH] Proposed Fix Clearing flags on attachment: 330411 Committed r226380: <https://trac.webkit.org/changeset/226380>
All reviewed patches have been landed. Closing bug.