Title: [91567] trunk
Revision
91567
Author
[email protected]
Date
2011-07-22 08:19:14 -0700 (Fri, 22 Jul 2011)

Log Message

Web Inspector: sometimes ReceiveResponse event is attached to wrong parent.
https://bugs.webkit.org/show_bug.cgi?id=65016

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: inspector/timeline/timeline-receive-response-event.html

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didInstallTimer):
(WebCore::InspectorTimelineAgent::didRemoveTimer):
(WebCore::InspectorTimelineAgent::didScheduleResourceRequest):
(WebCore::InspectorTimelineAgent::didFinishLoadingResource):
(WebCore::InspectorTimelineAgent::didTimeStamp):
(WebCore::InspectorTimelineAgent::didMarkDOMContentEvent):
(WebCore::InspectorTimelineAgent::didMarkLoadEvent):
(WebCore::InspectorTimelineAgent::appendRecord):
* inspector/InspectorTimelineAgent.h:
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):

LayoutTests:

* http/tests/inspector/inspector-test.js:
(initialize_InspectorTest.InspectorTest.dump):
* inspector/timeline/resources/anImage.png: Added.
* inspector/timeline/resources/anotherImage.png: Added.
* inspector/timeline/timeline-receive-response-event-expected.txt: Added.
* inspector/timeline/timeline-receive-response-event.html: Added.
* platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91566 => 91567)


--- trunk/LayoutTests/ChangeLog	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/LayoutTests/ChangeLog	2011-07-22 15:19:14 UTC (rev 91567)
@@ -1,3 +1,18 @@
+2011-07-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: sometimes ReceiveResponse event is attached to wrong parent.
+        https://bugs.webkit.org/show_bug.cgi?id=65016
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector/inspector-test.js:
+        (initialize_InspectorTest.InspectorTest.dump):
+        * inspector/timeline/resources/anImage.png: Added.
+        * inspector/timeline/resources/anotherImage.png: Added.
+        * inspector/timeline/timeline-receive-response-event-expected.txt: Added.
+        * inspector/timeline/timeline-receive-response-event.html: Added.
+        * platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt: Added.
+
 2011-07-22  Kentaro Hara  <[email protected]>
 
         REGRESSION(r89535): Form reset does not repaint a file upload control.

Modified: trunk/LayoutTests/http/tests/inspector/inspector-test.js (91566 => 91567)


