Title: [120456] trunk
Revision
120456
Author
[email protected]
Date
2012-06-15 07:28:20 -0700 (Fri, 15 Jun 2012)

Log Message

Web Inspector: CRASH: getProfile is crashing for unknown profiles.
https://bugs.webkit.org/show_bug.cgi?id=89202

Source/WebCore:

agents' functions have to set a value to errorString if it can't assign values to the mandatory out arguments.

Reviewed by Pavel Feldman.

Test: inspector/profiler/heap-snapshot-get-profile-crash.html

* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::getProfile):

LayoutTests:

Reviewed by Pavel Feldman.

* inspector/profiler/heap-snapshot-get-profile-crash-expected.txt: Added.
* inspector/profiler/heap-snapshot-get-profile-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120455 => 120456)


--- trunk/LayoutTests/ChangeLog	2012-06-15 14:26:13 UTC (rev 120455)
+++ trunk/LayoutTests/ChangeLog	2012-06-15 14:28:20 UTC (rev 120456)
@@ -1,3 +1,13 @@
+2012-06-15  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: CRASH: getProfile is crashing for unknown profiles.
+        https://bugs.webkit.org/show_bug.cgi?id=89202
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/profiler/heap-snapshot-get-profile-crash-expected.txt: Added.
+        * inspector/profiler/heap-snapshot-get-profile-crash.html: Added.
+
 2012-06-15  Kent Tamura  <[email protected]>
 
         [Chromium] Rebaseline for type=range tests.

Added: trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash-expected.txt (0 => 120456)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash-expected.txt	2012-06-15 14:28:20 UTC (rev 120456)
@@ -0,0 +1,6 @@
+This test checks HeapSnapshots module.
+
+
+Running: getHeapSnapshotDoesntCrash
+log: Profile wasn't found
+
Property changes on: trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html (0 => 120456)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html	2012-06-15 14:28:20 UTC (rev 120456)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.runTestSuite([
+        function getHeapSnapshotDoesntCrash(next)
+        {
+            function finish(errorString, profile)
+            {
+                console.log(errorString);
+                next();
+            }
+            ProfilerAgent.getProfile("HEAP", -1, finish);
+        }
+    ]);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+This test checks HeapSnapshots module.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (120455 => 120456)


--- trunk/Source/WebCore/ChangeLog	2012-06-15 14:26:13 UTC (rev 120455)
+++ trunk/Source/WebCore/ChangeLog	2012-06-15 14:28:20 UTC (rev 120456)
@@ -1,3 +1,17 @@
+2012-06-15  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: CRASH: getProfile is crashing for unknown profiles.
+        https://bugs.webkit.org/show_bug.cgi?id=89202
+
+        agents' functions have to set a value to errorString if it can't assign values to the mandatory out arguments.
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/profiler/heap-snapshot-get-profile-crash.html
+
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::getProfile):
+
 2012-06-15  Max Feil  <[email protected]>
 
         [BlackBerry] media volume slider in wrong position (master_38 regression)

Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp (120455 => 120456)


--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2012-06-15 14:26:13 UTC (rev 120455)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2012-06-15 14:28:20 UTC (rev 120456)
@@ -267,27 +267,31 @@
 
 } // namespace
 
-void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
+void InspectorProfilerAgent::getProfile(ErrorString* errorString, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
 {
     unsigned uid = static_cast<unsigned>(rawUid);
     if (type == CPUProfileType) {
         ProfilesMap::iterator it = m_profiles.find(uid);
-        if (it != m_profiles.end()) {
-            profileObject = TypeBuilder::Profiler::Profile::create();
-            profileObject->setHead(it->second->buildInspectorObjectForHead());
-            if (it->second->bottomUpHead())
-                profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead());
+        if (it == m_profiles.end()) {
+            *errorString = "Profile wasn't found";
+            return;
         }
+        profileObject = TypeBuilder::Profiler::Profile::create();
+        profileObject->setHead(it->second->buildInspectorObjectForHead());
+        if (it->second->bottomUpHead())
+            profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead());
     } else if (type == HeapProfileType) {
         HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
-        if (it != m_snapshots.end()) {
-            RefPtr<ScriptHeapSnapshot> snapshot = it->second;
-            profileObject = TypeBuilder::Profiler::Profile::create();
-            if (m_frontend) {
-                OutputStream stream(m_frontend, uid);
-                snapshot->writeJSON(&stream);
-            }
+        if (it == m_snapshots.end()) {
+            *errorString = "Profile wasn't found";
+            return;
         }
+        RefPtr<ScriptHeapSnapshot> snapshot = it->second;
+        profileObject = TypeBuilder::Profiler::Profile::create();
+        if (m_frontend) {
+            OutputStream stream(m_frontend, uid);
+            snapshot->writeJSON(&stream);
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to