<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199263] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199263">199263</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-08 19:37:19 -0700 (Fri, 08 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: XHRs and Web Worker scripts are not searchable
https://bugs.webkit.org/show_bug.cgi?id=154214
&lt;rdar://problem/24643587&gt;

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2016-04-08
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/Page.json:
Add optional requestId to search results properties and search
parameters for when the frameId and url are not enough. XHR
resources, and &quot;Other&quot; resources will use this.

Source/WebCore:

Test: inspector/page/searchInResources.html

* inspector/InspectorPageAgent.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::searchInResource):
(WebCore::InspectorPageAgent::searchInResources):
Let the NetworkAgent handle individual search requests
with a requestId. And provide global search results for
&quot;other&quot; resources and will include requestId properties.

* inspector/InspectorNetworkAgent.h:
* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didFinishXHRLoading):
(WebCore::buildObjectForSearchResult):
(WebCore::InspectorNetworkAgent::searchOtherRequests):
(WebCore::InspectorNetworkAgent::searchInRequest):
Search saved &quot;other&quot; resource data content.

* inspector/NetworkResourcesData.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::resources):
Expose the resources for iteration by the NetworkAgent.

Source/WebInspectorUI:

* UserInterface/Views/SearchSidebarPanel.js:
(WebInspector.SearchSidebarPanel.prototype.performSearch.resourceCallback):
(WebInspector.SearchSidebarPanel.prototype.performSearch.resourcesCallback):
Carry forward the requestId property if it is available.

LayoutTests:

