Title: [98107] branches/chromium/912
Revision
98107
Author
vse...@chromium.org
Date
2011-10-21 10:06:00 -0700 (Fri, 21 Oct 2011)

Log Message

Merge 97702 - Web Inspector: Search in resource crashes when there is no resource with given url.
https://bugs.webkit.org/show_bug.cgi?id=69767

Reviewed by Pavel Feldman.

Source/WebCore:

Test: http/tests/inspector/search/search-in-non-existing-resource.html

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::searchInResource):

LayoutTests:

* http/tests/inspector/search/search-in-non-existing-resource-expected.txt: Added.
* http/tests/inspector/search/search-in-non-existing-resource.html: Added.


BUG=101005
TBR=vse...@chromium.org
Review URL: http://codereview.chromium.org/8370003

Modified Paths

Added Paths

Diff

Copied: branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt (from rev 97702, trunk/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt) (0 => 98107)


--- branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt	                        (rev 0)
+++ branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource-expected.txt	2011-10-21 17:06:00 UTC (rev 98107)
@@ -0,0 +1,6 @@
+Tests single resource search in inspector page agent with non existing resource url does not cause a crash.
+
+Bug 69767  
+Search matches: 
+
+

Copied: branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html (from rev 97702, trunk/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html) (0 => 98107)


--- branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html	                        (rev 0)
+++ branches/chromium/912/LayoutTests/http/tests/inspector/search/search-in-non-existing-resource.html	2011-10-21 17:06:00 UTC (rev 98107)
@@ -0,0 +1,34 @@
+<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 resource = WebInspector.resourceForURL("http://127.0.0.1:8000/inspector/search/resources/search.js");
+        var url = ""
+        PageAgent.searchInResource(resource.frameId, url, text, step3);
+    }
+
+    function step3(error, searchMatches)
+    {
+        InspectorTest.dumpSearchMatches(searchMatches);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body>
+<p>Tests single resource search in inspector page agent with non existing resource url does not cause a crash.</p>
+<a href="" 69767</a>
+
+<iframe src="" _onload_="runTest()">
+</body>
+</html>

Modified: branches/chromium/912/Source/WebCore/inspector/InspectorPageAgent.cpp (98106 => 98107)


--- branches/chromium/912/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-10-21 17:04:39 UTC (rev 98106)
+++ branches/chromium/912/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-10-21 17:06:00 UTC (rev 98107)
@@ -503,7 +503,8 @@
 
     if (!success) {
         CachedResource* resource = cachedResource(frame, kurl);
-        success = textContentForCachedResource(resource, &content);
+        if (resource)
+            success = textContentForCachedResource(resource, &content);
     }
 
     if (!success)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to