Title: [101260] trunk
Revision
101260
Author
pfeld...@chromium.org
Date
2011-11-28 07:25:49 -0800 (Mon, 28 Nov 2011)

Log Message

Web Inspector: console evaluation doesn't work when navigating from a page with several frames to another one
https://bugs.webkit.org/show_bug.cgi?id=73210

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: http/tests/inspector/resource-tree/resource-tree-events.html

* inspector/Inspector.json:
* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel.prototype._frameDetached):
(WebInspector.ResourceTreeFrame.prototype.navigate):
(WebInspector.ResourceTreeFrame.prototype.removeChildFrame):
(WebInspector.ResourceTreeFrame.prototype.removeChildFrames):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101259 => 101260)


--- trunk/LayoutTests/ChangeLog	2011-11-28 14:45:26 UTC (rev 101259)
+++ trunk/LayoutTests/ChangeLog	2011-11-28 15:25:49 UTC (rev 101260)
@@ -1,3 +1,13 @@
+2011-11-28  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: console evaluation doesn't work when navigating from a page with several frames to another one
+        https://bugs.webkit.org/show_bug.cgi?id=73210
+
+        Reviewed by Yury Semikhatsky.
+
+        * http/tests/inspector/resource-tree/resource-tree-events-expected.txt: Added.
+        * http/tests/inspector/resource-tree/resource-tree-events.html: Added.
+
 2011-11-28  Mike Reed  <r...@google.com>
 
         add GPU to expectations for audio-repaint

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events-expected.txt (0 => 101260)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events-expected.txt	2011-11-28 15:25:49 UTC (rev 101260)
@@ -0,0 +1,18 @@
+Tests top frame navigation events.
+
+
+Navigating child frame 1
+    FrameAdded : child1
+    FrameNavigated : child1
+Navigating child frame 2
+    FrameAdded : child2
+    FrameNavigated : child2
+Detaching child frame 1
+    FrameDetached : child1
+Navigating root frame
+    FrameDetached : child2
+    FrameDetached : root1
+    FrameAdded : root2
+    FrameNavigated : root2
+    MainFrameNavigated : root2
+
Property changes on: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events.html (0 => 101260)


--- trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events.html	2011-11-28 15:25:49 UTC (rev 101260)
@@ -0,0 +1,73 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+
+<script>
+
+function test()
+{
+    InspectorTest.runAfterResourcesAreFinished(["dummy-iframe.html", "inspector-test.js", "resources-test.js", "resource-tree-test.js"], step1);
+
+    function step1()
+    {
+        WebInspector.resourceTreeModel._frontendReused = function() { return false; }
+        WebInspector.resourceTreeModel._frameNavigated(createFramePayload("root1"));
+
+        for (var eventName in WebInspector.ResourceTreeModel.EventTypes)
+            WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes[eventName], eventHandler.bind(this, eventName));
+    
+        function eventHandler(eventName, event)
+        {
+            switch (eventName) {
+            case "FrameAdded":
+            case "FrameNavigated":
+            case "FrameDetached":
+            case "MainFrameNavigated":
+                var frame = event.data;
+                InspectorTest.addResult("    " + eventName + " : " + frame.id);
+                break;
+            default:
+            }
+            
+        }
+
+        InspectorTest.addResult("Navigating child frame 1");
+        WebInspector.resourceTreeModel._frameNavigated(createFramePayload("child1", "root1"));
+        InspectorTest.addResult("Navigating child frame 2");
+        WebInspector.resourceTreeModel._frameNavigated(createFramePayload("child2", "root1"));
+        InspectorTest.addResult("Detaching child frame 1");
+        WebInspector.resourceTreeModel._frameDetached("child1");
+
+        InspectorTest.addResult("Navigating root frame");
+        WebInspector.resourceTreeModel._frameNavigated(createFramePayload("root2"));
+        InspectorTest.completeTest();
+    }
+
+    function createFramePayload(id, parentId)
+    {
+        var framePayload = {};
+        framePayload.id = id;
+        framePayload.parentId = parentId || "";
+        framePayload.loaderId = "loader-" + id;
+        framePayload.name = "frame-" + id;
+        framePayload.url = "" + id + ".html";
+        framePayload.mimeType = "text/html";
+        return framePayload;
+    }
+}
+
+</script>
+
+</head>
+
+<body>
+<p>
+Tests top frame navigation events.
+</p>
+
+<iframe src="" _onload_="runTest()">
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/resource-tree/resource-tree-events.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (101259 => 101260)