* inspector/page/resources/search-script.js: Added.
* inspector/page/resources/search-stylesheet.css: Added.
* inspector/page/resources/search-worker.js: Added.
* inspector/page/resources/search-xhr.txt: Added.
* inspector/page/searchInResources-expected.txt: Added.
* inspector/page/searchInResources.html: Added.
Test for the Page domain's search commands.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolPagejson">trunk/Source/JavaScriptCore/inspector/protocol/Page.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorNetworkAgentcpp">trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorNetworkAgenth">trunk/Source/WebCore/inspector/InspectorNetworkAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgentcpp">trunk/Source/WebCore/inspector/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgenth">trunk/Source/WebCore/inspector/InspectorPageAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorNetworkResourcesDatacpp">trunk/Source/WebCore/inspector/NetworkResourcesData.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorNetworkResourcesDatah">trunk/Source/WebCore/inspector/NetworkResourcesData.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSearchSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorpageresourcessearchscriptjs">trunk/LayoutTests/inspector/page/resources/search-script.js</a></li>
<li><a href="#trunkLayoutTestsinspectorpageresourcessearchstylesheetcss">trunk/LayoutTests/inspector/page/resources/search-stylesheet.css</a></li>
<li><a href="#trunkLayoutTestsinspectorpageresourcessearchworkerjs">trunk/LayoutTests/inspector/page/resources/search-worker.js</a></li>
<li><a href="#trunkLayoutTestsinspectorpageresourcessearchxhrtxt">trunk/LayoutTests/inspector/page/resources/search-xhr.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorpagesearchInResourcesexpectedtxt">trunk/LayoutTests/inspector/page/searchInResources-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorpagesearchInResourceshtml">trunk/LayoutTests/inspector/page/searchInResources.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/LayoutTests/ChangeLog        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-04-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: XHRs and Web Worker scripts are not searchable
+        https://bugs.webkit.org/show_bug.cgi?id=154214
+        &lt;rdar://problem/24643587&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/page/resources/search-script.js: Added.
+        * inspector/page/resources/search-stylesheet.css: Added.
+        * inspector/page/resources/search-worker.js: Added.
+        * inspector/page/resources/search-xhr.txt: Added.
+        * inspector/page/searchInResources-expected.txt: Added.
+        * inspector/page/searchInResources.html: Added.
+        Test for the Page domain's search commands.
+
</ins><span class="cx"> 2016-04-08  Joanmarie Diggs  &lt;jdiggs@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: &quot;AXLandmarkApplication&quot; is an inappropriate subrole for ARIA &quot;application&quot; since it's no longer a landmark
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorpageresourcessearchscriptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/resources/search-script.js (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/resources/search-script.js                                (rev 0)
+++ trunk/LayoutTests/inspector/page/resources/search-script.js        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+// Script resource with the SEARCH-STRING.
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpageresourcessearchstylesheetcss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/resources/search-stylesheet.css (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/resources/search-stylesheet.css                                (rev 0)
+++ trunk/LayoutTests/inspector/page/resources/search-stylesheet.css        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+/* Stylesheet resource with the SEARCH-STRING */
+body {
+    color: black;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpageresourcessearchworkerjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/resources/search-worker.js (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/resources/search-worker.js                                (rev 0)
+++ trunk/LayoutTests/inspector/page/resources/search-worker.js        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+// Worker resource with the SEARCH-STRING.
+
+self.addEventListener(&quot;message&quot;, (event) =&gt; {
+    self.postMessage(&quot;echo: &quot; + event.data);
+});
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpageresourcessearchxhrtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/resources/search-xhr.txt (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/resources/search-xhr.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/page/resources/search-xhr.txt        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+XHR Resource with the SEARCH-STRING.
+XHR Resource with the SEARCH-STRING again!
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpagesearchInResourcesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/searchInResources-expected.txt (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/searchInResources-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/page/searchInResources-expected.txt        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Tests for the Page.searchInResources and Page.searchInResource commands.
+
+
+== Running test suite: Page.searchInResources and Page.searchInResource
+-- Running test case: SearchAllResources
+PASS: Should find results in multiple resources.
+FOUND: inspector/page/resources/search-script.js (1)
+FOUND: inspector/page/resources/search-stylesheet.css (1)
+FOUND: inspector/page/resources/search-worker.js (1)
+FOUND: inspector/page/resources/search-xhr.txt (2)
+FOUND: inspector/page/searchInResources.html (1)
+
+-- Running test case: SearchInScriptResource
+PASS: Should find previously mentioned number of matches.
+MATCH: {&quot;lineNumber&quot;:0,&quot;lineContent&quot;:&quot;// Script resource with the SEARCH-STRING.\n&quot;}
+
+-- Running test case: SearchInXHRResource
+PASS: Should find previously mentioned number of matches.
+MATCH: {&quot;lineNumber&quot;:0,&quot;lineContent&quot;:&quot;XHR Resource with the SEARCH-STRING.\n&quot;}
+MATCH: {&quot;lineNumber&quot;:1,&quot;lineContent&quot;:&quot;XHR Resource with the SEARCH-STRING again!\n&quot;}
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpagesearchInResourceshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/searchInResources.html (0 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/searchInResources.html                                (rev 0)
+++ trunk/LayoutTests/inspector/page/searchInResources.html        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;resources/search-stylesheet.css&quot;&gt;
+&lt;script src=&quot;resources/search-script.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function triggerDownloadingResources() {
+    let worker = new Worker(&quot;resources/search-worker.js&quot;);
+
+    let xhr = new XMLHttpRequest;
+    xhr.open(&quot;GET&quot;, &quot;resources/search-xhr.txt&quot;, true);
+    xhr.addEventListener(&quot;load&quot;, done);
+    xhr.send();
+
+    function done() {
+        TestPage.dispatchEventToFrontend('PageIsReady');
+    }
+}
+
+function test()
+{
+    function sanitizeURL(url) {
+        return url.replace(/^.*?LayoutTests\//, &quot;&quot;);
+    }
+
+    let suite = InspectorTest.createAsyncSuite(&quot;Page.searchInResources and Page.searchInResource&quot;);
+
+    let searchResults;
+    const searchString = &quot;SEARCH-STRING&quot;;
+
+    suite.addTestCase({
+        name: &quot;SearchAllResources&quot;,
+        description: &quot;Able to find text results in different resources.&quot;,
+        test: (resolve, reject) =&gt; {
+            PageAgent.searchInResources(searchString, (error, results) =&gt; {
+                InspectorTest.assert(!error, &quot;Should not be a protocol error.&quot;);
+                InspectorTest.expectThat(results.length &gt; 0, &quot;Should find results in multiple resources.&quot;);
+                searchResults = results.sort((a, b) =&gt; a.url.localeCompare(b.url));
+                for (let result of searchResults)
+                    InspectorTest.log(`FOUND: ${sanitizeURL(result.url)} (${result.matchesCount})`);
+                resolve();
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;SearchInScriptResource&quot;,
+        description: &quot;Able to find text results in an individual Script resource.&quot;,
+        test: (resolve, reject) =&gt; {
+            let result = searchResults.find((result) =&gt; /search-script\.js$/.test(result.url));
+            if (!result)
+                reject();
+
+            PageAgent.searchInResource(result.frameId, result.url, searchString, (error, matches) =&gt; {
+                InspectorTest.assert(!error, &quot;Should not be a protocol error.&quot;);
+                InspectorTest.expectThat(matches.length === result.matchesCount, &quot;Should find previously mentioned number of matches.&quot;);
+                for (let match of matches)
+                    InspectorTest.log(`MATCH: ${JSON.stringify(match)}`);
+                resolve();
+            });
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;SearchInXHRResource&quot;,
+        description: &quot;Able to find text results in an individual XHR resource.&quot;,
+        test: (resolve, reject) =&gt; {
+            let result = searchResults.find((result) =&gt; /search-xhr\.txt$/.test(result.url));
+            if (!result)
+                reject();
+
+            const isRegex = undefined;
+            const caseSensitive = undefined;
+
+            PageAgent.searchInResource(result.frameId, result.url, searchString, caseSensitive, isRegex, result.requestId, (error, matches) =&gt; {
+                InspectorTest.assert(!error, &quot;Should not be a protocol error.&quot;);
+                InspectorTest.expectThat(matches.length === result.matchesCount, &quot;Should find previously mentioned number of matches.&quot;);
+                for (let match of matches)
+                    InspectorTest.log(`MATCH: ${JSON.stringify(match)}`);
+                resolve();
+            });
+        }
+    });
+
+    InspectorTest.evaluateInPage(&quot;triggerDownloadingResources()&quot;);
+    InspectorTest.singleFireEventListener(&quot;PageIsReady&quot;, (event) =&gt; {
+        suite.runTestCasesAndFinish();
+    });
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Tests for the Page.searchInResources and Page.searchInResource commands.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-04-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: XHRs and Web Worker scripts are not searchable
+        https://bugs.webkit.org/show_bug.cgi?id=154214
+        &lt;rdar://problem/24643587&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/Page.json:
+        Add optional requestId to search results properties and search
+        parameters for when the frameId and url are not enough. XHR
+        resources, and &quot;Other&quot; resources will use this.
+
</ins><span class="cx"> 2016-04-08  Guillaume Emont  &lt;guijemont@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         MIPS: support Signed cond in branchTest32()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolPagejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Page.json (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Page.json        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Page.json        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -58,7 +58,8 @@
</span><span class="cx">             &quot;properties&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;url&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Resource URL.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;frameId&quot;, &quot;$ref&quot;: &quot;Network.FrameId&quot;, &quot;description&quot;: &quot;Resource frame id.&quot; },
</span><del>-                { &quot;name&quot;: &quot;matchesCount&quot;, &quot;type&quot;: &quot;number&quot;, &quot;description&quot;: &quot;Number of matches in the resource content.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;matchesCount&quot;, &quot;type&quot;: &quot;number&quot;, &quot;description&quot;: &quot;Number of matches in the resource content.&quot; },
+                { &quot;name&quot;: &quot;requestId&quot;, &quot;$ref&quot;: &quot;Network.RequestId&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Network request id.&quot; }
</ins><span class="cx">             ]
</span><span class="cx">         },
</span><span class="cx">         {
</span><span class="lines">@@ -164,7 +165,8 @@
</span><span class="cx">                 { &quot;name&quot;: &quot;url&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;URL of the resource to search in.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;query&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;String to search for.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;caseSensitive&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;If true, search is case sensitive.&quot; },
</span><del>-                { &quot;name&quot;: &quot;isRegex&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;If true, treats string parameter as regex.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;isRegex&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;If true, treats string parameter as regex.&quot; },
+                { &quot;name&quot;: &quot;requestId&quot;, &quot;$ref&quot;: &quot;Network.RequestId&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Request id for resource to search in.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;result&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;$ref&quot;: &quot;GenericTypes.SearchMatch&quot; }, &quot;description&quot;: &quot;List of search matches.&quot; }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/ChangeLog        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-04-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: XHRs and Web Worker scripts are not searchable
+        https://bugs.webkit.org/show_bug.cgi?id=154214
+        &lt;rdar://problem/24643587&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector/page/searchInResources.html
+
+        * inspector/InspectorPageAgent.h:
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::searchInResource):
+        (WebCore::InspectorPageAgent::searchInResources):
+        Let the NetworkAgent handle individual search requests
+        with a requestId. And provide global search results for
+        &quot;other&quot; resources and will include requestId properties.
+
+        * inspector/InspectorNetworkAgent.h:
+        * inspector/InspectorNetworkAgent.cpp:
+        (WebCore::InspectorNetworkAgent::didFinishXHRLoading):
+        (WebCore::buildObjectForSearchResult):
+        (WebCore::InspectorNetworkAgent::searchOtherRequests):
+        (WebCore::InspectorNetworkAgent::searchInRequest):
+        Search saved &quot;other&quot; resource data content.
+
+        * inspector/NetworkResourcesData.h:
+        * inspector/NetworkResourcesData.cpp:
+        (WebCore::NetworkResourcesData::resources):
+        Expose the resources for iteration by the NetworkAgent.
+
</ins><span class="cx"> 2016-04-08  Joanmarie Diggs  &lt;jdiggs@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: &quot;AXLandmarkApplication&quot; is an inappropriate subrole for ARIA &quot;application&quot; since it's no longer a landmark
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorNetworkAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> #include &quot;ThreadableLoaderClient.h&quot;
</span><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &quot;WebSocketFrame.h&quot;
</span><ins>+#include &lt;inspector/ContentSearchUtilities.h&gt;
</ins><span class="cx"> #include &lt;inspector/IdentifiersFactory.h&gt;
</span><span class="cx"> #include &lt;inspector/InspectorFrontendRouter.h&gt;
</span><span class="cx"> #include &lt;inspector/InspectorValues.h&gt;
</span><span class="lines">@@ -452,10 +453,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorNetworkAgent::didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String&amp; sourceString)
</span><span class="cx"> {
</span><del>-    // For Asynchronous XHRs, the inspector can grab the data directly off of the CachedResource. For sync XHRs, we need to
-    // provide the data here, since no CachedResource was involved.
-    if (m_loadingXHRSynchronously)
-        m_resourcesData-&gt;setResourceContent(IdentifiersFactory::requestId(identifier), sourceString);
</del><ins>+    m_resourcesData-&gt;setResourceContent(IdentifiersFactory::requestId(identifier), sourceString);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorNetworkAgent::didReceiveXHRResponse(unsigned long identifier)
</span><span class="lines">@@ -697,6 +695,45 @@
</span><span class="cx">     inspectorThreadableLoaderClient-&gt;setLoader(loader.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static Ref&lt;Inspector::Protocol::Page::SearchResult&gt; buildObjectForSearchResult(const String&amp; requestId, const String&amp; frameId, const String&amp; url, int matchesCount)
+{
+    auto searchResult = Inspector::Protocol::Page::SearchResult::create()
+        .setUrl(url)
+        .setFrameId(frameId)
+        .setMatchesCount(matchesCount)
+        .release();
+    searchResult-&gt;setRequestId(requestId);
+    return searchResult;
+}
+
+void InspectorNetworkAgent::searchOtherRequests(const JSC::Yarr::RegularExpression&amp; regex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::Page::SearchResult&gt;&gt;&amp; result)
+{
+    Vector&lt;NetworkResourcesData::ResourceData*&gt; resources = m_resourcesData-&gt;resources();
+    for (auto* resourceData : resources) {
+        if (resourceData-&gt;hasContent()) {
+            int matchesCount = ContentSearchUtilities::countRegularExpressionMatches(regex, resourceData-&gt;content());
+            if (matchesCount)
+                result-&gt;addItem(buildObjectForSearchResult(resourceData-&gt;requestId(), resourceData-&gt;frameId(), resourceData-&gt;url(), matchesCount));
+        }
+    }
+}
+
+void InspectorNetworkAgent::searchInRequest(ErrorString&amp; errorString, const String&amp; requestId, const String&amp; query, bool caseSensitive, bool isRegex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp; results)
+{
+    NetworkResourcesData::ResourceData const* resourceData = m_resourcesData-&gt;data(requestId);
+    if (!resourceData) {
+        errorString = ASCIILiteral(&quot;No resource with given identifier found&quot;);
+        return;
+    }
+
+    if (!resourceData-&gt;hasContent()) {
+        errorString = ASCIILiteral(&quot;No resource content&quot;);
+        return;
+    }
+
+    results = ContentSearchUtilities::searchInTextByLines(resourceData-&gt;content(), query, caseSensitive, isRegex);
+}
+
</ins><span class="cx"> void InspectorNetworkAgent::mainFrameNavigated(DocumentLoader&amp; loader)
</span><span class="cx"> {
</span><span class="cx">     if (m_cacheDisabled)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorNetworkAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.h (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.h        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.h        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &lt;inspector/InspectorFrontendDispatchers.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><ins>+#include &lt;yarr/RegularExpression.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> class InspectorObject;
</span><span class="lines">@@ -100,6 +101,9 @@
</span><span class="cx">     void setInitialScriptContent(unsigned long identifier, const String&amp; sourceString);
</span><span class="cx">     void didScheduleStyleRecalculation(Document&amp;);
</span><span class="cx"> 
</span><ins>+    void searchOtherRequests(const JSC::Yarr::RegularExpression&amp;, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::Page::SearchResult&gt;&gt;&amp;);
+    void searchInRequest(ErrorString&amp;, const String&amp; requestId, const String&amp; query, bool caseSensitive, bool isRegex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp;);
+
</ins><span class="cx">     RefPtr&lt;Inspector::Protocol::Network::Initiator&gt; buildInitiatorObject(Document*);
</span><span class="cx"> 
</span><span class="cx">     // Called from frontend.
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include &quot;ImageBuffer.h&quot;
</span><span class="cx"> #include &quot;InspectorClient.h&quot;
</span><span class="cx"> #include &quot;InspectorDOMAgent.h&quot;
</span><ins>+#include &quot;InspectorNetworkAgent.h&quot;
</ins><span class="cx"> #include &quot;InspectorOverlay.h&quot;
</span><span class="cx"> #include &quot;InspectorTimelineAgent.h&quot;
</span><span class="cx"> #include &quot;InstrumentingAgents.h&quot;
</span><span class="lines">@@ -115,7 +116,10 @@
</span><span class="cx"> static bool hasTextContent(CachedResource* cachedResource)
</span><span class="cx"> {
</span><span class="cx">     InspectorPageAgent::ResourceType type = InspectorPageAgent::cachedResourceType(*cachedResource);
</span><del>-    return type == InspectorPageAgent::DocumentResource || type == InspectorPageAgent::StylesheetResource || type == InspectorPageAgent::ScriptResource || type == InspectorPageAgent::XHRResource;
</del><ins>+    return type == InspectorPageAgent::DocumentResource
+        || type == InspectorPageAgent::StylesheetResource
+        || type == InspectorPageAgent::ScriptResource
+        || type == InspectorPageAgent::XHRResource;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static RefPtr&lt;TextResourceDecoder&gt; createXHRTextDecoder(const String&amp; mimeType, const String&amp; textEncodingName)
</span><span class="lines">@@ -566,18 +570,25 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorPageAgent::searchInResource(ErrorString&amp;, const String&amp; frameId, const String&amp; url, const String&amp; query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp; results)
</del><ins>+void InspectorPageAgent::searchInResource(ErrorString&amp; errorString, const String&amp; frameId, const String&amp; url, const String&amp; query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, const String* optionalRequestId, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp; results)
</ins><span class="cx"> {
</span><span class="cx">     results = Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;::create();
</span><span class="cx"> 
</span><span class="cx">     bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
</span><span class="cx">     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
</span><span class="cx"> 
</span><del>-    Frame* frame = frameForId(frameId);
</del><ins>+    if (optionalRequestId) {
+        if (InspectorNetworkAgent* networkAgent = m_instrumentingAgents.inspectorNetworkAgent()) {
+            networkAgent-&gt;searchInRequest(errorString, *optionalRequestId, query, caseSensitive, isRegex, results);
+            return;
+        }
+    }
+
+    Frame* frame = assertFrame(errorString, frameId);
</ins><span class="cx">     if (!frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    DocumentLoader* loader = frame-&gt;loader().documentLoader();
</del><ins>+    DocumentLoader* loader = assertDocumentLoader(errorString, frame);
</ins><span class="cx">     if (!loader)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -634,6 +645,9 @@
</span><span class="cx">                 result-&gt;addItem(buildObjectForSearchResult(frameId(frame), frame-&gt;document()-&gt;url(), matchesCount));
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
+    if (InspectorNetworkAgent* networkAgent = m_instrumentingAgents.inspectorNetworkAgent())
+        networkAgent-&gt;searchOtherRequests(regex, result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::setDocumentContent(ErrorString&amp; errorString, const String&amp; frameId, const String&amp; html)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.h        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">     void deleteCookie(ErrorString&amp;, const String&amp; cookieName, const String&amp; url) override;
</span><span class="cx">     void getResourceTree(ErrorString&amp;, RefPtr&lt;Inspector::Protocol::Page::FrameResourceTree&gt;&amp;) override;
</span><span class="cx">     void getResourceContent(ErrorString&amp;, const String&amp; frameId, const String&amp; url, String* content, bool* base64Encoded) override;
</span><del>-    void searchInResource(ErrorString&amp;, const String&amp; frameId, const String&amp; url, const String&amp; query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp;) override;
</del><ins>+    void searchInResource(ErrorString&amp;, const String&amp; frameId, const String&amp; url, const String&amp; query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::GenericTypes::SearchMatch&gt;&gt;&amp;) override;
</ins><span class="cx">     void searchInResources(ErrorString&amp;, const String&amp;, const bool* caseSensitive, const bool* isRegex, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::Page::SearchResult&gt;&gt;&amp;) override;
</span><span class="cx">     void setDocumentContent(ErrorString&amp;, const String&amp; frameId, const String&amp; html) override;
</span><span class="cx">     void setShowPaintRects(ErrorString&amp;, bool show) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorNetworkResourcesDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.cpp (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/NetworkResourcesData.cpp        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.cpp        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -283,6 +283,13 @@
</span><span class="cx">     m_requestIdToResourceDataMap.swap(preservedMap);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Vector&lt;NetworkResourcesData::ResourceData*&gt; NetworkResourcesData::resources()
+{
+    Vector&lt;NetworkResourcesData::ResourceData*&gt; resources;
+    copyValuesToVector(m_requestIdToResourceDataMap, resources);
+    return resources;
+}
+
</ins><span class="cx"> NetworkResourcesData::ResourceData* NetworkResourcesData::resourceDataForRequestId(const String&amp; requestId)
</span><span class="cx"> {
</span><span class="cx">     if (requestId.isNull())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorNetworkResourcesDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.h (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/NetworkResourcesData.h        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.h        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx">     ResourceData const* data(const String&amp; requestId);
</span><span class="cx">     Vector&lt;String&gt; removeCachedResource(CachedResource*);
</span><span class="cx">     void clear(const String&amp; preservedLoaderId = String());
</span><ins>+    Vector&lt;ResourceData*&gt; resources();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ResourceData* resourceDataForRequestId(const String&amp; requestId);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2016-04-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: XHRs and Web Worker scripts are not searchable
+        https://bugs.webkit.org/show_bug.cgi?id=154214
+        &lt;rdar://problem/24643587&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/SearchSidebarPanel.js:
+        (WebInspector.SearchSidebarPanel.prototype.performSearch.resourceCallback):
+        (WebInspector.SearchSidebarPanel.prototype.performSearch.resourcesCallback):
+        Carry forward the requestId property if it is available.
+
+2016-04-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Allocation snapshot hover persists after switching tabs
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=156430
</span><span class="cx">         &lt;rdar://problem/25633800&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSearchSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js (199262 => 199263)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js        2016-04-09 02:32:16 UTC (rev 199262)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js        2016-04-09 02:37:19 UTC (rev 199263)
</span><span class="lines">@@ -124,14 +124,14 @@
</span><span class="cx">             if (error)
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            function resourceCallback(url, error, resourceMatches)
</del><ins>+            function resourceCallback(frameId, url, error, resourceMatches)
</ins><span class="cx">             {
</span><span class="cx">                 updateEmptyContentPlaceholderSoon.call(this);
</span><span class="cx"> 
</span><span class="cx">                 if (error || !resourceMatches || !resourceMatches.length)
</span><span class="cx">                     return;
</span><span class="cx"> 
</span><del>-                var frame = WebInspector.frameResourceManager.frameForIdentifier(searchResult.frameId);
</del><ins>+                var frame = WebInspector.frameResourceManager.frameForIdentifier(frameId);
</ins><span class="cx">                 if (!frame)
</span><span class="cx">                     return;
</span><span class="cx"> 
</span><span class="lines">@@ -160,7 +160,8 @@
</span><span class="cx">                 if (!searchResult.url || !searchResult.frameId)
</span><span class="cx">                     continue;
</span><span class="cx"> 
</span><del>-                PageAgent.searchInResource(searchResult.frameId, searchResult.url, searchQuery, isCaseSensitive, isRegex, resourceCallback.bind(this, searchResult.url));
</del><ins>+                // COMPATIBILITY (iOS 9): Page.searchInResources did not have the optional requestId parameter.
+                PageAgent.searchInResource(searchResult.frameId, searchResult.url, searchQuery, isCaseSensitive, isRegex, searchResult.requestId, resourceCallback.bind(this, searchResult.frameId, searchResult.url));
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>