Title: [87681] trunk/Source/WebCore
Revision
87681
Author
ca...@chromium.org
Date
2011-05-30 02:18:16 -0700 (Mon, 30 May 2011)

Log Message

011-05-30  Andrey Kosyakov  <ca...@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: do not issue frontendReused for reload or navigation.
        https://bugs.webkit.org/show_bug.cgi?id=61192

       - only issue frontendReused when inspector is attached after main resource committed load
       - upon committing loading main resource, reset agents before sending FrameNavigated to page agent
       - Ensure main resource is set early so that abbreviations of URLs in resource tree are consistent after reload
       - do not enable agents explicitly in frontendReused (this is done by backend when resotring state from cookie)

        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::InspectorAgent):
        (WebCore::InspectorAgent::restore):
        (WebCore::InspectorAgent::clearFrontend):
        (WebCore::InspectorAgent::didCommitLoad):
        * inspector/InspectorAgent.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
        * inspector/front-end/NetworkManager.js:
        * inspector/front-end/ResourceTreeModel.js:
        (WebInspector.ResourceTreeModel.prototype._processCachedResources):
        (WebInspector.ResourceTreeModel.prototype._frameNavigated):
        (WebInspector.ResourceTreeModel.prototype._cleanupFramesAfterNavigation):
        (WebInspector.ResourceTreeModel.prototype._addFramesRecursively):
        * inspector/front-end/ResourcesPanel.js:
        (WebInspector.ResourcesPanel.prototype.reset):
        (WebInspector.ResourcesPanel.prototype._resetResourcesTree):
        (WebInspector.DatabaseTreeElement.prototype.onpopulate):
        (WebInspector.SearchResultsTreeElementsTraverser.prototype._lastTreeElement):
        * inspector/front-end/inspector.js:
        (WebInspector.reset):
        (WebInspector.frontendReused):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87680 => 87681)


--- trunk/Source/WebCore/ChangeLog	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/ChangeLog	2011-05-30 09:18:16 UTC (rev 87681)
@@ -1,3 +1,38 @@
+2011-05-30  Andrey Kosyakov  <ca...@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: do not issue frontendReused for reload or navigation.
+        https://bugs.webkit.org/show_bug.cgi?id=61192
+
+       - only issue frontendReused when inspector is attached after main resource committed load
+       - upon committing loading main resource, reset agents before sending FrameNavigated to page agent
+       - Ensure main resource is set early so that abbreviations of URLs in resource tree are consistent after reload
+       - do not enable agents explicitly in frontendReused (this is done by backend when resotring state from cookie)
+
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::InspectorAgent):
+        (WebCore::InspectorAgent::restore):
+        (WebCore::InspectorAgent::clearFrontend):
+        (WebCore::InspectorAgent::didCommitLoad):
+        * inspector/InspectorAgent.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+        * inspector/front-end/NetworkManager.js:
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel.prototype._processCachedResources):
+        (WebInspector.ResourceTreeModel.prototype._frameNavigated):
+        (WebInspector.ResourceTreeModel.prototype._cleanupFramesAfterNavigation):
+        (WebInspector.ResourceTreeModel.prototype._addFramesRecursively):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype._resetResourcesTree):
+        (WebInspector.DatabaseTreeElement.prototype.onpopulate):
+        (WebInspector.SearchResultsTreeElementsTraverser.prototype._lastTreeElement):
+        * inspector/front-end/inspector.js:
+        (WebInspector.reset):
+        (WebInspector.frontendReused):
+
 2011-05-30  Ryan Sleevi  <rsle...@chromium.org>
 
         Reviewed by Darin Adler.

Modified: trunk/Source/WebCore/inspector/InspectorAgent.cpp (87680 => 87681)


--- trunk/Source/WebCore/inspector/InspectorAgent.cpp	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/InspectorAgent.cpp	2011-05-30 09:18:16 UTC (rev 87681)
@@ -67,6 +67,7 @@
     , m_instrumentingAgents(instrumentingAgents)
     , m_injectedScriptManager(injectedScriptManager)
     , m_canIssueEvaluateForTestInFrontend(false)
