Title: [92776] trunk
Revision
92776
Author
vse...@chromium.org
Date
2011-08-10 10:56:08 -0700 (Wed, 10 Aug 2011)

Log Message

Web Inspector: console messages markers are lost in Resources panel after page reload
https://bugs.webkit.org/show_bug.cgi?id=60701

Reviewed by Pavel Feldman.

Source/WebCore:

Test: http/tests/inspector/resource-tree/resource-tree-errors-reload.html

* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel):
(WebInspector.ResourceTreeModel.prototype._consoleMessageAdded):
(WebInspector.ResourceTreeModel.prototype._addPendingConsoleMessage):
(WebInspector.ResourceTreeModel.prototype._addPendingConsoleMessagesToResource):
(WebInspector.ResourceTreeModel.prototype._addConsoleMessageToResource):
(WebInspector.ResourceTreeModel.prototype._consoleCleared):
(WebInspector.ResourceTreeModel.prototype._bindResourceURL):

LayoutTests:

* http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt: Added.
* http/tests/inspector/resource-tree/resource-tree-errors-reload.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92775 => 92776)


--- trunk/LayoutTests/ChangeLog	2011-08-10 17:08:47 UTC (rev 92775)
+++ trunk/LayoutTests/ChangeLog	2011-08-10 17:56:08 UTC (rev 92776)
@@ -1,3 +1,13 @@
+2011-08-10  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: console messages markers are lost in Resources panel after page reload
+        https://bugs.webkit.org/show_bug.cgi?id=60701
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt: Added.
+        * http/tests/inspector/resource-tree/resource-tree-errors-reload.html: Added.
+
 2011-08-10  Adam Barth  <aba...@webkit.org>
 
         Update expectations for this test.  It's just a minor flake.

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt (0 => 92776)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt	2011-08-10 17:56:08 UTC (rev 92776)
@@ -0,0 +1,10 @@
+CONSOLE MESSAGE: line 4: Console error 1.
+CONSOLE MESSAGE: line 5: Console error 2.
+CONSOLE MESSAGE: line 4: Console error 1.
+CONSOLE MESSAGE: line 5: Console error 2.
+Tests that console messages are matched to resources after page reload.
+
+Bug 60701
+Page reloaded.
+Number of errors for the main resource: 2
+
Property changes on: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload.html (0 => 92776)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload.html	2011-08-10 17:56:08 UTC (rev 92776)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<script>
+console.error("Console error 1.");
+console.error("Console error 2.");
+</script>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    InspectorTest.reloadPage(step1);
+
+    function step1()
+    {
+        var resource = WebInspector.resourceTreeModel.resourceForURL("http://127.0.0.1:8000/inspector/resource-tree/resource-tree-errors-reload.html");
+        InspectorTest.addResult("Number of errors for the main resource: " + resource.errors);
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that console messages are matched to resources after page reload.</p>
+<a href="" 60701</a>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-errors-reload.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (92775 => 92776)


--- trunk/Source/WebCore/ChangeLog	2011-08-10 17:08:47 UTC (rev 92775)
+++ trunk/Source/WebCore/ChangeLog	2011-08-10 17:56:08 UTC (rev 92776)
@@ -1,3 +1,21 @@
+2011-08-10  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: console messages markers are lost in Resources panel after page reload
+        https://bugs.webkit.org/show_bug.cgi?id=60701
+
+        Reviewed by Pavel Feldman.
+
+        Test: http/tests/inspector/resource-tree/resource-tree-errors-reload.html
+
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel):
+        (WebInspector.ResourceTreeModel.prototype._consoleMessageAdded):
+        (WebInspector.ResourceTreeModel.prototype._addPendingConsoleMessage):
+        (WebInspector.ResourceTreeModel.prototype._addPendingConsoleMessagesToResource):
+        (WebInspector.ResourceTreeModel.prototype._addConsoleMessageToResource):
+        (WebInspector.ResourceTreeModel.prototype._consoleCleared):
+        (WebInspector.ResourceTreeModel.prototype._bindResourceURL):
+
 2011-08-10  Lars Knudsen  <lars.knud...@nokia.com>
 
         Add device specific settings to support viewport computing

Modified: trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js (92775 => 92776)


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-08-10 17:08:47 UTC (rev 92775)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-08-10 17:56:08 UTC (rev 92776)
@@ -40,6 +40,8 @@
 
     this.frontendReused();
     InspectorBackend.registerDomainDispatcher("Page", new WebInspector.PageDispatcher(this));
+    
+    this._pendingConsoleMessages = {};
 }
 
 WebInspector.ResourceTreeModel.EventTypes = {
@@ -230,9 +232,33 @@
     {
         var msg = event.data;
         var resource = this.resourceForURL(msg.url);
-        if (!resource)
+        if (resource)
+            this._addConsoleMessageToResource(msg, resource);
+        else
+            this._addPendingConsoleMessage(msg);
+    },
+
+    _addPendingConsoleMessage: function(msg)
+    {
+        if (!msg.url)
             return;
+        if (!this._pendingConsoleMessages[msg.url])
+            this._pendingConsoleMessages[msg.url] = [];
+        this._pendingConsoleMessages[msg.url].push(msg);
+    },
 
+    _addPendingConsoleMessagesToResource: function(resource)
+    {
+        var messages = this._pendingConsoleMessages[resource.url];
+        if (messages) {
+            for (var i = 0; i < messages.length; i++)
+                this._addConsoleMessageToResource(messages[i], resource);
+            delete this._pendingConsoleMessages[resource.url];
+        }
+    },
+
+    _addConsoleMessageToResource: function(msg, resource)
+    {
         switch (msg.level) {
         case WebInspector.ConsoleMessage.MessageLevel.Warning:
             resource.warnings += msg.repeatDelta;
@@ -250,6 +276,8 @@
         {
             resource.clearErrorsAndWarnings();
         }
+        
+        this._pendingConsoleMessages = {};
         this.forAllResources(callback);
     },
 
@@ -261,6 +289,8 @@
     _bindResourceURL: function(resource)
     {
         this._resourcesByURL[resource.url] = resource;
+        
+        this._addPendingConsoleMessagesToResource(resource);
     },
 
     _clearChildFramesAndResources: function(frameId, loaderToPreserveId)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to