Changeset 87395 in webkit


Ignore:
Timestamp:
May 26, 2011 9:36:38 AM (13 years ago)
Author:
caseq@chromium.org
Message:

2011-05-26 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: TimelinePanel should not modify input timeline data when processing timeline event
https://bugs.webkit.org/show_bug.cgi?id=61529

Do not modify input timeline data when processing timeline event.

  • inspector/front-end/TimelinePanel.js: (WebInspector.TimelinePanel.prototype._addRecordToTimeline): (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline): (WebInspector.TimelinePanel.FormattedRecord): (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): (WebInspector.TimelinePanel.FormattedRecord.prototype._refreshDetails): (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):

2011-05-26 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: TimelinePanel should not modify input timeline data when processing timeline event
https://bugs.webkit.org/show_bug.cgi?id=61529

Do not modify input timeline data when processing timeline event.

  • inspector/timeline/timeline-network-resource-expected.txt:
  • platform/chromium/inspector/timeline/timeline-network-resource-expected.txt
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87393 r87395  
     12011-05-26  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: TimelinePanel should not modify input timeline data when processing timeline event
     6        https://bugs.webkit.org/show_bug.cgi?id=61529
     7
     8        Do not modify input timeline data when processing timeline event.
     9
     10        * inspector/timeline/timeline-network-resource-expected.txt:
     11        * platform/chromium/inspector/timeline/timeline-network-resource-expected.txt
     12
    1132011-05-26  Tony Chang  <tony@chromium.org>
    214
  • trunk/LayoutTests/inspector/timeline/timeline-network-resource-expected.txt

    r82239 r87395  
    2424        statusCode : 0
    2525        mimeType : <string>
    26         url : <string>
    2726    }
    2827    children : <object>
     
    3938        identifier : <number>
    4039        didFail : false
    41         url : <string>
    4240    }
    4341    type : "ResourceFinish"
  • trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-network-resource-expected.txt

    r82239 r87395  
    2525        statusCode : 0
    2626        mimeType : <string>
    27         url : <string>
    2827    }
    2928    children : <object>
     
    4039        identifier : <number>
    4140        didFail : false
    42         url : <string>
    4341    }
    4442    type : "ResourceFinish"
  • trunk/Source/WebCore/ChangeLog

    r87392 r87395  
     12011-05-26  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: TimelinePanel should not modify input timeline data when processing timeline event
     6        https://bugs.webkit.org/show_bug.cgi?id=61529
     7
     8        Do not modify input timeline data when processing timeline event.
     9
     10        * inspector/front-end/TimelinePanel.js:
     11        (WebInspector.TimelinePanel.prototype._addRecordToTimeline):
     12        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
     13        (WebInspector.TimelinePanel.FormattedRecord):
     14        (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
     15        (WebInspector.TimelinePanel.FormattedRecord.prototype._refreshDetails):
     16        (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):
     17
    1182011-05-26  Rob Buis  <rbuis@rim.com>
    219
  • trunk/Source/WebCore/inspector/front-end/TimelinePanel.js

    r85415 r87395  
    306306    _addRecordToTimeline: function(record)
    307307    {
    308         if (record.type == WebInspector.TimelineAgent.RecordType.ResourceSendRequest) {
     308        if (record.type === WebInspector.TimelineAgent.RecordType.ResourceSendRequest) {
    309309            var isMainResource = (record.data.identifier === WebInspector.mainResource.identifier);
    310310            if (isMainResource && this._mainResourceIdentifier !== record.data.identifier) {
     
    349349        }
    350350
    351         if (record.type == recordTypes.TimerFire && record.children && record.children.length) {
    352             var childRecord = record.children[0];
     351        var children = record.children;
     352        var scriptDetails;
     353        if (record.data.scriptName) {
     354            scriptDetails = {
     355                scriptName: record.data.scriptName,
     356                scriptLine: record.data.scriptLine
     357            }
     358        };
     359        if (record.type === recordTypes.TimerFire && children && children.length) {
     360            var childRecord = children[0];
    353361            if (childRecord.type === recordTypes.FunctionCall) {
    354                 record.data.scriptName = childRecord.data.scriptName;
    355                 record.data.scriptLine = childRecord.data.scriptLine;
    356                 record.children.shift();
    357                 record.children = childRecord.children.concat(record.children);
     362                scriptDetails = {
     363                    scriptName: childRecord.data.scriptName,
     364                    scriptLine: childRecord.data.scriptLine
     365                };
     366                children = childRecord.children.concat(children.slice(1));
    358367            }
    359368        }
    360369
    361         var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this);
     370        var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this, scriptDetails);
    362371
    363372        if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad) {
     
    369378        formattedRecord.collapsed = (parentRecord === this._rootRecord);
    370379
    371         var childrenCount = record.children ? record.children.length : 0;
     380        var childrenCount = children ? children.length : 0;
    372381        for (var i = 0; i < childrenCount; ++i)
    373             this._innerAddRecordToTimeline(record.children[i], formattedRecord);
     382            this._innerAddRecordToTimeline(children[i], formattedRecord);
    374383
    375384        formattedRecord._calculateAggregatedStats(this.categories);
     
    858867}
    859868
    860 WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, panel)
     869WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, panel, scriptDetails)
    861870{
    862871    var recordTypes = WebInspector.TimelineAgent.RecordType;
     
    877886    this.totalHeapSize = record.totalHeapSize;
    878887    this.usedHeapSize = record.usedHeapSize;
    879 
     888    if (record.data.url)
     889        this.url = record.data.url;
     890    if (scriptDetails) {
     891        this.scriptName = scriptDetails.scriptName;
     892        this.scriptLine = scriptDetails.scriptLine;
     893    }
    880894    // Make resource receive record last since request was sent; make finish record last since response received.
    881895    if (record.type === recordTypes.ResourceSendRequest) {
     
    886900        var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
    887901        if (sendRequestRecord) { // False if we started instrumentation in the middle of request.
    888             record.data.url = sendRequestRecord.data.url;
     902            this.url = sendRequestRecord.url;
    889903            // Now that we have resource in the collection, recalculate details in order to display short url.
    890             sendRequestRecord.details = this._getRecordDetails(sendRequestRecord, panel._sendRequestRecords);
     904            sendRequestRecord._refreshDetails();
    891905            if (sendRequestRecord.parent !== panel._rootRecord && sendRequestRecord.parent.type === recordTypes.ScheduleResourceRequest)
    892                 sendRequestRecord.parent.details = this._getRecordDetails(sendRequestRecord, panel._sendRequestRecords);
    893         }
    894     } else if (record.type === recordTypes.ResourceReceivedData) {
     906                sendRequestRecord.parent._refreshDetails();
     907        }
     908    } else if (record.type === recordTypes.ResourceReceivedData || record.type === recordTypes.ResourceFinish) {
    895909        var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
    896910        if (sendRequestRecord) // False for main resource.
    897             record.data.url = sendRequestRecord.data.url;
    898     } else if (record.type === recordTypes.ResourceFinish) {
    899         var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
    900         if (sendRequestRecord) // False for main resource.
    901             record.data.url = sendRequestRecord.data.url;
     911            this.url = sendRequestRecord.url;
    902912    } else if (record.type === recordTypes.TimerInstall) {
    903913        this.timeout = record.data.timeout;
     
    912922        }
    913923    }
    914     this.details = this._getRecordDetails(record, panel._sendRequestRecords);
     924    this._refreshDetails();
    915925}
    916926
     
    971981                break;
    972982            case recordTypes.FunctionCall:
    973                 contentHelper._appendLinkRow(WebInspector.UIString("Location"), this.data.scriptName, this.data.scriptLine);
     983                contentHelper._appendLinkRow(WebInspector.UIString("Location"), this.scriptName, this.scriptLine);
    974984                break;
    975985            case recordTypes.ScheduleResourceRequest:
     
    978988            case recordTypes.ResourceReceivedData:
    979989            case recordTypes.ResourceFinish:
    980                 contentHelper._appendLinkRow(WebInspector.UIString("Resource"), this.data.url);
     990                contentHelper._appendLinkRow(WebInspector.UIString("Resource"), this.url);
    981991                if (this.data.requestMethod)
    982992                    contentHelper._appendTextRow(WebInspector.UIString("Request Method"), this.data.requestMethod);
     
    987997                break;
    988998            case recordTypes.EvaluateScript:
    989                 if (this.data && this.data.url)
    990                     contentHelper._appendLinkRow(WebInspector.UIString("Script"), this.data.url, this.data.lineNumber);
     999                if (this.data && this.url)
     1000                    contentHelper._appendLinkRow(WebInspector.UIString("Script"), this.url, this.data.lineNumber);
    9911001                break;
    9921002            case recordTypes.Paint:
     
    10011011        }
    10021012
    1003         if (this.data.scriptName && this.type !== recordTypes.FunctionCall)
    1004             contentHelper._appendLinkRow(WebInspector.UIString("Function Call"), this.data.scriptName, this.data.scriptLine);
     1013        if (this.scriptName && this.type !== recordTypes.FunctionCall)
     1014            contentHelper._appendLinkRow(WebInspector.UIString("Function Call"), this.scriptName, this.scriptLine);
    10051015
    10061016        if (this.usedHeapSize)
     
    10161026    },
    10171027
    1018     _getRecordDetails: function(record, sendRequestRecords)
    1019     {
    1020         switch (record.type) {
     1028    _refreshDetails: function()
     1029    {
     1030        this.details = this._getRecordDetails();
     1031    },
     1032
     1033    _getRecordDetails: function()
     1034    {
     1035        switch (this.type) {
    10211036            case WebInspector.TimelineAgent.RecordType.GCEvent:
    1022                 return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta));
     1037                return WebInspector.UIString("%s collected", Number.bytesToString(this.data.usedHeapSizeDelta));
    10231038            case WebInspector.TimelineAgent.RecordType.TimerFire:
    1024                 return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : record.data.timerId;
     1039                return this.scriptName ? WebInspector.linkifyResourceAsNode(this.scriptName, "scripts", this.scriptLine, "", "") : this.data.timerId;
    10251040            case WebInspector.TimelineAgent.RecordType.FunctionCall:
    1026                 return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : null;
     1041                return this.scriptName ? WebInspector.linkifyResourceAsNode(this.scriptName, "scripts", this.scriptLine, "", "") : null;
    10271042            case WebInspector.TimelineAgent.RecordType.EventDispatch:
    1028                 return record.data ? record.data.type : null;
     1043                return this.data ? this.data.type : null;
    10291044            case WebInspector.TimelineAgent.RecordType.Paint:
    1030                 return record.data.width + "\u2009\u00d7\u2009" + record.data.height;
     1045                return this.data.width + "\u2009\u00d7\u2009" + this.data.height;
    10311046            case WebInspector.TimelineAgent.RecordType.TimerInstall:
    10321047            case WebInspector.TimelineAgent.RecordType.TimerRemove:
    1033                 return this.stackTrace ? WebInspector.linkifyResourceAsNode(this.stackTrace[0].url, "scripts", this.stackTrace[0].lineNumber, "", "") : record.data.timerId;
     1048                return this.stackTrace ? WebInspector.linkifyResourceAsNode(this.stackTrace[0].url, "scripts", this.stackTrace[0].lineNumber, "", "") : this.data.timerId;
    10341049            case WebInspector.TimelineAgent.RecordType.ParseHTML:
    10351050            case WebInspector.TimelineAgent.RecordType.RecalculateStyles:
    10361051                return this.stackTrace ? WebInspector.linkifyResourceAsNode(this.stackTrace[0].url, "scripts", this.stackTrace[0].lineNumber, "", "") : null;
    10371052            case WebInspector.TimelineAgent.RecordType.EvaluateScript:
    1038                 return record.data.url ? WebInspector.linkifyResourceAsNode(record.data.url, "scripts", record.data.lineNumber, "", "") : null;
     1053                return this.url ? WebInspector.linkifyResourceAsNode(this.url, "scripts", this.data.lineNumber, "", "") : null;
    10391054            case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange:
    10401055            case WebInspector.TimelineAgent.RecordType.XHRLoad:
     
    10441059            case WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse:
    10451060            case WebInspector.TimelineAgent.RecordType.ResourceFinish:
    1046                 return WebInspector.displayNameForURL(record.data.url);
     1061                return WebInspector.displayNameForURL(this.url);
    10471062            case WebInspector.TimelineAgent.RecordType.MarkTimeline:
    1048                 return record.data.message;
     1063                return this.data.message;
    10491064            default:
    10501065                return null;
Note: See TracChangeset for help on using the changeset viewer.