Title: [92698] trunk
Revision
92698
Author
vse...@chromium.org
Date
2011-08-09 12:29:21 -0700 (Tue, 09 Aug 2011)

Log Message

Web Inspector: XHRs end up in the resources panel.
https://bugs.webkit.org/show_bug.cgi?id=60321

Reviewed by Pavel Feldman.

Source/WebCore:

Test: http/tests/inspector/resource-tree/resource-tree-no-xhrs.html

* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel.prototype._onResourceUpdated):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel):

LayoutTests:

* http/tests/inspector/console-xhr-logging-expected.txt:
* http/tests/inspector/resource-tree/resource-tree-no-xhrs-expected.txt: Added.
* http/tests/inspector/resource-tree/resource-tree-no-xhrs.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92697 => 92698)


--- trunk/LayoutTests/ChangeLog	2011-08-09 19:27:24 UTC (rev 92697)
+++ trunk/LayoutTests/ChangeLog	2011-08-09 19:29:21 UTC (rev 92698)
@@ -1,3 +1,14 @@
+2011-08-09  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: XHRs end up in the resources panel.
+        https://bugs.webkit.org/show_bug.cgi?id=60321
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/console-xhr-logging-expected.txt:
+        * http/tests/inspector/resource-tree/resource-tree-no-xhrs-expected.txt: Added.
+        * http/tests/inspector/resource-tree/resource-tree-no-xhrs.html: Added.
+
 2011-08-08  Adrienne Walker  <e...@google.com>
 
         Add testing for --force-compositing-mode to windows.internal

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


--- trunk/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt	2011-08-09 19:27:24 UTC (rev 92697)
+++ trunk/LayoutTests/http/tests/inspector/console-xhr-logging-expected.txt	2011-08-09 19:29:21 UTC (rev 92698)
@@ -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
-xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+resources/xhr-does-not-exist.htmlGET 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
-xhr-does-not-exist.htmlGET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found)
+resources/xhr-does-not-exist.htmlGET 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.

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs-expected.txt (0 => 92698)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs-expected.txt	2011-08-09 19:29:21 UTC (rev 92698)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 13: Done.
+Tests that XHRs are not added to resourceTreeModel.
+
+Bug 60321

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs.html (0 => 92698)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-no-xhrs.html	2011-08-09 19:29:21 UTC (rev 92698)
@@ -0,0 +1,34 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function sendXHR()
+{
+    doXHR("GET", "resources/resource.php", false, resourceLoaded);
+}
+
+function resourceLoaded()
+{
+    console.log("Done.");
+}
+
+function test()
+{
+    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.evaluateInPage("sendXHR()");
+
+    function step2()
+    {
+        var resource = WebInspector.resourceTreeModel.resourceForURL("http://127.0.0.1:8000/inspector/resource-tree/resources/resource.php");
+        InspectorTest.assertTrue(!resource, "XHR resource should not be added to resourceTreeModel.");
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that XHRs are not added to resourceTreeModel.</p>
+<a href="" 60321</a>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (92697 => 92698)


--- trunk/Source/WebCore/ChangeLog	2011-08-09 19:27:24 UTC (rev 92697)
+++ trunk/Source/WebCore/ChangeLog	2011-08-09 19:29:21 UTC (rev 92698)
@@ -1,3 +1,17 @@
+2011-08-09  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: XHRs end up in the resources panel.
+        https://bugs.webkit.org/show_bug.cgi?id=60321
+
+        Reviewed by Pavel Feldman.
+
+        Test: http/tests/inspector/resource-tree/resource-tree-no-xhrs.html
+
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel.prototype._onResourceUpdated):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+
 2011-08-08  Adrienne Walker  <e...@google.com>
 
         Add testing for --force-compositing-mode to windows.internal

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


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-08-09 19:27:24 UTC (rev 92697)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-08-09 19:29:21 UTC (rev 92698)
@@ -194,6 +194,11 @@
             return;
         }
 
+        if (resource.type === WebInspector.Resource.Type.XHR) {
+            this._unbindResourceURL(resource);
+            return;
+        }
+                
         if (resource.finished)
             this._addResourceToFrame(resource);
     },

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (92697 => 92698)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-08-09 19:27:24 UTC (rev 92697)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-08-09 19:29:21 UTC (rev 92698)
@@ -77,8 +77,6 @@
 
     this.registerShortcuts();
 
-    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._refreshResource, this);
-
     WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this);
 }
 
@@ -263,17 +261,6 @@
         this._initDefaultSelection();
     },
 
-    _refreshResource: function(event)
-    {
-        var resource = event.data;
-        // FIXME: do not add XHR in the first place based on the native instrumentation.
-        if (resource.type === WebInspector.Resource.Type.XHR) {
-            var resourceTreeElement = this._findTreeElementForResource(resource);
-            if (resourceTreeElement)
-                resourceTreeElement.parent.removeChild(resourceTreeElement);
-        }
-    },
-
     addDatabase: function(database)
     {
         this._databases.push(database);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to