--- trunk/LayoutTests/http/tests/inspector/inspector-test.js	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/LayoutTests/http/tests/inspector/inspector-test.js	2011-07-22 15:19:14 UTC (rev 91567)
@@ -158,6 +158,10 @@
 InspectorTest.dump = function(value, nondeterministicProps, prefix, prefixWithName)
 {
     prefixWithName = prefixWithName || prefix;
+    if (prefixWithName && prefixWithName.length > 80) {
+        InspectorTest.addResult(prefixWithName + "was skipped due to prefix length limit");
+        return;
+    }
     if (value === null)
         InspectorTest.addResult(prefixWithName + "null");
     else if (value instanceof Array)

Added: trunk/LayoutTests/inspector/timeline/resources/anImage.png


(Binary files differ)
Property changes on: trunk/LayoutTests/inspector/timeline/resources/anImage.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/inspector/timeline/resources/anotherImage.png


(Binary files differ)
Property changes on: trunk/LayoutTests/inspector/timeline/resources/anotherImage.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/inspector/timeline/timeline-receive-response-event-expected.txt (0 => 91567)


--- trunk/LayoutTests/inspector/timeline/timeline-receive-response-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-receive-response-event-expected.txt	2011-07-22 15:19:14 UTC (rev 91567)
@@ -0,0 +1,13 @@
+Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
+
+ResourceSendRequest
+    ResourceReceiveResponse
+    ResourceReceivedData
+    ResourceFinish
+ResourceSendRequest
+    ResourceReceiveResponse
+    ResourceReceivedData
+    ResourceFinish
+EventDispatch
+EventDispatch
+
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-receive-response-event-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/timeline/timeline-receive-response-event.html (0 => 91567)


--- trunk/LayoutTests/inspector/timeline/timeline-receive-response-event.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-receive-response-event.html	2011-07-22 15:19:14 UTC (rev 91567)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function performActions()
+{
+    var image = new Image();
+    image._onload_ = bar;
+    image.src = ""
+
+    function bar() {
+        var image = new Image();
+        image._onload_ = function() { layoutTestController.evaluateInWebInspector(0, "window.step2()"); }
+        image.src = ""
+    }
+}
+
+function test()
+{
+    WebInspector.showPanel("timeline");
+    WebInspector.panels.timeline.toggleTimelineButton.toggled = true;
+    TimelineAgent.start(step1);
+
+    function step1()
+    {
+        InspectorTest.evaluateInPage("performActions()");
+    }
+
+    window.step2 = function()
+    {
+        TimelineAgent.stop(step3);
+    }
+
+    function step3()
+    {
+        function dumpFormattedRecord(record, prefix)
+        {
+             prefix = prefix || "";
+             InspectorTest.addResult(prefix + record.type);
+             if (record._children) {
+                 var childPrefix = prefix + "    ";
+                 for (var i = 0; i < record._children.length; ++i)
+                     dumpFormattedRecord(record._children[i], childPrefix);
+             }
+        }
+        WebInspector.panels.timeline.toggleTimelineButton.toggled = false;
+
+        var records = WebInspector.panels.timeline._rootRecord.children;
+        for (var i = 0; i < records.length; ++i)
+            dumpFormattedRecord(records[i]);
+        InspectorTest.completeTest();
+    }
+}
+
+if (!window.layoutTestController)
+    setTimeout(performActions, 3000);
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-receive-response-event.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt (0 => 91567)


--- trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt	2011-07-22 15:19:14 UTC (rev 91567)
@@ -0,0 +1,15 @@
+Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
+
+ResourceSendRequest
+    ResourceReceiveResponse
+    ResourceReceivedData
+    ResourceFinish
+ResourceSendRequest
+    ResourceReceiveResponse
+    ResourceReceivedData
+    ResourceFinish
+EventDispatch
+    FunctionCall
+EventDispatch
+    FunctionCall
+
Property changes on: trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (91566 => 91567)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 15:19:14 UTC (rev 91567)
@@ -1,3 +1,25 @@
+2011-07-22  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: sometimes ReceiveResponse event is attached to wrong parent.
+        https://bugs.webkit.org/show_bug.cgi?id=65016
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: inspector/timeline/timeline-receive-response-event.html
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didInstallTimer):
+        (WebCore::InspectorTimelineAgent::didRemoveTimer):
+        (WebCore::InspectorTimelineAgent::didScheduleResourceRequest):
+        (WebCore::InspectorTimelineAgent::didFinishLoadingResource):
+        (WebCore::InspectorTimelineAgent::didTimeStamp):
+        (WebCore::InspectorTimelineAgent::didMarkDOMContentEvent):
+        (WebCore::InspectorTimelineAgent::didMarkLoadEvent):
+        (WebCore::InspectorTimelineAgent::appendRecord):
+        * inspector/InspectorTimelineAgent.h:
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
+
 2011-07-22  Kentaro Hara  <[email protected]>
 
         REGRESSION(r89535): Form reset does not repaint a file upload control.

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (91566 => 91567)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2011-07-22 15:19:14 UTC (rev 91567)
@@ -233,18 +233,12 @@
 
 void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool singleShot)
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    record->setObject("data", TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot));
-    addRecordToTimeline(record.release(), TimelineRecordType::TimerInstall);
+    appendRecord(TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot), TimelineRecordType::TimerInstall);
 }
 
 void InspectorTimelineAgent::didRemoveTimer(int timerId)
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    record->setObject("data", TimelineRecordFactory::createGenericTimerData(timerId));
-    addRecordToTimeline(record.release(), TimelineRecordType::TimerRemove);
+    appendRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerRemove);
 }
 
 void InspectorTimelineAgent::willFireTimer(int timerId)