+    , m_didCommitLoadFired(false)
 {
     ASSERT_ARG(page, page);
     m_instrumentingAgents->setInspectorAgent(this);
@@ -90,7 +91,8 @@
 
 void InspectorAgent::restore()
 {
-    m_frontend->inspector()->frontendReused();
+    if (m_didCommitLoadFired)
+        m_frontend->inspector()->frontendReused();
 }
 
 void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
@@ -127,10 +129,12 @@
     m_canIssueEvaluateForTestInFrontend = false;
     m_pendingEvaluateTestCommands.clear();
     m_frontend = 0;
+    m_didCommitLoadFired = false;
 }
 
 void InspectorAgent::didCommitLoad()
 {
+    m_didCommitLoadFired = true;
     if (m_frontend)
         m_frontend->inspector()->reset();
 

Modified: trunk/Source/WebCore/inspector/InspectorAgent.h (87680 => 87681)


--- trunk/Source/WebCore/inspector/InspectorAgent.h	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/InspectorAgent.h	2011-05-30 09:18:16 UTC (rev 87681)
@@ -124,6 +124,7 @@
     WorkersMap m_workers;
 #endif
     bool m_canIssueEvaluateForTestInFrontend;
+    bool m_didCommitLoadFired;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (87680 => 87681)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2011-05-30 09:18:16 UTC (rev 87681)
@@ -573,41 +573,39 @@
     if (!inspectorAgent || !inspectorAgent->enabled())
         return;
 
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
-        pageAgent->frameNavigated(loader);
-
     Frame* mainFrame = page->mainFrame();
-    if (loader->frame() != mainFrame)
-        return;
-
-    if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
-        consoleAgent->reset();
+    if (loader->frame() == mainFrame) {
+        if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
+            consoleAgent->reset();
 #if ENABLE(_javascript__DEBUGGER)
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
-        KURL url = ""
-        debuggerAgent->inspectedURLChanged(url);
-    }
+        if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+            KURL url = ""
+            debuggerAgent->inspectedURLChanged(url);
+        }
 #endif
 #if ENABLE(_javascript__DEBUGGER) && USE(JSC)
-    if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
-        profilerAgent->stopUserInitiatedProfiling(true);
-        profilerAgent->resetState();
-    }
+        if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
+            profilerAgent->stopUserInitiatedProfiling(true);
+            profilerAgent->resetState();
+        }
 #endif
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->reset();
+        if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
+            cssAgent->reset();
 #if ENABLE(DATABASE)
-    if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
-        databaseAgent->clearResources();
+        if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
+            databaseAgent->clearResources();
 #endif
 #if ENABLE(DOM_STORAGE)
-    if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
-        domStorageAgent->clearResources();
+        if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
+            domStorageAgent->clearResources();
 #endif
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->setDocument(mainFrame->document());
+        if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+            domAgent->setDocument(mainFrame->document());
 
-    inspectorAgent->didCommitLoad();
+        inspectorAgent->didCommitLoad();
+    }
+    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+        pageAgent->frameNavigated(loader);
 }
 
 InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned int length, unsigned int startLine)

Modified: trunk/Source/WebCore/inspector/front-end/NetworkManager.js (87680 => 87681)


--- trunk/Source/WebCore/inspector/front-end/NetworkManager.js	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/front-end/NetworkManager.js	2011-05-30 09:18:16 UTC (rev 87681)
@@ -42,11 +42,6 @@
 }
 
 WebInspector.NetworkManager.prototype = {
-    frontendReused: function()
-    {
-        NetworkAgent.enable();
-    },
-
     requestContent: function(resource, base64Encode, callback)
     {
         function callbackWrapper(error, content)

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


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-05-30 09:18:16 UTC (rev 87681)
@@ -73,7 +73,7 @@
         }
 
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);
-        WebInspector.mainResource = this._addFramesRecursively(mainFramePayload);
+        this._addFramesRecursively(mainFramePayload);
         this._dispatchInspectedURLChanged(WebInspector.mainResource.url);
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);
         WebInspector.Resource.restoreRevisions();
@@ -101,11 +101,6 @@
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, frame);
     },
 
