Changeset 87681 in webkit


Ignore:
Timestamp:
May 30, 2011 2:18:16 AM (13 years ago)
Author:
caseq@chromium.org
Message:

011-05-30 Andrey Kosyakov <caseq@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):
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87680 r87681  
     12011-05-30  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: do not issue frontendReused for reload or navigation.
     6        https://bugs.webkit.org/show_bug.cgi?id=61192
     7
     8       - only issue frontendReused when inspector is attached after main resource committed load
     9       - upon committing loading main resource, reset agents before sending FrameNavigated to page agent
     10       - Ensure main resource is set early so that abbreviations of URLs in resource tree are consistent after reload
     11       - do not enable agents explicitly in frontendReused (this is done by backend when resotring state from cookie)
     12
     13        * inspector/InspectorAgent.cpp:
     14        (WebCore::InspectorAgent::InspectorAgent):
     15        (WebCore::InspectorAgent::restore):
     16        (WebCore::InspectorAgent::clearFrontend):
     17        (WebCore::InspectorAgent::didCommitLoad):
     18        * inspector/InspectorAgent.h:
     19        * inspector/InspectorInstrumentation.cpp:
     20        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
     21        * inspector/front-end/NetworkManager.js:
     22        * inspector/front-end/ResourceTreeModel.js:
     23        (WebInspector.ResourceTreeModel.prototype._processCachedResources):
     24        (WebInspector.ResourceTreeModel.prototype._frameNavigated):
     25        (WebInspector.ResourceTreeModel.prototype._cleanupFramesAfterNavigation):
     26        (WebInspector.ResourceTreeModel.prototype._addFramesRecursively):
     27        * inspector/front-end/ResourcesPanel.js:
     28        (WebInspector.ResourcesPanel.prototype.reset):
     29        (WebInspector.ResourcesPanel.prototype._resetResourcesTree):
     30        (WebInspector.DatabaseTreeElement.prototype.onpopulate):
     31        (WebInspector.SearchResultsTreeElementsTraverser.prototype._lastTreeElement):
     32        * inspector/front-end/inspector.js:
     33        (WebInspector.reset):
     34        (WebInspector.frontendReused):
     35
    1362011-05-30  Ryan Sleevi  <rsleevi@chromium.org>
    237
  • trunk/Source/WebCore/inspector/InspectorAgent.cpp

    r86564 r87681  
    6868    , m_injectedScriptManager(injectedScriptManager)
    6969    , m_canIssueEvaluateForTestInFrontend(false)
     70    , m_didCommitLoadFired(false)
    7071{
    7172    ASSERT_ARG(page, page);
     
    9192void InspectorAgent::restore()
    9293{
    93     m_frontend->inspector()->frontendReused();
     94    if (m_didCommitLoadFired)
     95        m_frontend->inspector()->frontendReused();
    9496}
    9597
     
    128130    m_pendingEvaluateTestCommands.clear();
    129131    m_frontend = 0;
     132    m_didCommitLoadFired = false;
    130133}
    131134
    132135void InspectorAgent::didCommitLoad()
    133136{
     137    m_didCommitLoadFired = true;
    134138    if (m_frontend)
    135139        m_frontend->inspector()->reset();
  • trunk/Source/WebCore/inspector/InspectorAgent.h

    r86564 r87681  
    125125#endif
    126126    bool m_canIssueEvaluateForTestInFrontend;
     127    bool m_didCommitLoadFired;
    127128};
    128129
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r86752 r87681  
    574574        return;
    575575
     576    Frame* mainFrame = page->mainFrame();
     577    if (loader->frame() == mainFrame) {
     578        if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
     579            consoleAgent->reset();
     580#if ENABLE(JAVASCRIPT_DEBUGGER)
     581        if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
     582            KURL url = inspectorAgent->inspectedURLWithoutFragment();
     583            debuggerAgent->inspectedURLChanged(url);
     584        }
     585#endif
     586#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
     587        if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
     588            profilerAgent->stopUserInitiatedProfiling(true);
     589            profilerAgent->resetState();
     590        }
     591#endif
     592        if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
     593            cssAgent->reset();
     594#if ENABLE(DATABASE)
     595        if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
     596            databaseAgent->clearResources();
     597#endif
     598#if ENABLE(DOM_STORAGE)
     599        if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
     600            domStorageAgent->clearResources();
     601#endif
     602        if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
     603            domAgent->setDocument(mainFrame->document());
     604
     605        inspectorAgent->didCommitLoad();
     606    }
    576607    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
    577608        pageAgent->frameNavigated(loader);
    578 
    579     Frame* mainFrame = page->mainFrame();
    580     if (loader->frame() != mainFrame)
    581         return;
    582 
    583     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
    584         consoleAgent->reset();
    585 #if ENABLE(JAVASCRIPT_DEBUGGER)
    586     if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
    587         KURL url = inspectorAgent->inspectedURLWithoutFragment();
    588         debuggerAgent->inspectedURLChanged(url);
    589     }
    590 #endif
    591 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
    592     if (InspectorProfilerAgent* profilerAgent = instrumentingAgents->inspectorProfilerAgent()) {
    593         profilerAgent->stopUserInitiatedProfiling(true);
    594         profilerAgent->resetState();
    595     }
    596 #endif
    597     if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
    598         cssAgent->reset();
    599 #if ENABLE(DATABASE)
    600     if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
    601         databaseAgent->clearResources();
    602 #endif
    603 #if ENABLE(DOM_STORAGE)
    604     if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
    605         domStorageAgent->clearResources();
    606 #endif
    607     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
    608         domAgent->setDocument(mainFrame->document());
    609 
    610     inspectorAgent->didCommitLoad();
    611609}
    612610
  • trunk/Source/WebCore/inspector/front-end/NetworkManager.js

    r86752 r87681  
    4343
    4444WebInspector.NetworkManager.prototype = {
    45     frontendReused: function()
    46     {
    47         NetworkAgent.enable();
    48     },
    49 
    5045    requestContent: function(resource, base64Encode, callback)
    5146    {
  • trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js

    r87383 r87681  
    7474
    7575        this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);
    76         WebInspector.mainResource = this._addFramesRecursively(mainFramePayload);
     76        this._addFramesRecursively(mainFramePayload);
    7777        this._dispatchInspectedURLChanged(WebInspector.mainResource.url);
    7878        this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);
     
    102102    },
    103103
    104     frames: function(parentFrameId)
    105     {
    106         return this._subframes[parentFrameId] || [];
    107     },
    108 
    109104    subframes: function(parentFrameId)
    110105    {
     
    123118    _frameNavigated: function(frame, loaderId)
    124119    {
     120        var isMainFrame = !frame.parentId;
     121
     122        if (isMainFrame) {
     123            this._cleanupFramesAfterNavigation(frame);
     124            if (this.resourceForURL(frame.url))
     125                WebInspector.mainResource = this.resourceForURL(frame.url);
     126        }
    125127        // Do nothing unless cached resource tree is processed - it will overwrite everything.
    126128        if (!this._cachedResourcesProcessed)
     
    130132        if (!this._frameIds[frame.id])
    131133            this._addFrame(frame);
    132         else
     134        else {
    133135            this._clearChildFramesAndResources(frame.id, loaderId);
    134 
    135 
    136         var isMainFrame = !frame.parentId;
    137 
     136            frame.parentId = frame.parentId || "";
     137            this._frameIds[frame.id] = frame;
     138        }
    138139        // Dispatch frame navigated event to clients prior to filling it with the resources.
    139140        this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, { frame: frame, loaderId: loaderId, isMainFrame: isMainFrame });
     
    146147        }
    147148
    148         // Update main frame, issue top-level navigate events.
    149         if (isMainFrame && this.resourceForURL(frame.url)) {
    150             WebInspector.mainResource = this.resourceForURL(frame.url);
     149        if (isMainFrame)
    151150            this._dispatchInspectedURLChanged(frame.url);
     151    },
     152
     153    _cleanupFramesAfterNavigation: function(newMainFrame)
     154    {
     155        for (var frameId in this._frameIds) {
     156            if (frameId !== newMainFrame.id)
     157                this._frameDetached(frameId);
    152158        }
    153159    },
     
    318324        frameResource.finished = true;
    319325
     326        if (!framePayload.parentId)
     327            WebInspector.mainResource = frameResource;
    320328        this._addFrame(framePayload);
    321329        this._addResourceToFrame(frameResource);
     
    335343            this._addResourceToFrame(resource);
    336344        }
    337         return frameResource;
    338345    },
    339346
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r87383 r87681  
    131131    },
    132132
    133     _reset: function()
     133    reset: function()
    134134    {
    135135        delete this._initializedDefaultSelection;
     
    256256        this.resourcesListTreeElement.removeChildren();
    257257        this._treeElementForFrameId = {};
    258         this._reset();
     258        this.reset();
    259259    },
    260260
     
    10271027    }
    10281028}
     1029
    10291030WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
    10301031
     
    14551456        this._database.getTableNames(tableNamesCallback.bind(this));
    14561457    }
    1457 
    1458 }
     1458}
     1459
    14591460WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
    14601461
     
    17301731            treeElement = nextTreeElement;
    17311732        return treeElement;       
    1732     },
    1733 }
     1733    }
     1734}
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r86932 r87681  
    974974{
    975975    this.debuggerModel.reset();
    976 
    977976    for (var panelName in this.panels) {
    978977        var panel = this.panels[panelName];
     
    13571356WebInspector.frontendReused = function()
    13581357{
    1359     ConsoleAgent.enable(this.console.setConsoleMessageExpiredCount.bind(this.console));
    1360     DatabaseAgent.enable();
    1361     DOMStorageAgent.enable();
    1362 
    1363     this.networkManager.frontendReused();
    13641358    this.resourceTreeModel.frontendReused();
    1365     WebInspector.panels.network.clear();
    13661359    this.reset();
    13671360}
Note: See TracChangeset for help on using the changeset viewer.