@@ -289,11 +283,7 @@
 
 void InspectorTimelineAgent::didScheduleResourceRequest(const String& url)
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    record->setObject("data", TimelineRecordFactory::createScheduleResourceRequestData(url));
-    record->setString("type", TimelineRecordType::ScheduleResourceRequest);
-    addRecordToTimeline(record.release(), TimelineRecordType::ScheduleResourceRequest);
+    appendRecord(TimelineRecordFactory::createScheduleResourceRequestData(url), TimelineRecordType::ScheduleResourceRequest);
 }
 
 void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, const ResourceRequest& request)
@@ -331,36 +321,22 @@
 
 void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime)
 {
-    pushGCEventRecords();
-    // Sometimes network stack can provide for us exact finish loading time. In the other case we will use currentTime.
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    String resourceId = IdentifiersFactory::resourceId(identifier);
-    record->setObject("data", TimelineRecordFactory::createResourceFinishData(resourceId, didFail, finishTime * 1000));
-    record->setString("type", TimelineRecordType::ResourceFinish);
-    setHeapSizeStatistic(record.get());
-    m_frontend->eventRecorded(record.release());
+    appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFactory::resourceId(identifier), didFail, finishTime * 1000), TimelineRecordType::ResourceFinish);
 }
 
 void InspectorTimelineAgent::didTimeStamp(const String& message)
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    record->setObject("data", TimelineRecordFactory::createTimeStampData(message));
-    addRecordToTimeline(record.release(), TimelineRecordType::TimeStamp);
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp);
 }
 
 void InspectorTimelineAgent::didMarkDOMContentEvent()
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    addRecordToTimeline(record.release(), TimelineRecordType::MarkDOMContent);
+    appendRecord(InspectorObject::create(), TimelineRecordType::TimeStamp);
 }
 
 void InspectorTimelineAgent::didMarkLoadEvent()
 {
-    pushGCEventRecords();
-    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
-    addRecordToTimeline(record.release(), TimelineRecordType::MarkLoad);
+    appendRecord(InspectorObject::create(), TimelineRecordType::MarkLoad);
 }
 
 void InspectorTimelineAgent::didCommitLoad()
@@ -416,6 +392,15 @@
 {
 }
 
+void InspectorTimelineAgent::appendRecord(PassRefPtr<InspectorObject> data, const String& type)
+{
+    pushGCEventRecords();
+    RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
+    record->setObject("data", data);
+    record->setString("type", type);
+    addRecordToTimeline(record.release(), type);
+}
+
 void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type)
 {
     pushGCEventRecords();

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (91566 => 91567)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2011-07-22 15:19:14 UTC (rev 91567)
@@ -139,6 +139,7 @@
     void setHeapSizeStatistic(InspectorObject* record);
         
     void didCompleteCurrentRecord(const String& type);
+    void appendRecord(PassRefPtr<InspectorObject> data, const String& type);
 
     void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type);
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (91566 => 91567)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-07-22 13:40:59 UTC (rev 91566)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-07-22 15:19:14 UTC (rev 91567)
@@ -404,7 +404,10 @@
         var recordTypes = WebInspector.TimelineAgent.RecordType;
         if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad)
             parentRecord = null; // No bar entry for load events.
-        else if (parentRecord === this._rootRecord) {
+        else if (parentRecord === this._rootRecord ||
+                 record.type === recordTypes.ResourceReceiveResponse ||
+                 record.type === recordTypes.ResourceFinish ||
+                 record.type === recordTypes.ResourceReceivedData) {
             var newParentRecord = this._findParentRecord(record);
             if (newParentRecord) {
                 parentRecord = newParentRecord;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to