Title: [96491] trunk
Revision
96491
Author
[email protected]
Date
2011-10-03 05:56:52 -0700 (Mon, 03 Oct 2011)

Log Message

Web Inspector: Add support for backend search in script content.
https://bugs.webkit.org/show_bug.cgi?id=69015

Reviewed by Pavel Feldman.

Source/WebCore:

Tests: http/tests/inspector/search/search-in-concatenated-script.html
       http/tests/inspector/search/search-in-script.html

* inspector/Inspector.json:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::searchInContent):
(WebCore::InspectorDebuggerAgent::getScriptSource):
* inspector/InspectorDebuggerAgent.h:
* inspector/front-end/ContentProviders.js:
(WebInspector.ScriptContentProvider.prototype.requestContent):
(WebInspector.ScriptContentProvider.prototype.searchInContent):
(WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent.maybeCallback):
(WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent.searchCallback):
(WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent):
* inspector/front-end/Script.js:
(WebInspector.Script.prototype.requestSource):
(WebInspector.Script.prototype.searchInContent):

LayoutTests:

* http/tests/inspector/resource-tree/resource-tree-test.js:
(initialize_ResourceTreeTest):
* http/tests/inspector/resources-test.js:
(initialize_ResourceTest.InspectorTest.runAfterResourcesAreFinished):
(initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished):
(initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.maybeCallback):
(initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.addSniffer):
(initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.resourceAddedToFrame):
(initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.visit):
(initialize_ResourceTest):
* http/tests/inspector/search/resources/search-concatenated.html: Added.
* http/tests/inspector/search/search-in-concatenated-script-expected.txt: Added.
* http/tests/inspector/search/search-in-concatenated-script.html: Added.
* http/tests/inspector/search/search-in-resource.html:
* http/tests/inspector/search/search-in-script-expected.txt: Added.
* http/tests/inspector/search/search-in-script.html: Added.
* http/tests/inspector/search/search-test.js:
(initialize_SearchTest):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96490 => 96491)


--- trunk/LayoutTests/ChangeLog	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/LayoutTests/ChangeLog	2011-10-03 12:56:52 UTC (rev 96491)
@@ -1,3 +1,29 @@
+2011-10-03  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Add support for backend search in script content.
+        https://bugs.webkit.org/show_bug.cgi?id=69015
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/resource-tree/resource-tree-test.js:
+        (initialize_ResourceTreeTest):
+        * http/tests/inspector/resources-test.js:
+        (initialize_ResourceTest.InspectorTest.runAfterResourcesAreFinished):
+        (initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished):
+        (initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.maybeCallback):
+        (initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.addSniffer):
+        (initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.resourceAddedToFrame):
+        (initialize_ResourceTest.InspectorTest._runAfterResourcesAreFinished.visit):
+        (initialize_ResourceTest):
+        * http/tests/inspector/search/resources/search-concatenated.html: Added.
+        * http/tests/inspector/search/search-in-concatenated-script-expected.txt: Added.
+        * http/tests/inspector/search/search-in-concatenated-script.html: Added.
+        * http/tests/inspector/search/search-in-resource.html:
+        * http/tests/inspector/search/search-in-script-expected.txt: Added.
+        * http/tests/inspector/search/search-in-script.html: Added.
+        * http/tests/inspector/search/search-test.js:
+        (initialize_SearchTest):
+
 2011-10-03  Kristóf Kosztyó  <[email protected]>
 
         Unreviewed Qt gardening after r96404

Modified: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-test.js (96490 => 96491)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-test.js	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-test.js	2011-10-03 12:56:52 UTC (rev 96491)
@@ -86,32 +86,4 @@
     InspectorTest.dumpResourcesTree();
 }
 
