Web Inspector: XHRs and Web Worker scripts are not searchable
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Apr 2016 02:37:19 +0000 (02:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Apr 2016 02:37:19 +0000 (02:37 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199263 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/page/resources/search-script.js [new file with mode: 0644]
LayoutTests/inspector/page/resources/search-stylesheet.css [new file with mode: 0644]
LayoutTests/inspector/page/resources/search-worker.js [new file with mode: 0644]
LayoutTests/inspector/page/resources/search-xhr.txt [new file with mode: 0644]
LayoutTests/inspector/page/searchInResources-expected.txt [new file with mode: 0644]
LayoutTests/inspector/page/searchInResources.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Page.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorNetworkAgent.cpp
Source/WebCore/inspector/InspectorNetworkAgent.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/NetworkResourcesData.cpp
Source/WebCore/inspector/NetworkResourcesData.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js

index 1dfc81e..22680ea 100644 (file)
@@ -1,3 +1,19 @@
+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.
+
 2016-04-08  Joanmarie Diggs  <jdiggs@igalia.com>
 
         AX: "AXLandmarkApplication" is an inappropriate subrole for ARIA "application" since it's no longer a landmark
diff --git a/LayoutTests/inspector/page/resources/search-script.js b/LayoutTests/inspector/page/resources/search-script.js
new file mode 100644 (file)
index 0000000..bf72621
--- /dev/null
@@ -0,0 +1 @@
+// Script resource with the SEARCH-STRING.
diff --git a/LayoutTests/inspector/page/resources/search-stylesheet.css b/LayoutTests/inspector/page/resources/search-stylesheet.css
new file mode 100644 (file)
index 0000000..06ead77
--- /dev/null
@@ -0,0 +1,4 @@
+/* Stylesheet resource with the SEARCH-STRING */
+body {
+    color: black;
+}
diff --git a/LayoutTests/inspector/page/resources/search-worker.js b/LayoutTests/inspector/page/resources/search-worker.js
new file mode 100644 (file)
index 0000000..0f6a666
--- /dev/null
@@ -0,0 +1,5 @@
+// Worker resource with the SEARCH-STRING.
+
+self.addEventListener("message", (event) => {
+    self.postMessage("echo: " + event.data);
+});
diff --git a/LayoutTests/inspector/page/resources/search-xhr.txt b/LayoutTests/inspector/page/resources/search-xhr.txt
new file mode 100644 (file)
index 0000000..941d23f
--- /dev/null
@@ -0,0 +1,2 @@
+XHR Resource with the SEARCH-STRING.
+XHR Resource with the SEARCH-STRING again!
diff --git a/LayoutTests/inspector/page/searchInResources-expected.txt b/LayoutTests/inspector/page/searchInResources-expected.txt
new file mode 100644 (file)
index 0000000..5c5c9d4
--- /dev/null
@@ -0,0 +1,21 @@
+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"}
+
diff --git a/LayoutTests/inspector/page/searchInResources.html b/LayoutTests/inspector/page/searchInResources.html
new file mode 100644 (file)
index 0000000..67314b5
--- /dev/null
@@ -0,0 +1,96 @@
+<!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>
index bc04622..2f27f32 100644 (file)
@@ -1,3 +1,16 @@
+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.
+
 2016-04-08  Guillaume Emont  <guijemont@igalia.com>
 
         MIPS: support Signed cond in branchTest32()
index c210a89..4ba5476 100644 (file)
@@ -58,7 +58,8 @@
             "properties": [
                 { "name": "url", "type": "string", "description": "Resource URL." },
                 { "name": "frameId", "$ref": "Network.FrameId", "description": "Resource frame id." },
-                { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." }
+                { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." },
+                { "name": "requestId", "$ref": "Network.RequestId", "optional": true, "description": "Network request id." }
             ]
         },
         {
                 { "name": "url", "type": "string", "description": "URL of the resource to search in." },
                 { "name": "query", "type": "string", "description": "String to search for." },
                 { "name": "caseSensitive", "type": "boolean", "optional": true, "description": "If true, search is case sensitive." },
-                { "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." }
+                { "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." }
             ],
             "returns": [
                 { "name": "result", "type": "array", "items": { "$ref": "GenericTypes.SearchMatch" }, "description": "List of search matches." }
index c2413ee..8169613 100644 (file)
@@ -1,3 +1,34 @@
+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.
+
 2016-04-08  Joanmarie Diggs  <jdiggs@igalia.com>
 
         AX: "AXLandmarkApplication" is an inappropriate subrole for ARIA "application" since it's no longer a landmark
index 83ff20f..43154b3 100644 (file)
@@ -60,6 +60,7 @@
 #include "ThreadableLoaderClient.h"
 #include "URL.h"
 #include "WebSocketFrame.h"
+#include <inspector/ContentSearchUtilities.h>
 #include <inspector/IdentifiersFactory.h>
 #include <inspector/InspectorFrontendRouter.h>
 #include <inspector/InspectorValues.h>
@@ -452,10 +453,7 @@ void InspectorNetworkAgent::didReceiveScriptResponse(unsigned long identifier)
 
 void InspectorNetworkAgent::didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String& sourceString)
 {
-    // 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);
+    m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identifier), sourceString);
 }
 
 void InspectorNetworkAgent::didReceiveXHRResponse(unsigned long identifier)
@@ -697,6 +695,45 @@ void InspectorNetworkAgent::loadResource(ErrorString& errorString, const String&
     inspectorThreadableLoaderClient->setLoader(loader.release());
 }
 
+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);
+}
+
 void InspectorNetworkAgent::mainFrameNavigated(DocumentLoader& loader)
 {
     if (m_cacheDisabled)
index eb30796..5173157 100644 (file)
@@ -37,6 +37,7 @@
 #include <inspector/InspectorFrontendDispatchers.h>
 #include <wtf/HashSet.h>
 #include <wtf/text/WTFString.h>
+#include <yarr/RegularExpression.h>
 
 namespace Inspector {
 class InspectorObject;
@@ -100,6 +101,9 @@ public:
     void setInitialScriptContent(unsigned long identifier, const String& sourceString);
     void didScheduleStyleRecalculation(Document&);
 
+    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>>&);
+
     RefPtr<Inspector::Protocol::Network::Initiator> buildInitiatorObject(Document*);
 
     // Called from frontend.
index 6379efa..eff6468 100644 (file)
@@ -55,6 +55,7 @@
 #include "ImageBuffer.h"
 #include "InspectorClient.h"
 #include "InspectorDOMAgent.h"
+#include "InspectorNetworkAgent.h"
 #include "InspectorOverlay.h"
 #include "InspectorTimelineAgent.h"
 #include "InstrumentingAgents.h"
@@ -115,7 +116,10 @@ static bool prepareCachedResourceBuffer(CachedResource* cachedResource, bool* ha
 static bool hasTextContent(CachedResource* cachedResource)
 {
     InspectorPageAgent::ResourceType type = InspectorPageAgent::cachedResourceType(*cachedResource);
-    return type == InspectorPageAgent::DocumentResource || type == InspectorPageAgent::StylesheetResource || type == InspectorPageAgent::ScriptResource || type == InspectorPageAgent::XHRResource;
+    return type == InspectorPageAgent::DocumentResource
+        || type == InspectorPageAgent::StylesheetResource
+        || type == InspectorPageAgent::ScriptResource
+        || type == InspectorPageAgent::XHRResource;
 }
 
 static RefPtr<TextResourceDecoder> createXHRTextDecoder(const String& mimeType, const String& textEncodingName)
@@ -566,18 +570,25 @@ static bool textContentForCachedResource(CachedResource* cachedResource, String*
     return false;
 }
 
-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)
+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)
 {
     results = Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>::create();
 
     bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
 
-    Frame* frame = frameForId(frameId);
+    if (optionalRequestId) {
+        if (InspectorNetworkAgent* networkAgent = m_instrumentingAgents.inspectorNetworkAgent()) {
+            networkAgent->searchInRequest(errorString, *optionalRequestId, query, caseSensitive, isRegex, results);
+            return;
+        }
+    }
+
+    Frame* frame = assertFrame(errorString, frameId);
     if (!frame)
         return;
 
-    DocumentLoader* loader = frame->loader().documentLoader();
+    DocumentLoader* loader = assertDocumentLoader(errorString, frame);
     if (!loader)
         return;
 
@@ -634,6 +645,9 @@ void InspectorPageAgent::searchInResources(ErrorString&, const String& text, con
                 result->addItem(buildObjectForSearchResult(frameId(frame), frame->document()->url(), matchesCount));
         }
     }