-    frames: function(parentFrameId)
-    {
-        return this._subframes[parentFrameId] || [];
-    },
-
     subframes: function(parentFrameId)
     {
         return this._subframes[parentFrameId] || [];
@@ -122,6 +117,13 @@
 
     _frameNavigated: function(frame, loaderId)
     {
+        var isMainFrame = !frame.parentId;
+
+        if (isMainFrame) {
+            this._cleanupFramesAfterNavigation(frame);
+            if (this.resourceForURL(frame.url))
+                WebInspector.mainResource = this.resourceForURL(frame.url);
+        }
         // Do nothing unless cached resource tree is processed - it will overwrite everything.
         if (!this._cachedResourcesProcessed)
             return;
@@ -129,12 +131,11 @@
         // Add frame in case it is seen for the first time, otherwise, do a within-frame cleanup.
         if (!this._frameIds[frame.id])
             this._addFrame(frame);
-        else
+        else {
             this._clearChildFramesAndResources(frame.id, loaderId);
-
-
-        var isMainFrame = !frame.parentId;
-
+            frame.parentId = frame.parentId || "";
+            this._frameIds[frame.id] = frame;
+        }
         // Dispatch frame navigated event to clients prior to filling it with the resources. 
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, { frame: frame, loaderId: loaderId, isMainFrame: isMainFrame });
 
@@ -145,10 +146,15 @@
                 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, resourcesForFrame[url]);
         }
 
-        // Update main frame, issue top-level navigate events. 
-        if (isMainFrame && this.resourceForURL(frame.url)) {
-            WebInspector.mainResource = this.resourceForURL(frame.url);
+        if (isMainFrame)
             this._dispatchInspectedURLChanged(frame.url);
+    },
+
+    _cleanupFramesAfterNavigation: function(newMainFrame)
+    {
+        for (var frameId in this._frameIds) {
+            if (frameId !== newMainFrame.id)
+                this._frameDetached(frameId);
         }
     },
 
@@ -317,6 +323,8 @@
         frameResource.type = WebInspector.Resource.Type.Document;
         frameResource.finished = true;
 
+        if (!framePayload.parentId)
+            WebInspector.mainResource = frameResource;
         this._addFrame(framePayload);
         this._addResourceToFrame(frameResource);
 
@@ -334,7 +342,6 @@
             resource.finished = true;
             this._addResourceToFrame(resource);
         }
-        return frameResource;
     },
 
     _createResource: function(frame, url)

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


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-05-30 09:18:16 UTC (rev 87681)
@@ -130,7 +130,7 @@
             this.showResource(WebInspector.mainResource);
     },
 
-    _reset: function()
+    reset: function()
     {
         delete this._initializedDefaultSelection;
         this._origins = {};
@@ -255,7 +255,7 @@
     {
         this.resourcesListTreeElement.removeChildren();
         this._treeElementForFrameId = {};
-        this._reset();
+        this.reset();
     },
 
     _cachedResourcesLoaded: function()
@@ -1026,6 +1026,7 @@
         WebInspector.settings[this._expandedSettingKey] = false;
     }
 }
+
 WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
 
 WebInspector.FrameTreeElement = function(storagePanel, frame)
@@ -1454,8 +1455,8 @@
         }
         this._database.getTableNames(tableNamesCallback.bind(this));
     }
+}
 
-}
 WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
 
 WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
@@ -1729,5 +1730,5 @@
         while (nextTreeElement = this._traverseNext(treeElement))
             treeElement = nextTreeElement;
         return treeElement;        
-    },
+    }
 }

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (87680 => 87681)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-05-30 08:30:17 UTC (rev 87680)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-05-30 09:18:16 UTC (rev 87681)
@@ -973,7 +973,6 @@
 WebInspector.reset = function()
 {
     this.debuggerModel.reset();
-
     for (var panelName in this.panels) {
         var panel = this.panels[panelName];
         if ("reset" in panel)
@@ -1356,13 +1355,7 @@
 
 WebInspector.frontendReused = function()
 {
-    ConsoleAgent.enable(this.console.setConsoleMessageExpiredCount.bind(this.console));
-    DatabaseAgent.enable();
-    DOMStorageAgent.enable();
-
-    this.networkManager.frontendReused();
     this.resourceTreeModel.frontendReused();
-    WebInspector.panels.network.clear();
     this.reset();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to