-InspectorTest.runAfterResourcesAreFinished = function(resourceURLs, callback)
-{
-    InspectorTest._runAfterResourcesAreFinished(resourceURLs.keySet(), callback);
-}
-
-InspectorTest._runAfterResourcesAreFinished = function(resourceURLs, callback)
-{
-    function visit(resource)
-    {
-        if (!resource.finished)
-            return true;
-
-        for (var url in resourceURLs) {
-            if (resource.url.indexOf(url) !== -1)
-                delete resourceURLs[url];
-        }
-
-        if (!Object.keys(resourceURLs).length) {
-            callback();
-            return true;
-        }
-    }
-
-    var succeeded = WebInspector.resourceTreeModel.forAllResources(visit);
-    if (!succeeded)
-        setTimeout(InspectorTest._runAfterResourcesAreFinished.bind(InspectorTest, resourceURLs, callback), 0);
-}
-
 };

Modified: trunk/LayoutTests/http/tests/inspector/resources-test.js (96490 => 96491)


--- trunk/LayoutTests/http/tests/inspector/resources-test.js	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/LayoutTests/http/tests/inspector/resources-test.js	2011-10-03 12:56:52 UTC (rev 96491)
@@ -27,4 +27,50 @@
     return r1.request.url.localeCompare(r2.request.url);
 }
 
+InspectorTest.runAfterResourcesAreFinished = function(resourceURLs, callback)
+{
+    InspectorTest._runAfterResourcesAreFinished(resourceURLs.keySet(), callback);
 }
+
+InspectorTest._runAfterResourcesAreFinished = function(resourceURLs, callback)
+{
+    function checkResource(resource)
+    {
+        for (var url in resourceURLs) {
+            if (resource.url.indexOf(url) !== -1)
+                delete resourceURLs[url];
+        }
+    }
+
+    function maybeCallback()
+    {
+        if (!Object.keys(resourceURLs).length) {
+            callback();
+            return true;
+        }
+    }
+
+    function addSniffer(resource)
+    {
+        InspectorTest.addSniffer(WebInspector.ResourceTreeModel.prototype, "_addResourceToFrame", resourceAddedToFrame.bind(this));
+    }
+
+    function resourceAddedToFrame(resource)
+    {
+        checkResource(resource);
+        if (!maybeCallback())
+            addSniffer();
+    }
+
+    function visit(resource)
+    {
+        checkResource(resource);
+        return maybeCallback();
+    }
+
+    var succeeded = WebInspector.resourceTreeModel.forAllResources(visit);
+    if (!succeeded)
+        addSniffer();
+}
+
+}