--- trunk/Source/WebCore/ChangeLog	2011-11-28 14:45:26 UTC (rev 101259)
+++ trunk/Source/WebCore/ChangeLog	2011-11-28 15:25:49 UTC (rev 101260)
@@ -1,5 +1,21 @@
 2011-11-28  Pavel Feldman  <pfeld...@google.com>
 
+        Web Inspector: console evaluation doesn't work when navigating from a page with several frames to another one
+        https://bugs.webkit.org/show_bug.cgi?id=73210
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: http/tests/inspector/resource-tree/resource-tree-events.html
+
+        * inspector/Inspector.json:
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel.prototype._frameDetached):
+        (WebInspector.ResourceTreeFrame.prototype.navigate):
+        (WebInspector.ResourceTreeFrame.prototype.removeChildFrame):
+        (WebInspector.ResourceTreeFrame.prototype.removeChildFrames):
+
+2011-11-28  Pavel Feldman  <pfeld...@google.com>
+
         Web Inspector: introduce InspectorBaseAgent.
         https://bugs.webkit.org/show_bug.cgi?id=73203
 

Modified: trunk/Source/WebCore/inspector/Inspector.json (101259 => 101260)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-11-28 14:45:26 UTC (rev 101259)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-11-28 15:25:49 UTC (rev 101260)
@@ -258,8 +258,7 @@
                 "name": "frameNavigated",
                 "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.",
                 "parameters": [
-                    { "name": "frame", "$ref": "Frame", "description": "Frame object." },
-                    { "name": "loaderId", "$ref": "Network.LoaderId", "description": "Loader identifier." }
+                    { "name": "frame", "$ref": "Frame", "description": "Frame object." }
                 ],
                 "hidden": true
             },

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (101259 => 101260)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-11-28 14:45:26 UTC (rev 101259)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-11-28 15:25:49 UTC (rev 101260)
@@ -602,7 +602,7 @@
         m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
         m_pendingScriptToEvaluateOnLoadOnce = String();
     }
-    m_frontend->frameNavigated(buildObjectForFrame(loader->frame()), loaderId(loader));
+    m_frontend->frameNavigated(buildObjectForFrame(loader->frame()));
 }
 
 void InspectorPageAgent::frameDetached(Frame* frame)

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


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-11-28 14:45:26 UTC (rev 101259)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-11-28 15:25:49 UTC (rev 101260)
@@ -121,7 +121,7 @@
         var frame = this._frames[framePayload.id];
         if (frame) {
             // Navigation within existing frame.
-            frame.navigate(framePayload);
+            frame._navigate(framePayload);
         } else {
             // Either a new frame or a main frame navigation to the new backend process. 
             var parentFrame = this._frames[framePayload.parentId];
@@ -169,10 +169,11 @@
         if (!frame)
             return;
 
-        if (frame.parentFrame) {
-            frame.parentFrame.removeChildFrame(frame);
-        } else {
+        if (frame.parentFrame)
+            frame.parentFrame._removeChildFrame(frame);
+        else {
             // Report that root is detached
+            frame._removeChildFrames();
             this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, frame);
         }
     },
@@ -416,7 +417,7 @@
     /**
      * @param {PageAgent.Frame} framePayload
      */
-    navigate: function(framePayload)
+    _navigate: function(framePayload)
     {
         this._loaderId = framePayload.loaderId;
         this._name = framePayload.name;
@@ -438,16 +439,8 @@
     /**
      * @param {WebInspector.ResourceTreeFrame} frame
      */
-    addChildFrame: function(frame)
+    _removeChildFrame: function(frame)
     {
-        this._childFrames.push(frame);
-    },
-
-    /**
-     * @param {WebInspector.ResourceTreeFrame} frame
-     */
-    removeChildFrame: function(frame)
-    {
         frame._removeChildFrames();
         this._childFrames.remove(frame);
         this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, frame);
@@ -457,7 +450,7 @@
     {
         var copy = this._childFrames.slice();
         for (var i = 0; i < copy.length; ++i)
-            this.removeChildFrame(copy[i]); 
+            this._removeChildFrame(copy[i]); 
     },
 
     /**
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to