Title: [143564] trunk/Source/WebCore
Revision
143564
Author
commit-qu...@webkit.org
Date
2013-02-20 22:26:04 -0800 (Wed, 20 Feb 2013)

Log Message

[Web Inspector] Fix Sort by Initiator functionality of Network Panel.
https://bugs.webkit.org/show_bug.cgi?id=109135.

Patch by Pan Deng <pan.d...@intel.com> on 2013-02-20
Reviewed by Pavel Feldman.

A refactor for request initiator types, and the sort by Initiator functionality
was changed to sort by url and line number that displayed in initiator cell.

No new tests.

* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell): save initiator displayedURL and displayedLineNumber
(WebInspector.NetworkDataGridNode.InitiatorComparator):
* inspector/front-end/NetworkRequest.js:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143563 => 143564)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 05:36:42 UTC (rev 143563)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 06:26:04 UTC (rev 143564)
@@ -1,3 +1,20 @@
+2013-02-20  Pan Deng  <pan.d...@intel.com>
+
+        [Web Inspector] Fix Sort by Initiator functionality of Network Panel.
+        https://bugs.webkit.org/show_bug.cgi?id=109135.
+
+        Reviewed by Pavel Feldman.
+
+        A refactor for request initiator types, and the sort by Initiator functionality 
+        was changed to sort by url and line number that displayed in initiator cell.
+
+        No new tests.
+
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell): save initiator displayedURL and displayedLineNumber
+        (WebInspector.NetworkDataGridNode.InitiatorComparator):
+        * inspector/front-end/NetworkRequest.js:
+
 2013-02-20  Eric Seidel  <e...@webkit.org>
 
         WebVTTParser copies character buffer more often than necessary

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (143563 => 143564)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-02-21 05:36:42 UTC (rev 143563)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-02-21 06:26:04 UTC (rev 143564)
@@ -2183,16 +2183,20 @@
         this._initiatorCell.removeStyleClass("network-script-initiated");
         delete this._initiatorCell.request;
         this._initiatorCell.title = "";
+        delete this._displayedInitiatorURL;
+        delete this._displayedInitiatorLineNumber;
 
         var initiator = this._request.initiator;
-        if ((initiator && initiator.type !== "other") || this._request.redirectSource) {
+        var initiatorTypes = WebInspector.NetworkRequest.InitiatorType;
+        if ((initiator && initiator.type !== initiatorTypes.Other) || this._request.redirectSource) {
             this._initiatorCell.removeChildren();
             var redirectSource = this._request.redirectSource;
             if (redirectSource) {
                 this._initiatorCell.title = redirectSource.url;
                 this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource));
                 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Redirect"));
-            } else if (initiator.type === "script") {
+                this._displayedInitiatorURL = redirectSource.url;
+            } else if (initiator.type === initiatorTypes.Script) {
                 var topFrame = initiator.stackTrace[0];
                 // This could happen when request loading was triggered by console.
                 if (!topFrame.url) {
@@ -2206,10 +2210,14 @@
                 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script"));
                 this._initiatorCell.addStyleClass("network-script-initiated");
                 this._initiatorCell.request = this._request;
-            } else { // initiator.type === "parser"
+                this._displayedInitiatorURL = WebInspector.displayNameForURL(topFrame.url);
+                this._displayedInitiatorLineNumber = topFrame.lineNumber;
+            } else { // initiator.type === initiatorTypes.Parser
                 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumber;
                 this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, initiator.lineNumber - 1));
                 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Parser"));
+                this._displayedInitiatorURL = WebInspector.displayNameForURL(initiator.url);
+                this._displayedInitiatorLineNumber = initiator.lineNumber;
             }
         } else {
             this._initiatorCell.addStyleClass("network-dim-cell");
@@ -2386,17 +2394,18 @@
 
 WebInspector.NetworkDataGridNode.InitiatorComparator = function(a, b)
 {
-    if (!a._request.initiator || a._request.initiator.type === "Other")
-        return -1;
-    if (!b._request.initiator || b._request.initiator.type === "Other")
+    var initiatorTypes = WebInspector.NetworkRequest.InitiatorType;
+    if (!a._request.initiator || a._request.initiator.type === initiatorTypes.Other)
+        return -1;    
+    if (!b._request.initiator || b._request.initiator.type === initiatorTypes.Other)
         return 1;
 
-    if (a._request.initiator.url < b._request.initiator.url)
+    if (a._displayedInitiatorURL < b._displayedInitiatorURL)
         return -1;
-    if (a._request.initiator.url > b._request.initiator.url)
+    if (a._displayedInitiatorURL > b._displayedInitiatorURL)
         return 1;
 
-    return a._request.initiator.lineNumber - b._request.initiator.lineNumber;
+    return a._displayedInitiatorLineNumber - b._displayedInitiatorLineNumber;
 }
 
 WebInspector.NetworkDataGridNode.RequestCookiesCountComparator = function(a, b)

Modified: trunk/Source/WebCore/inspector/front-end/NetworkRequest.js (143563 => 143564)


--- trunk/Source/WebCore/inspector/front-end/NetworkRequest.js	2013-02-21 05:36:42 UTC (rev 143563)
+++ trunk/Source/WebCore/inspector/front-end/NetworkRequest.js	2013-02-21 06:26:04 UTC (rev 143564)
@@ -67,6 +67,12 @@
     ResponseHeadersChanged: "ResponseHeadersChanged",
 }
 
+WebInspector.NetworkRequest.InitiatorType = {
+    Parser: "parser",
+    Script: "script",
+    Other: "other",
+}
+
 WebInspector.NetworkRequest.prototype = {
     /**
      * @return {NetworkAgent.RequestId}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to