Added: trunk/LayoutTests/http/tests/inspector/search/resources/search-concatenated.html (0 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/resources/search-concatenated.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/resources/search-concatenated.html	2011-10-03 12:56:52 UTC (rev 96491)
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script>
+function searchTestUniqueString()
+{
+    var variable = 0;
+    // searchTestUniqueString two occurences on the same line searchTestUniqueString
+    var variable2 = 0;
+}
+</script><script>
+function doSomething()
+{
+    searchTestUniqueString();
+    // SEARCHTestUniqueString();
+}
+</script>
+<link href="" rel="stylesheet" type="text/css">
+<script>
+function searchTestUniqueString2()
+{
+    var variable = 0;
+    /* searchTestUniqueString two occurences on the same line searchTestUniqueString */ } </script><script> function doSomething2() { searchTestUniqueString();
+    // SEARCHTestUniqueString();
+}
+</script>
+</script>
+<body>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/http/tests/inspector/search/resources/search-concatenated.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script-expected.txt (0 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script-expected.txt	2011-10-03 12:56:52 UTC (rev 96491)
@@ -0,0 +1,15 @@
+Tests concatenated script search in inspector debugger agent.
+
+Bug 69015  
+http://127.0.0.1:8000/inspector/search/resources/search-concatenated.html
+Search matches: 
+lineNumber: 3, line: 'function searchTestUniqueString()'
+lineNumber: 6, line: '    // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 12, line: '    searchTestUniqueString();'
+lineNumber: 13, line: '    // SEARCHTestUniqueString();'
+lineNumber: 18, line: 'function searchTestUniqueString2()'
+lineNumber: 21, line: '    /* searchTestUniqueString two occurences on the same line searchTestUniqueString */ } '
+lineNumber: 21, line: ' function doSomething2() { searchTestUniqueString();'
+lineNumber: 22, line: '    // SEARCHTestUniqueString();'
+
+
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html (0 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html	2011-10-03 12:56:52 UTC (rev 96491)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function test()
+{
+    // This file should not match search query.
+    var text = "searchTest" + "UniqueString";
+    InspectorTest.runAfterResourcesAreFinished(["search-concatenated.html"], step2);
+
+    function step2()
+    {
+        var url = ""
+        var scripts = WebInspector.debuggerModel.scriptsForURL(url);
+        var contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
+        InspectorTest.addResult(url);
+        contentProvider.searchInContent(text, step3);
+    }
+
+    function step3(searchMatches)
+    {
+        InspectorTest.dumpSearchMatches(searchMatches);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body>
+<p>Tests concatenated script search in inspector debugger agent.</p>
+<a href="" 69015</a>
+
+<iframe src="" _onload_="runTest()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-concatenated-script.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/http/tests/inspector/search/search-in-resource.html (96490 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-in-resource.html	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-resource.html	2011-10-03 12:56:52 UTC (rev 96491)
@@ -1,13 +1,14 @@
 <html>
 <head>
 <script src=""
+<script src=""
 <script src=""
 <script>
 function test()
 {
     // This file should not match search query.
     var text = "searchTest" + "UniqueString";
-    InspectorTest.runAfterResourcesAreCreated(["search.js"], step2);
+    InspectorTest.runAfterResourcesAreFinished(["search.js"], step2);
 
     function step2()
     {

Added: trunk/LayoutTests/http/tests/inspector/search/search-in-script-expected.txt (0 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-in-script-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-script-expected.txt	2011-10-03 12:56:52 UTC (rev 96491)
@@ -0,0 +1,11 @@
+Tests script search in inspector debugger agent.
+
+Bug 69015  
+http://127.0.0.1:8000/inspector/search/resources/search.js
+Search matches: 
+lineNumber: 0, line: 'function searchTestUniqueString()'
+lineNumber: 3, line: '    // searchTestUniqueString two occurences on the same line searchTestUniqueString'
+lineNumber: 9, line: '    searchTestUniqueString();'
+lineNumber: 10, line: '    // SEARCHTestUniqueString();'
+
+
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-script-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/search/search-in-script.html (0 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-in-script.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/search/search-in-script.html	2011-10-03 12:56:52 UTC (rev 96491)
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function test()
+{
+    // This file should not match search query.
+    var text = "searchTest" + "UniqueString";
+    InspectorTest.runAfterResourcesAreFinished(["search.js"], step2);
+
+    function step2()
+    {
+        var scripts = WebInspector.debuggerModel.scriptsForURL("http://127.0.0.1:8000/inspector/search/resources/search.js");
+        var script = scripts[0];
+        InspectorTest.addResult(script.sourceURL);
+        script.searchInContent(text, step3);
+    }
+
+    function step3(searchMatches)
+    {
+        InspectorTest.dumpSearchMatches(searchMatches);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body>
+<p>Tests script search in inspector debugger agent.</p>
+<a href="" 69015</a>
+
+<iframe src="" _onload_="runTest()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/search/search-in-script.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/http/tests/inspector/search/search-test.js (96490 => 96491)


--- trunk/LayoutTests/http/tests/inspector/search/search-test.js	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/LayoutTests/http/tests/inspector/search/search-test.js	2011-10-03 12:56:52 UTC (rev 96491)
@@ -16,50 +16,4 @@
     InspectorTest.addResult("");
 };
 
-InspectorTest.runAfterResourcesAreCreated = function(resourceURLs, callback)
-{
-    InspectorTest._runAfterResourcesAreCreated(resourceURLs.keySet(), callback);
-}
-
-InspectorTest._runAfterResourcesAreCreated = function(resourceURLs, callback)
-{
-    function checkResource(resource)
-    {
-        for (var url in resourceURLs) {
-            if (resource.url.indexOf(url) !== -1)
-                delete resourceURLs[url];
-        }
-    }
-
-    function maybeCallback()
-    {
-        if (!Object.keys(resourceURLs).length) {
-            callback();
-            return true;
-        }
-    }
-
-    function addSniffer(resource)
-    {
-        InspectorTest.addSniffer(WebInspector.ResourceTreeModel.prototype, "_bindResourceURL", onResourceBind.bind(this));
-    }
-
-    function onResourceBind(resource)
-    {
-        checkResource(resource);
-        if (!maybeCallback())
-            addSniffer();
-    }
-
-    function visit(resource)
-    {
-        checkResource(resource);
-        return maybeCallback();
-    }
-
-    var succeeded = WebInspector.resourceTreeModel.forAllResources(visit);
-    if (!succeeded)
-        addSniffer();
-}
-
 };

Modified: trunk/Source/WebCore/ChangeLog (96490 => 96491)


--- trunk/Source/WebCore/ChangeLog	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/ChangeLog	2011-10-03 12:56:52 UTC (rev 96491)
@@ -1,3 +1,28 @@
+2011-10-03  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Add support for backend search in script content.
+        https://bugs.webkit.org/show_bug.cgi?id=69015
+
+        Reviewed by Pavel Feldman.
+
+        Tests: http/tests/inspector/search/search-in-concatenated-script.html
+               http/tests/inspector/search/search-in-script.html
+
+        * inspector/Inspector.json:
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::InspectorDebuggerAgent::searchInContent):
+        (WebCore::InspectorDebuggerAgent::getScriptSource):
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/front-end/ContentProviders.js:
+        (WebInspector.ScriptContentProvider.prototype.requestContent):
+        (WebInspector.ScriptContentProvider.prototype.searchInContent):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent.maybeCallback):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent.searchCallback):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype.searchInContent):
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.prototype.requestSource):
+        (WebInspector.Script.prototype.searchInContent):
+
 2011-10-03  Pavel Feldman  <[email protected]>
 
         Web Inspector: move console message formatting from ConsoleView.js into ConsoleMessage.js

Modified: trunk/Source/WebCore/inspector/Inspector.json (96490 => 96491)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-10-03 12:56:52 UTC (rev 96491)
@@ -1742,6 +1742,17 @@
                 "description": "Resumes _javascript_ execution."
             },
             {
+                "name": "searchInContent",
+                "parameters": [
+                    { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to search in." },
+                    { "name": "query", "type": "string", "description": "String to search for."  }
+                ],
+                "returns": [
+                    { "name": "result", "type": "array", "items": { "$ref": "Page.SearchMatch" }, "description": "List of search matches." }
+                ],
+                "description": "Searches for given string in script content."
+            },
+            {
                 "name": "setScriptSource",
                 "parameters": [
                     { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to edit." },

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (96490 => 96491)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2011-10-03 12:56:52 UTC (rev 96491)
@@ -31,6 +31,7 @@
 #include "InspectorDebuggerAgent.h"
 
 #if ENABLE(_javascript__DEBUGGER) && ENABLE(INSPECTOR)
+#include "ContentSearchUtils.h"
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
 #include "InspectorFrontend.h"
@@ -320,6 +321,15 @@
     return value->asObject();
 }
 
+void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptId, const String& query, RefPtr<InspectorArray>* results)
+{
+    ScriptsMap::iterator it = m_scripts.find(scriptId);
+    if (it != m_scripts.end())
+        *results = ContentSearchUtils::searchInTextByLines(query, it->second.source);
+    else
+        *error = "No script for id: " + scriptId;
+}
+
 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result)
 {
     bool previewOnly = preview && *preview;
@@ -332,9 +342,13 @@
         *result = object;
 }
 
-void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& scriptId, String* scriptSource)
+void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& scriptId, String* scriptSource)
 {
-    *scriptSource = m_scripts.get(scriptId).source;
+    ScriptsMap::iterator it = m_scripts.find(scriptId);
+    if (it != m_scripts.end())
+        *scriptSource = it->second.source;
+    else
+        *error = "No script for id: " + scriptId;
 }
 
 void InspectorDebuggerAgent::schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data)

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (96490 => 96491)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2011-10-03 12:56:52 UTC (rev 96491)
@@ -81,6 +81,7 @@
     void removeBreakpoint(ErrorString*, const String& breakpointId);
     void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);
 
