⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 120456 in webkit


Ignore:
Timestamp:
Jun 15, 2012, 7:28:20 AM (14 years ago)
Author:
loislo@chromium.org
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.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r120451 r120456  
     12012-06-15  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: CRASH: getProfile is crashing for unknown profiles.
     4        https://bugs.webkit.org/show_bug.cgi?id=89202
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/profiler/heap-snapshot-get-profile-crash-expected.txt: Added.
     9        * inspector/profiler/heap-snapshot-get-profile-crash.html: Added.
     10
    1112012-06-15  Kent Tamura  <tkent@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r120453 r120456  
     12012-06-15  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: CRASH: getProfile is crashing for unknown profiles.
     4        https://bugs.webkit.org/show_bug.cgi?id=89202
     5
     6        agents' functions have to set a value to errorString if it can't assign values to the mandatory out arguments.
     7
     8        Reviewed by Pavel Feldman.
     9
     10        Test: inspector/profiler/heap-snapshot-get-profile-crash.html
     11
     12        * inspector/InspectorProfilerAgent.cpp:
     13        (WebCore::InspectorProfilerAgent::getProfile):
     14
    1152012-06-15  Max Feil  <mfeil@rim.com>
    216
  • trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp

    r116768 r120456  
    268268} // namespace
    269269
    270 void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
     270void InspectorProfilerAgent::getProfile(ErrorString* errorString, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
    271271{
    272272    unsigned uid = static_cast<unsigned>(rawUid);
    273273    if (type == CPUProfileType) {
    274274        ProfilesMap::iterator it = m_profiles.find(uid);
    275         if (it != m_profiles.end()) {
    276             profileObject = TypeBuilder::Profiler::Profile::create();
    277             profileObject->setHead(it->second->buildInspectorObjectForHead());
    278             if (it->second->bottomUpHead())
    279                 profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead());
     275        if (it == m_profiles.end()) {
     276            *errorString = "Profile wasn't found";
     277            return;
    280278        }
     279        profileObject = TypeBuilder::Profiler::Profile::create();
     280        profileObject->setHead(it->second->buildInspectorObjectForHead());
     281        if (it->second->bottomUpHead())
     282            profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead());
    281283    } else if (type == HeapProfileType) {
    282284        HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
    283         if (it != m_snapshots.end()) {
    284             RefPtr<ScriptHeapSnapshot> snapshot = it->second;
    285             profileObject = TypeBuilder::Profiler::Profile::create();
    286             if (m_frontend) {
    287                 OutputStream stream(m_frontend, uid);
    288                 snapshot->writeJSON(&stream);
    289             }
     285        if (it == m_snapshots.end()) {
     286            *errorString = "Profile wasn't found";
     287            return;
     288        }
     289        RefPtr<ScriptHeapSnapshot> snapshot = it->second;
     290        profileObject = TypeBuilder::Profiler::Profile::create();
     291        if (m_frontend) {
     292            OutputStream stream(m_frontend, uid);
     293            snapshot->writeJSON(&stream);
    290294        }
    291295    }
Note: See TracChangeset for help on using the changeset viewer.