<!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
<rdar://problem/24643587>
Patch by Joseph Pecoraro <pecoraro@apple.com> 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 "Other" 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
"other" 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 "other" 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 <pecoraro@apple.com>
+
+ Web Inspector: XHRs and Web Worker scripts are not searchable
+ https://bugs.webkit.org/show_bug.cgi?id=154214
+ <rdar://problem/24643587>
+
+ 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 <jdiggs@igalia.com>
</span><span class="cx">
</span><span class="cx"> AX: "AXLandmarkApplication" is an inappropriate subrole for ARIA "application" 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("message", (event) => {
+ self.postMessage("echo: " + 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: {"lineNumber":0,"lineContent":"// Script resource with the SEARCH-STRING.\n"}
+
+-- Running test case: SearchInXHRResource
+PASS: Should find previously mentioned number of matches.
+MATCH: {"lineNumber":0,"lineContent":"XHR Resource with the SEARCH-STRING.\n"}
+MATCH: {"lineNumber":1,"lineContent":"XHR Resource with the SEARCH-STRING again!\n"}
+
</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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<link rel="stylesheet" href="resources/search-stylesheet.css">
+<script src="resources/search-script.js"></script>
+<script>
+function triggerDownloadingResources() {
+ let worker = new Worker("resources/search-worker.js");
+
+ let xhr = new XMLHttpRequest;
+ xhr.open("GET", "resources/search-xhr.txt", true);
+ xhr.addEventListener("load", done);
+ xhr.send();
+
+ function done() {
+ TestPage.dispatchEventToFrontend('PageIsReady');
+ }
+}
+
+function test()
+{
+ function sanitizeURL(url) {
+ return url.replace(/^.*?LayoutTests\//, "");
+ }
+
+ let suite = InspectorTest.createAsyncSuite("Page.searchInResources and Page.searchInResource");
+
+ let searchResults;
+ const searchString = "SEARCH-STRING";
+
+ suite.addTestCase({
+ name: "SearchAllResources",
+ description: "Able to find text results in different resources.",
+ test: (resolve, reject) => {
+ PageAgent.searchInResources(searchString, (error, results) => {
+ InspectorTest.assert(!error, "Should not be a protocol error.");
+ InspectorTest.expectThat(results.length > 0, "Should find results in multiple resources.");
+ searchResults = results.sort((a, b) => a.url.localeCompare(b.url));
+ for (let result of searchResults)
+ InspectorTest.log(`FOUND: ${sanitizeURL(result.url)} (${result.matchesCount})`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "SearchInScriptResource",
+ description: "Able to find text results in an individual Script resource.",
+ test: (resolve, reject) => {
+ let result = searchResults.find((result) => /search-script\.js$/.test(result.url));
+ if (!result)
+ reject();
+
+ PageAgent.searchInResource(result.frameId, result.url, searchString, (error, matches) => {
+ InspectorTest.assert(!error, "Should not be a protocol error.");
+ InspectorTest.expectThat(matches.length === result.matchesCount, "Should find previously mentioned number of matches.");
+ for (let match of matches)
+ InspectorTest.log(`MATCH: ${JSON.stringify(match)}`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "SearchInXHRResource",
+ description: "Able to find text results in an individual XHR resource.",
+ test: (resolve, reject) => {
+ let result = searchResults.find((result) => /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) => {
+ InspectorTest.assert(!error, "Should not be a protocol error.");
+ InspectorTest.expectThat(matches.length === result.matchesCount, "Should find previously mentioned number of matches.");
+ for (let match of matches)
+ InspectorTest.log(`MATCH: ${JSON.stringify(match)}`);
+ resolve();
+ });
+ }
+ });
+
+ InspectorTest.evaluateInPage("triggerDownloadingResources()");
+ InspectorTest.singleFireEventListener("PageIsReady", (event) => {
+ suite.runTestCasesAndFinish();
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests for the Page.searchInResources and Page.searchInResource commands.</p>
+</body>
+</html>
</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 <pecoraro@apple.com>
+
+ Web Inspector: XHRs and Web Worker scripts are not searchable
+ https://bugs.webkit.org/show_bug.cgi?id=154214
+ <rdar://problem/24643587>
+
+ 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 "Other" resources will use this.
+
</ins><span class="cx"> 2016-04-08 Guillaume Emont <guijemont@igalia.com>
</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"> "properties": [
</span><span class="cx"> { "name": "url", "type": "string", "description": "Resource URL." },
</span><span class="cx"> { "name": "frameId", "$ref": "Network.FrameId", "description": "Resource frame id." },
</span><del>- { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." }
</del><ins>+ { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." },
+ { "name": "requestId", "$ref": "Network.RequestId", "optional": true, "description": "Network request id." }
</ins><span class="cx"> ]
</span><span class="cx"> },
</span><span class="cx"> {
</span><span class="lines">@@ -164,7 +165,8 @@
</span><span class="cx"> { "name": "url", "type": "string", "description": "URL of the resource to search in." },
</span><span class="cx"> { "name": "query", "type": "string", "description": "String to search for." },
</span><span class="cx"> { "name": "caseSensitive", "type": "boolean", "optional": true, "description": "If true, search is case sensitive." },
</span><del>- { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." }
</del><ins>+ { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." },
+ { "name": "requestId", "$ref": "Network.RequestId", "optional": true, "description": "Request id for resource to search in." }
</ins><span class="cx"> ],
</span><span class="cx"> "returns": [
</span><span class="cx"> { "name": "result", "type": "array", "items": { "$ref": "GenericTypes.SearchMatch" }, "description": "List of search matches." }
</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 <pecoraro@apple.com>
+
+ Web Inspector: XHRs and Web Worker scripts are not searchable
+ https://bugs.webkit.org/show_bug.cgi?id=154214
+ <rdar://problem/24643587>
+
+ 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
+ "other" 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 "other" 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 <jdiggs@igalia.com>
</span><span class="cx">
</span><span class="cx"> AX: "AXLandmarkApplication" is an inappropriate subrole for ARIA "application" 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 "ThreadableLoaderClient.h"
</span><span class="cx"> #include "URL.h"
</span><span class="cx"> #include "WebSocketFrame.h"
</span><ins>+#include <inspector/ContentSearchUtilities.h>
</ins><span class="cx"> #include <inspector/IdentifiersFactory.h>
</span><span class="cx"> #include <inspector/InspectorFrontendRouter.h>
</span><span class="cx"> #include <inspector/InspectorValues.h>
</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& 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->setResourceContent(IdentifiersFactory::requestId(identifier), sourceString);
</del><ins>+ m_resourcesData->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->setLoader(loader.release());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static Ref<Inspector::Protocol::Page::SearchResult> buildObjectForSearchResult(const String& requestId, const String& frameId, const String& url, int matchesCount)
+{
+ auto searchResult = Inspector::Protocol::Page::SearchResult::create()
+ .setUrl(url)
+ .setFrameId(frameId)
+ .setMatchesCount(matchesCount)
+ .release();
+ searchResult->setRequestId(requestId);
+ return searchResult;
+}
+
+void InspectorNetworkAgent::searchOtherRequests(const JSC::Yarr::RegularExpression& regex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Page::SearchResult>>& result)
+{
+ Vector<NetworkResourcesData::ResourceData*> resources = m_resourcesData->resources();
+ for (auto* resourceData : resources) {
+ if (resourceData->hasContent()) {
+ int matchesCount = ContentSearchUtilities::countRegularExpressionMatches(regex, resourceData->content());
+ if (matchesCount)
+ result->addItem(buildObjectForSearchResult(resourceData->requestId(), resourceData->frameId(), resourceData->url(), matchesCount));
+ }
+ }
+}
+
+void InspectorNetworkAgent::searchInRequest(ErrorString& errorString, const String& requestId, const String& query, bool caseSensitive, bool isRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
+{
+ NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId);
+ if (!resourceData) {
+ errorString = ASCIILiteral("No resource with given identifier found");
+ return;
+ }
+
+ if (!resourceData->hasContent()) {
+ errorString = ASCIILiteral("No resource content");
+ return;
+ }
+
+ results = ContentSearchUtilities::searchInTextByLines(resourceData->content(), query, caseSensitive, isRegex);
+}
+
</ins><span class="cx"> void InspectorNetworkAgent::mainFrameNavigated(DocumentLoader& 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 <inspector/InspectorFrontendDispatchers.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><ins>+#include <yarr/RegularExpression.h>
</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& sourceString);
</span><span class="cx"> void didScheduleStyleRecalculation(Document&);
</span><span class="cx">
</span><ins>+ void searchOtherRequests(const JSC::Yarr::RegularExpression&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Page::SearchResult>>&);
+ void searchInRequest(ErrorString&, const String& requestId, const String& query, bool caseSensitive, bool isRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>&);
+
</ins><span class="cx"> RefPtr<Inspector::Protocol::Network::Initiator> 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 "ImageBuffer.h"
</span><span class="cx"> #include "InspectorClient.h"
</span><span class="cx"> #include "InspectorDOMAgent.h"
</span><ins>+#include "InspectorNetworkAgent.h"
</ins><span class="cx"> #include "InspectorOverlay.h"
</span><span class="cx"> #include "InspectorTimelineAgent.h"
</span><span class="cx"> #include "InstrumentingAgents.h"
</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<TextResourceDecoder> createXHRTextDecoder(const String& mimeType, const String& 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&, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
</del><ins>+void InspectorPageAgent::searchInResource(ErrorString& errorString, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, const String* optionalRequestId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
</ins><span class="cx"> {
</span><span class="cx"> results = Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>::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->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->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->addItem(buildObjectForSearchResult(frameId(frame), frame->document()->url(), matchesCount));
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ if (InspectorNetworkAgent* networkAgent = m_instrumentingAgents.inspectorNetworkAgent())
+ networkAgent->searchOtherRequests(regex, result);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InspectorPageAgent::setDocumentContent(ErrorString& errorString, const String& frameId, const String& 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&, const String& cookieName, const String& url) override;
</span><span class="cx"> void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) override;
</span><span class="cx"> void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) override;
</span><del>- void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;
</del><ins>+ void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;
</ins><span class="cx"> void searchInResources(ErrorString&, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Page::SearchResult>>&) override;
</span><span class="cx"> void setDocumentContent(ErrorString&, const String& frameId, const String& html) override;
</span><span class="cx"> void setShowPaintRects(ErrorString&, 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<NetworkResourcesData::ResourceData*> NetworkResourcesData::resources()
+{
+ Vector<NetworkResourcesData::ResourceData*> resources;
+ copyValuesToVector(m_requestIdToResourceDataMap, resources);
+ return resources;
+}
+
</ins><span class="cx"> NetworkResourcesData::ResourceData* NetworkResourcesData::resourceDataForRequestId(const String& 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& requestId);
</span><span class="cx"> Vector<String> removeCachedResource(CachedResource*);
</span><span class="cx"> void clear(const String& preservedLoaderId = String());
</span><ins>+ Vector<ResourceData*> resources();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> ResourceData* resourceDataForRequestId(const String& 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 <pecoraro@apple.com>
</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
+ <rdar://problem/24643587>
+
+ 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 <pecoraro@apple.com>
+
</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"> <rdar://problem/25633800>
</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>