+    void searchInContent(ErrorString*, const String& scriptId, const String& query, RefPtr<InspectorArray>*);
     void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<InspectorArray>* newCallFrames, RefPtr<InspectorObject>* result);
     void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource);
     void schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data);

Modified: trunk/Source/WebCore/inspector/front-end/ContentProviders.js (96490 => 96491)


--- trunk/Source/WebCore/inspector/front-end/ContentProviders.js	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/inspector/front-end/ContentProviders.js	2011-10-03 12:56:52 UTC (rev 96491)
@@ -46,6 +46,11 @@
             callback(this._mimeType, source);
         }
         this._script.requestSource(didRequestSource.bind(this));
+    },
+
+    searchInContent: function(query, callback)
+    {
+        this._script.searchInContent(query, callback);
     }
 }
 
@@ -77,6 +82,39 @@
            scripts[i].requestSource(didRequestSource.bind(this));
    },
 
+   searchInContent: function(query, callback)
+   {
+       var results = {};
+       var scriptsLeft = this._scripts.length;
+
+       function maybeCallback()
+       {
+           if (!scriptsLeft) {
+               var result = [];
+               for (var i = 0; i < this._scripts.length; ++i)
+                   result = result.concat(results[this._scripts[i].scriptId]);
+               callback(result);
+           }
+       }
+
+       function searchCallback(script, searchMatches)
+       {
+           results[script.scriptId] = [];
+           for (var i = 0; i < searchMatches.length; ++i) {
+               var searchMatch = {};
+               searchMatch.lineNumber = searchMatches[i].lineNumber + script.lineOffset;
+               searchMatch.lineContent = searchMatches[i].lineContent;
+               results[script.scriptId].push(searchMatch);
+           }
+           scriptsLeft--;
+           maybeCallback.call(this);
+       }
+
+       maybeCallback();
+       for (var i = 0; i < this._scripts.length; ++i)
+           this._scripts[i].searchInContent(query, searchCallback.bind(this, this._scripts[i]));
+   },
+
    _concatenateScriptsContent: function(scripts, sources)
    {
        var content = "";

Modified: trunk/Source/WebCore/inspector/front-end/Script.js (96490 => 96491)


--- trunk/Source/WebCore/inspector/front-end/Script.js	2011-10-03 11:58:07 UTC (rev 96490)
+++ trunk/Source/WebCore/inspector/front-end/Script.js	2011-10-03 12:56:52 UTC (rev 96491)
@@ -49,12 +49,26 @@
 
         function didGetScriptSource(error, source)
         {
+            if (error)
+                console.error(error);
             this._source = source;
             callback(this._source);
         }
         DebuggerAgent.getScriptSource(this.scriptId, didGetScriptSource.bind(this));
     },
 
+    searchInContent: function(query, callback)
+    {
+        function innerCallback(error, searchMatches)
+        {
+            if (error)
+                console.error(error);
+            callback(searchMatches);
+        }
+        
+        DebuggerAgent.searchInContent(this.scriptId, query, innerCallback.bind(this));
+    },
+    
     editSource: function(newSource, callback)
     {
         function didEditScriptSource(error, callFrames)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to