+
+    if (InspectorNetworkAgent* networkAgent = m_instrumentingAgents.inspectorNetworkAgent())
+        networkAgent->searchOtherRequests(regex, result);
 }
 
 void InspectorPageAgent::setDocumentContent(ErrorString& errorString, const String& frameId, const String& html)
index 76f8358..aa26ae5 100644 (file)
@@ -102,7 +102,7 @@ public:
     void deleteCookie(ErrorString&, const String& cookieName, const String& url) override;
     void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) override;
     void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) override;
-    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;
+    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;
     void searchInResources(ErrorString&, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Page::SearchResult>>&) override;
     void setDocumentContent(ErrorString&, const String& frameId, const String& html) override;
     void setShowPaintRects(ErrorString&, bool show) override;
index 39d3535..5c893a8 100644 (file)
@@ -283,6 +283,13 @@ void NetworkResourcesData::clear(const String& preservedLoaderId)
     m_requestIdToResourceDataMap.swap(preservedMap);
 }
 
+Vector<NetworkResourcesData::ResourceData*> NetworkResourcesData::resources()
+{
+    Vector<NetworkResourcesData::ResourceData*> resources;
+    copyValuesToVector(m_requestIdToResourceDataMap, resources);
+    return resources;
+}
+
 NetworkResourcesData::ResourceData* NetworkResourcesData::resourceDataForRequestId(const String& requestId)
 {
     if (requestId.isNull())
index 49dfba3..29b2d23 100644 (file)
@@ -127,6 +127,7 @@ public:
     ResourceData const* data(const String& requestId);
     Vector<String> removeCachedResource(CachedResource*);
     void clear(const String& preservedLoaderId = String());
+    Vector<ResourceData*> resources();
 
 private:
     ResourceData* resourceDataForRequestId(const String& requestId);
index d9a477e..e950c90 100644 (file)
@@ -1,5 +1,18 @@
 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.
+
+        * 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>
+
         Web Inspector: Allocation snapshot hover persists after switching tabs
         https://bugs.webkit.org/show_bug.cgi?id=156430
         <rdar://problem/25633800>
index bd05fd5..aceb148 100644 (file)
@@ -124,14 +124,14 @@ WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.
             if (error)
                 return;
 
-            function resourceCallback(url, error, resourceMatches)
+            function resourceCallback(frameId, url, error, resourceMatches)
             {
                 updateEmptyContentPlaceholderSoon.call(this);
 
                 if (error || !resourceMatches || !resourceMatches.length)
                     return;
 
-                var frame = WebInspector.frameResourceManager.frameForIdentifier(searchResult.frameId);
+                var frame = WebInspector.frameResourceManager.frameForIdentifier(frameId);
                 if (!frame)
                     return;
 
@@ -160,7 +160,8 @@ WebInspector.SearchSidebarPanel = class SearchSidebarPanel extends WebInspector.
                 if (!searchResult.url || !searchResult.frameId)
                     continue;
 
-                PageAgent.searchInResource(searchResult.frameId, searchResult.url, searchQuery, isCaseSensitive, isRegex, resourceCallback.bind(this, searchResult.url));
+                // 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));
             }
         }