Title: [94287] trunk
Revision
94287
Author
[email protected]
Date
2011-09-01 05:16:10 -0700 (Thu, 01 Sep 2011)

Log Message

Web Inspector: Network error messages in console should link to the respective request in network panel if there is one.
https://bugs.webkit.org/show_bug.cgi?id=65550

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/ConsoleMessage.js:
(WebInspector.ConsoleMessage.prototype._formatMessage):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype.refresh):
(WebInspector.NetworkLogView.prototype.switchToBriefView):
(WebInspector.NetworkLogView.prototype.searchCanceled):
(WebInspector.NetworkLogView.prototype.revealAndHighlightResource):
(WebInspector.NetworkLogView.prototype._removeAllNodeHighlights):
(WebInspector.NetworkLogView.prototype._highlightNode):
(WebInspector.NetworkPanel.prototype._resourceByAnchor):
(WebInspector.NetworkPanel.prototype.canShowAnchorLocation):
(WebInspector.NetworkPanel.prototype.showAnchorLocation):
* inspector/front-end/networkLogView.css:
(.network-log-grid tr.highlighted-row):
(from):
(to):

LayoutTests:

* http/tests/inspector/console-resource-errors-expected.txt:
* http/tests/inspector/console-xhr-logging-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94286 => 94287)


--- trunk/LayoutTests/ChangeLog	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/LayoutTests/ChangeLog	2011-09-01 12:16:10 UTC (rev 94287)
@@ -1,3 +1,13 @@
+2011-09-01  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Network error messages in console should link to the respective request in network panel if there is one.
+        https://bugs.webkit.org/show_bug.cgi?id=65550
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector/console-resource-errors-expected.txt:
+        * http/tests/inspector/console-xhr-logging-expected.txt:
+
 2011-09-01  Cary Clark  <[email protected]>
 
         Unreviewed; new baselines (Skia on Mac, next chunk of 800 files)

Modified: trunk/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt (94286 => 94287)


--- trunk/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/LayoutTests/http/tests/inspector/console-resource-errors-expected.txt	2011-09-01 12:16:10 UTC (rev 94287)
@@ -1,8 +1,8 @@
 Tests that errors to load a resource cause error messages to be logged to console.
 
 
-missing.cssGET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-message console-error-level
-non-existent-iframe.htmlGET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) console-message console-error-level
-non-existent-script.jsGET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-message console-error-level
-non-existent-xhrGET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) console-message console-error-level
+GET http://127.0.0.1:8000/inspector/missing.css 404 (Not Found) console-message console-error-level
+GET http://127.0.0.1:8000/inspector/non-existent-iframe.html 404 (Not Found) console-message console-error-level
+GET http://127.0.0.1:8000/inspector/non-existent-script.js 404 (Not Found) console-message console-error-level
+GET http://127.0.0.1:8000/inspector/non-existent-xhr 404 (Not Found) console-message console-error-level
 

Modified: trunk/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt (94286 => 94287)


--- trunk/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt	2011-09-01 12:16:10 UTC (rev 94287)
@@ -13,7 +13,7 @@
 console-xhr-logging.html:10sending a GET request to resources/xhr-exists.html
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html".
 console-xhr-logging.html:10sending a GET request to resources/xhr-does-not-exist.html
-resources/xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html".
 console-xhr-logging.html:10sending a POST request to resources/post-target.cgi
 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi".
@@ -21,7 +21,7 @@
 XMLHttpRequest cannot load http://localhost:8000/inspector/resources/xhr-exists.html. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
 console-xhr-logging.html:10sending a GET request to resources/xhr-exists.html
 console-xhr-logging.html:10sending a GET request to resources/xhr-does-not-exist.html
-resources/xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
 console-xhr-logging.html:10sending a POST request to resources/post-target.cgi
 console-xhr-logging.html:10sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html
 XMLHttpRequest cannot load http://localhost:8000/inspector/resources/xhr-exists.html. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.

Modified: trunk/Source/WebCore/ChangeLog (94286 => 94287)


--- trunk/Source/WebCore/ChangeLog	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/Source/WebCore/ChangeLog	2011-09-01 12:16:10 UTC (rev 94287)
@@ -1,3 +1,27 @@
+2011-09-01  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Network error messages in console should link to the respective request in network panel if there is one.
+        https://bugs.webkit.org/show_bug.cgi?id=65550
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/ConsoleMessage.js:
+        (WebInspector.ConsoleMessage.prototype._formatMessage):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype.refresh):
+        (WebInspector.NetworkLogView.prototype.switchToBriefView):
+        (WebInspector.NetworkLogView.prototype.searchCanceled):
+        (WebInspector.NetworkLogView.prototype.revealAndHighlightResource):
+        (WebInspector.NetworkLogView.prototype._removeAllNodeHighlights):
+        (WebInspector.NetworkLogView.prototype._highlightNode):
+        (WebInspector.NetworkPanel.prototype._resourceByAnchor):
+        (WebInspector.NetworkPanel.prototype.canShowAnchorLocation):
+        (WebInspector.NetworkPanel.prototype.showAnchorLocation):
+        * inspector/front-end/networkLogView.css:
+        (.network-log-grid tr.highlighted-row):
+        (from):
+        (to):
+
 2011-09-01  Patrick Gansterer  <[email protected]>
 
         Replace preprocessor statements in DOMWindow.idl with Conditional attribute

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js (94286 => 94287)


--- trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js	2011-09-01 12:16:10 UTC (rev 94287)
@@ -80,6 +80,10 @@
     _formatMessage: function()
     {
         var stackTrace = this._stackTrace;
+
+        this._formattedMessage = document.createElement("span");
+        this._formattedMessage.className = "console-message-text source-code";
+        
         var messageText;
         switch (this.type) {
             case WebInspector.ConsoleMessage.MessageType.Trace:
@@ -94,13 +98,20 @@
 
                     messageText = document.createElement("span");
                     messageText.appendChild(document.createTextNode(this._request.requestMethod + " "));
-                    messageText.appendChild(WebInspector.linkifyURLAsNode(this._request.url));
+                    var anchor = WebInspector.linkifyURLAsNode(this._request.url);
+                    anchor.setAttribute("request_id", this._request.requestId);
+                    anchor.setAttribute("preferred_panel", "network");
+                    messageText.appendChild(anchor);
                     if (this._request.failed)
                         messageText.appendChild(document.createTextNode(" " + this._request.localizedFailDescription));
                     else
                         messageText.appendChild(document.createTextNode(" " + this._request.statusCode + " (" + this._request.statusText + ")"));
-                } else
+                } else {
+                    var isExternal = !WebInspector.resourceForURL(this.url);
+                    var anchor = WebInspector.linkifyURLAsNode(this.url, this.url, "console-message-url", isExternal);
+                    this._formattedMessage.appendChild(anchor);
                     messageText = this._format([this._messageText]);
+                }
                 break;
             case WebInspector.ConsoleMessage.MessageType.Assert:
                 var args = [WebInspector.UIString("Assertion failed:")];
@@ -119,15 +130,14 @@
                 break;
         }
 
-        this._formattedMessage = document.createElement("span");
-        this._formattedMessage.className = "console-message-text source-code";
-
-        if (this._stackTrace && this._stackTrace.length && this._stackTrace[0].url) {
-            var urlElement = this._linkifyCallFrame(this._stackTrace[0]);
-            this._formattedMessage.appendChild(urlElement);
-        } else if (this.url && this.url !== "undefined") {
-            var urlElement = this._linkifyLocation(this.url, this.line, 0);
-            this._formattedMessage.appendChild(urlElement);
+        if (this.type !== WebInspector.ConsoleMessage.MessageType.NetworkError) {
+            if (this._stackTrace && this._stackTrace.length && this._stackTrace[0].url) {
+                var urlElement = this._linkifyCallFrame(this._stackTrace[0]);
+                this._formattedMessage.appendChild(urlElement);
+            } else if (this.url && this.url !== "undefined") {
+                var urlElement = this._linkifyLocation(this.url, this.line, 0);
+                this._formattedMessage.appendChild(urlElement);
+            }
         }
 
         this._formattedMessage.appendChild(messageText);

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


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-09-01 12:16:10 UTC (rev 94287)
@@ -654,6 +654,7 @@
             delete this._refreshTimeout;
         }
 
+        this._removeAllNodeHighlights();
         var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow();
         var staleItemsLength = this._staleResources.length;
         var boundariesChanged = false;
@@ -848,6 +849,7 @@
     switchToBriefView: function()
     {
         this.element.addStyleClass("brief-mode");
+        this._removeAllNodeHighlights();
 
         this._dataGrid.hideColumn("method");
         this._dataGrid.hideColumn("status");
@@ -1222,6 +1224,32 @@
     {
         this._clearSearchMatchedList();
         this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.SearchCountUpdated, 0);
+    },
+    
+    revealAndHighlightResource: function(resource)
+    {
+        this._removeAllNodeHighlights();
+        
+        var node = this._resourceGridNode(resource);
+        if (node) {
+            this._dataGrid.element.focus();
+            node.reveal();
+            this._highlightNode(node);
+        }
+    },
+    
+    _removeAllNodeHighlights: function(node, decoration)
+    {
+        if (this._highlightedNode) {
+            this._highlightedNode.element.removeStyleClass("highlighted-row");
+            delete this._highlightedNode;
+        }
+    },
+    
+    _highlightNode: function(node)
+    {
+        node.element.addStyleClass("highlighted-row");
+        this._highlightedNode = node;
     }
 };
 
@@ -1330,14 +1358,29 @@
         return this._networkLogView.resourceById(id);
     },
 
+    _resourceByAnchor: function(anchor)
+    {
+        var resource;
+        if (anchor.getAttribute("request_id"))
+            resource = this.resourceById(anchor.getAttribute("request_id"));
+        if (!resource)
+            resource = this._resourcesByURL[anchor.href];
+
+        return resource;
+    },
+
     canShowAnchorLocation: function(anchor)
     {
-        return !!this.resourceById(anchor.href);
+        return !!this._resourceByAnchor(anchor);
     },
 
     showAnchorLocation: function(anchor)
     {
-        this._showResource(this._resourcesByURL[anchor.href]);
+        var resource = this._resourceByAnchor(anchor);
+
+        this._toggleGridMode();
+        if (resource)
+            this._networkLogView.revealAndHighlightResource(resource);
     },
 
     _onViewCleared: function(event)

Modified: trunk/Source/WebCore/inspector/front-end/networkLogView.css (94286 => 94287)


--- trunk/Source/WebCore/inspector/front-end/networkLogView.css	2011-09-01 12:06:25 UTC (rev 94286)
+++ trunk/Source/WebCore/inspector/front-end/networkLogView.css	2011-09-01 12:16:10 UTC (rev 94287)
@@ -125,6 +125,15 @@
     color: white;
 }
 
+.network-log-grid tr.highlighted-row {
+    -webkit-animation: "fadeout" 2s 0s;
+}
+
+@-webkit-keyframes fadeout {
+    from {background-color: rgba(56, 121, 217, 1); }
+    to { background-color: rgba(56, 121, 217, 0); }
+}
+
 .network-header-subtitle {
     color: gray;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to