RESOLVED FIXED 154214
Web Inspector: XHRs and Web Worker scripts are not searchable
https://bugs.webkit.org/show_bug.cgi?id=154214
Summary Web Inspector: XHRs and Web Worker scripts are not searchable
Joseph Pecoraro
Reported 2016-02-13 04:46:31 PST
* SUMMARY XHRs and Web Worker scripts are not searchable. The resources show up in the sidebar, but they are not searchable.
Attachments
[PATCH] Work In Progress (14.97 KB, patch)
2016-02-13 04:53 PST, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (24.98 KB, patch)
2016-04-08 16:56 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2016-02-13 04:46:45 PST
Joseph Pecoraro
Comment 2 2016-02-13 04:53:09 PST
Created attachment 271282 [details] [PATCH] Work In Progress I'm a bit skeptical of this patch at the moment, but I'm putting it up for feedback. It seems Page.searchInResources only walks the CachedResources that are still around for frames/documents. Unfortunately XHR resources, and other "Raw Resources" (Worker script) are not included in this list. The NetworkAgent is told about these Raw CachedResources before they are destroyed, and was saving their data in the NetworkResourcesData class off of the NetworkAgent. So we could ask the NetworkAgent to search its "Other Resources", which I just called "searchRequests" here... But this seems to capture all the resources NOT searched by PageAgent. This lets us search in a near identical way to searching Page resources. Page.searchInResources => Page.searchInResource(frameId, url) => frameId, url, match info => UI Network.searchInRequests => Network.searchRequest(requestId) (frameId is known) => frameId, url, match info => UI I'm guessing NetworkResourcesData was actually used for a different purpose (XHR Replay?) but we can take advantage of it here for searching XHRs. The one caveat is, like all things NetworkAgent related, the inspector has to be open to capture the content of XHRs. You can't search XHRs that happened before the inspector was opened. I think that is fine / to be expected. The same way scripts get garbage collected, resources do as well.
Timothy Hatcher
Comment 3 2016-02-13 05:26:25 PST
Comment on attachment 271282 [details] [PATCH] Work In Progress Looks good.
Joseph Pecoraro
Comment 4 2016-02-13 17:36:03 PST
Thought about this a bit. Really, Page.searchInResources should just be doing this. On the backend, PageAgent can can shimmy on over to the NetworkAgent for the data it needs, but it doesn't seem useful to add Network agent protocol methods for this.
Timothy Hatcher
Comment 5 2016-02-15 12:07:52 PST
Joseph Pecoraro
Comment 6 2016-04-08 16:56:27 PDT
Created attachment 276056 [details] [PATCH] Proposed Fix
WebKit Commit Bot
Comment 7 2016-04-08 19:37:18 PDT
Comment on attachment 276056 [details] [PATCH] Proposed Fix Clearing flags on attachment: 276056 Committed r199263: <http://trac.webkit.org/changeset/199263>
WebKit Commit Bot
Comment 8 2016-04-08 19:37:21 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.