Changeset 70445 in webkit


Ignore:
Timestamp:
Oct 25, 2010 2:36:59 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-10-24 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: add support for errors, warnings and search to the storage panel.
https://bugs.webkit.org/show_bug.cgi?id=48206

  • inspector/front-end/ConsoleView.js: (WebInspector.ConsoleView.prototype.addMessage): (WebInspector.ConsoleView.prototype.clearMessages):
  • inspector/front-end/Resource.js: (WebInspector.Resource.prototype.set errors): (WebInspector.Resource.prototype.set warnings): (WebInspector.Resource.prototype.get searchMatches): (WebInspector.Resource.prototype.set searchMatches): (WebInspector.Resource.prototype.clearErrorsAndWarnings):
  • inspector/front-end/ResourceManager.js: (WebInspector.ResourceManager): (WebInspector.ResourceManager.prototype.identifierForInitialRequest): (WebInspector.ResourceManager.prototype._createResource): (WebInspector.ResourceManager.prototype._appendRedirect): (WebInspector.ResourceManager.prototype.didReceiveResponse): (WebInspector.ResourceManager.prototype.didFinishLoading): (WebInspector.ResourceManager.prototype.didFailLoading): (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache): (WebInspector.ResourceManager.prototype.didCommitLoadForFrame): (WebInspector.ResourceManager.prototype.frameDetachedFromParent): (WebInspector.ResourceManager.prototype._addFramesRecursively): (WebInspector.ResourceManager.prototype.resourceForURL): (WebInspector.ResourceManager.prototype.addConsoleMessage): (WebInspector.ResourceManager.prototype.clearConsoleMessages): (WebInspector.ResourceTreeModel): (WebInspector.ResourceTreeModel.prototype.addOrUpdateFrame): (WebInspector.ResourceTreeModel.prototype.didCommitLoadForFrame): (WebInspector.ResourceTreeModel.prototype.frameDetachedFromParent): (WebInspector.ResourceTreeModel.prototype._clearChildFramesAndResources): (WebInspector.ResourceTreeModel.prototype.addResourceToFrame): (WebInspector.ResourceTreeModel.prototype._clearResources): (WebInspector.ResourceTreeModel.prototype._bindResourceURL): (WebInspector.ResourceTreeModel.prototype._unbindResourceURL): (WebInspector.ResourceTreeModel.prototype.resourceForURL): (WebInspector.ResourceTreeModel.prototype.forAllResources): (WebInspector.ResourceTreeModel.prototype._callForFrameResources):
  • inspector/front-end/StoragePanel.js: (WebInspector.StoragePanel): (WebInspector.StoragePanel.prototype.get toolbarItemLabel): (WebInspector.StoragePanel.prototype.reset): (WebInspector.StoragePanel.prototype.removeFrame): (WebInspector.StoragePanel.prototype.canShowSourceLine): (WebInspector.StoragePanel.prototype.showSourceLine): (WebInspector.StoragePanel.prototype.showResource): (WebInspector.StoragePanel.prototype._showResourceView): (WebInspector.StoragePanel.prototype.updateMainViewWidth): (WebInspector.StoragePanel.prototype.get searchableViews.callback): (WebInspector.StoragePanel.prototype.get searchableViews): (WebInspector.StoragePanel.prototype._forAllResourceTreeElements): (WebInspector.StoragePanel.prototype.searchMatchFound): (WebInspector.StoragePanel.prototype.searchCanceled.callback): (WebInspector.StoragePanel.prototype.searchCanceled): (WebInspector.StoragePanel.prototype.performSearch): (WebInspector.StoragePanel.prototype.showView): (WebInspector.BaseStorageTreeElement.prototype.onattach): (WebInspector.BaseStorageTreeElement.prototype.set titleText): (WebInspector.BaseStorageTreeElement.prototype.isEventWithinDisclosureTriangle): (WebInspector.FrameResourceTreeElement): (WebInspector.FrameResourceTreeElement.prototype.onselect): (WebInspector.FrameResourceTreeElement.prototype.ondblclick): (WebInspector.FrameResourceTreeElement.prototype.onattach): (WebInspector.FrameResourceTreeElement.prototype._ondragstart): (WebInspector.FrameResourceTreeElement.prototype._setBubbleText): (WebInspector.FrameResourceTreeElement.prototype._resetBubble): (WebInspector.FrameResourceTreeElement.prototype._searchMatchesUpdated): (WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
  • inspector/front-end/inspector.css: (.storage.panel .sidebar): (.storage.panel .outline-disclosure li): (.storage.panel .outline-disclosure li.parent): (.storage.panel .outline-disclosure li .selection): (.storage.panel .outline-disclosure .icon): (.storage.panel .base-storage-tree-element-title): (.storage.panel .status): (.storage.panel li .status .bubble): (li .status): (li .status:empty): (li .status .bubble): (li .status .bubble:empty): (li.selected .status .bubble): (:focus li.selected .status .bubble): (body.inactive li.selected .status .bubble): (li.selected .bubble.search-matches): (:focus li.selected .bubble.search-matches): (body.inactive li.selected .bubble.search-matches):
Location:
trunk/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r70440 r70445  
     12010-10-24  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: add support for errors, warnings and search to the storage panel.
     6        https://bugs.webkit.org/show_bug.cgi?id=48206
     7
     8        * inspector/front-end/ConsoleView.js:
     9        (WebInspector.ConsoleView.prototype.addMessage):
     10        (WebInspector.ConsoleView.prototype.clearMessages):
     11        * inspector/front-end/Resource.js:
     12        (WebInspector.Resource.prototype.set errors):
     13        (WebInspector.Resource.prototype.set warnings):
     14        (WebInspector.Resource.prototype.get searchMatches):
     15        (WebInspector.Resource.prototype.set searchMatches):
     16        (WebInspector.Resource.prototype.clearErrorsAndWarnings):
     17        * inspector/front-end/ResourceManager.js:
     18        (WebInspector.ResourceManager):
     19        (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
     20        (WebInspector.ResourceManager.prototype._createResource):
     21        (WebInspector.ResourceManager.prototype._appendRedirect):
     22        (WebInspector.ResourceManager.prototype.didReceiveResponse):
     23        (WebInspector.ResourceManager.prototype.didFinishLoading):
     24        (WebInspector.ResourceManager.prototype.didFailLoading):
     25        (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
     26        (WebInspector.ResourceManager.prototype.didCommitLoadForFrame):
     27        (WebInspector.ResourceManager.prototype.frameDetachedFromParent):
     28        (WebInspector.ResourceManager.prototype._addFramesRecursively):
     29        (WebInspector.ResourceManager.prototype.resourceForURL):
     30        (WebInspector.ResourceManager.prototype.addConsoleMessage):
     31        (WebInspector.ResourceManager.prototype.clearConsoleMessages):
     32        (WebInspector.ResourceTreeModel):
     33        (WebInspector.ResourceTreeModel.prototype.addOrUpdateFrame):
     34        (WebInspector.ResourceTreeModel.prototype.didCommitLoadForFrame):
     35        (WebInspector.ResourceTreeModel.prototype.frameDetachedFromParent):
     36        (WebInspector.ResourceTreeModel.prototype._clearChildFramesAndResources):
     37        (WebInspector.ResourceTreeModel.prototype.addResourceToFrame):
     38        (WebInspector.ResourceTreeModel.prototype._clearResources):
     39        (WebInspector.ResourceTreeModel.prototype._bindResourceURL):
     40        (WebInspector.ResourceTreeModel.prototype._unbindResourceURL):
     41        (WebInspector.ResourceTreeModel.prototype.resourceForURL):
     42        (WebInspector.ResourceTreeModel.prototype.forAllResources):
     43        (WebInspector.ResourceTreeModel.prototype._callForFrameResources):
     44        * inspector/front-end/StoragePanel.js:
     45        (WebInspector.StoragePanel):
     46        (WebInspector.StoragePanel.prototype.get toolbarItemLabel):
     47        (WebInspector.StoragePanel.prototype.reset):
     48        (WebInspector.StoragePanel.prototype.removeFrame):
     49        (WebInspector.StoragePanel.prototype.canShowSourceLine):
     50        (WebInspector.StoragePanel.prototype.showSourceLine):
     51        (WebInspector.StoragePanel.prototype.showResource):
     52        (WebInspector.StoragePanel.prototype._showResourceView):
     53        (WebInspector.StoragePanel.prototype.updateMainViewWidth):
     54        (WebInspector.StoragePanel.prototype.get searchableViews.callback):
     55        (WebInspector.StoragePanel.prototype.get searchableViews):
     56        (WebInspector.StoragePanel.prototype._forAllResourceTreeElements):
     57        (WebInspector.StoragePanel.prototype.searchMatchFound):
     58        (WebInspector.StoragePanel.prototype.searchCanceled.callback):
     59        (WebInspector.StoragePanel.prototype.searchCanceled):
     60        (WebInspector.StoragePanel.prototype.performSearch):
     61        (WebInspector.StoragePanel.prototype.showView):
     62        (WebInspector.BaseStorageTreeElement.prototype.onattach):
     63        (WebInspector.BaseStorageTreeElement.prototype.set titleText):
     64        (WebInspector.BaseStorageTreeElement.prototype.isEventWithinDisclosureTriangle):
     65        (WebInspector.FrameResourceTreeElement):
     66        (WebInspector.FrameResourceTreeElement.prototype.onselect):
     67        (WebInspector.FrameResourceTreeElement.prototype.ondblclick):
     68        (WebInspector.FrameResourceTreeElement.prototype.onattach):
     69        (WebInspector.FrameResourceTreeElement.prototype._ondragstart):
     70        (WebInspector.FrameResourceTreeElement.prototype._setBubbleText):
     71        (WebInspector.FrameResourceTreeElement.prototype._resetBubble):
     72        (WebInspector.FrameResourceTreeElement.prototype._searchMatchesUpdated):
     73        (WebInspector.FrameResourceTreeElement.prototype._errorsWarningsUpdated):
     74        * inspector/front-end/inspector.css:
     75        (.storage.panel .sidebar):
     76        (.storage.panel .outline-disclosure li):
     77        (.storage.panel .outline-disclosure li.parent):
     78        (.storage.panel .outline-disclosure li .selection):
     79        (.storage.panel .outline-disclosure .icon):
     80        (.storage.panel .base-storage-tree-element-title):
     81        (.storage.panel .status):
     82        (.storage.panel li .status .bubble):
     83        (li .status):
     84        (li .status:empty):
     85        (li .status .bubble):
     86        (li .status .bubble:empty):
     87        (li.selected .status .bubble):
     88        (:focus li.selected .status .bubble):
     89        (body.inactive li.selected .status .bubble):
     90        (li.selected .bubble.search-matches):
     91        (:focus li.selected .bubble.search-matches):
     92        (body.inactive li.selected .bubble.search-matches):
     93
    1942010-10-24  Csaba Osztrogonác  <ossy@webkit.org>
    295
  • trunk/WebCore/inspector/front-end/ConsoleView.js

    r70214 r70445  
    231231                    WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
    232232            }
     233            if (WebInspector.resourceManager)
     234                WebInspector.resourceManager.addConsoleMessage(msg);
    233235
    234236            this.commandSincePreviousMessage = false;
     
    304306        if (WebInspector.panels.resources)
    305307            WebInspector.panels.resources.clearMessages();
     308        if (WebInspector.resourceManager)
     309            WebInspector.resourceManager.clearConsoleMessages();
    306310
    307311        this.messages = [];
  • trunk/WebCore/inspector/front-end/Resource.js

    r70240 r70445  
    531531    {
    532532        this._errors = x;
     533        this.dispatchEventToListeners("errors-warnings-updated");
    533534    },
    534535
     
    541542    {
    542543        this._warnings = x;
     544        this.dispatchEventToListeners("errors-warnings-updated");
     545    },
     546
     547    clearErrorsAndWarnings: function()
     548    {
     549        this._warnings = 0;
     550        this._errors = 0;
     551        this.dispatchEventToListeners("errors-warnings-updated");
    543552    },
    544553
  • trunk/WebCore/inspector/front-end/ResourceManager.js

    r70305 r70445  
    4949
    5050    this._resourcesById = {};
    51     this._resourcesByFrameId = {};
    52     this._lastCachedId = 0;
     51    this._resourceTreeModel = new WebInspector.ResourceTreeModel();
    5352    InspectorBackend.cachedResources(this._processCachedResources.bind(this));
    5453}
     
    6463    {
    6564        var resource = this._createResource(identifier, url, loader);
    66         if (isMainResource)
     65        if (isMainResource) {
    6766            resource.isMainResource = true;
     67            WebInspector.mainResource = resource;
     68        }
    6869
    6970        WebInspector.panels.network.addResource(resource);
     
    7374    {
    7475        var resource = new WebInspector.Resource(identifier, url);
     76        resource.loader = loader;
     77
    7578        this._resourcesById[identifier] = resource;
    76 
    77         resource.loader = loader;
    78         var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
    79         if (!resourcesForFrame) {
    80             resourcesForFrame = [];
    81             this._resourcesByFrameId[loader.frameId] = resourcesForFrame;
    82         }
    83         resourcesForFrame.push(resource);
    8479        return resource;
    8580    },
     
    113108    _appendRedirect: function(identifier, redirectURL)
    114109    {
    115         // We always store last redirect by the original id key. Rest of the redirects are referenced from within the last one.
    116 
    117110        var originalResource = this._resourcesById[identifier];
    118         var redirectIdentifier = originalResource.identifier + ":" + (originalResource.redirects ? originalResource.redirects.length : 0);
    119         originalResource.identifier = redirectIdentifier;
    120         this._resourcesById[redirectIdentifier] = originalResource;
     111        originalResource.identifier = null;
    121112
    122113        var newResource = this._createResource(identifier, redirectURL, originalResource.loader);
     
    147138
    148139        WebInspector.panels.network.refreshResource(resource);
    149         this._addResourceToStorageFrame(resource.loader.frameId, resource);
     140        this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
    150141    },
    151142
     
    196187
    197188        WebInspector.panels.network.refreshResource(resource);
     189        delete this._resourcesById[identifier];
    198190    },
    199191
     
    208200
    209201        WebInspector.panels.network.refreshResource(resource);
     202        delete this._resourcesById[identifier];
    210203    },
    211204
    212205    didLoadResourceFromMemoryCache: function(time, cachedResource)
    213206    {
    214         var identifier = "cached:" + this._lastCachedId++;
    215         var resource = this._createResource(identifier, cachedResource.url, cachedResource.loader);
     207        var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
    216208        this._updateResourceWithCachedResource(resource, cachedResource);
    217209        resource.cached = true;
     
    219211
    220212        WebInspector.panels.network.addResource(resource);
    221         WebInspector.panels.storage.addResourceToFrame(resource.loader.frameId, resource);
     213        this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
    222214    },
    223215
     
    243235    didCommitLoadForFrame: function(parentFrameId, loader)
    244236    {
    245         this._clearResources(loader.frameId, loader.loaderId);
    246         WebInspector.panels.storage.removeResourcesFromFrame(loader.frameId);
    247 
    248         var tmpResource = new WebInspector.Resource(null, loader.url);
    249         WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, loader.frameId, tmpResource.displayName);
    250 
    251         var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
    252         for (var i = 0; i < resourcesForFrame.length; ++i)
    253             this._addResourceToStorageFrame(loader.frameId, resourcesForFrame[i]);
    254     },
    255 
    256     _addResourceToStorageFrame: function(frameId, resource)
    257     {
    258         // Do not show redirects in resource browser.
    259         if (resource.statusCode < 300 || resource.statusCode > 303)
    260             WebInspector.panels.storage.addResourceToFrame(frameId, resource);
     237        this._resourceTreeModel.didCommitLoadForFrame(parentFrameId, loader);
    261238    },
    262239
    263240    frameDetachedFromParent: function(frameId)
    264241    {
    265         this._clearResources(frameId, 0);
    266         WebInspector.panels.storage.removeFrame(frameId);
    267     },
    268 
    269     _clearResources: function(frameId, loaderToPreserveId)
    270     {
    271         var resourcesForFrame = this._resourcesByFrameId[frameId];
    272         if (!resourcesForFrame)
    273             return;
    274 
    275         var preservedResourcesForFrame = [];
    276         for (var i = 0; i < resourcesForFrame.length; ++i) {
    277             var resource = resourcesForFrame[i];
    278             if (resource.loader.loaderId === loaderToPreserveId) {
    279                 preservedResourcesForFrame.push(resource);
    280                 continue;
    281             }
    282             delete this._resourcesById[id];
    283         }
    284         delete this._resourcesByFrameId[frameId];
    285         if (preservedResourcesForFrame.length)
    286             this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
     242        this._resourceTreeModel.frameDetachedFromParent(frameId);
    287243    },
    288244
     
    344300        var frameResource = this._createResource(null, framePayload.resource.url, framePayload.resource.loader);
    345301        frameResource.type = WebInspector.Resource.Type["Document"];
    346         WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, framePayload.id, frameResource.displayName);
    347         WebInspector.panels.storage.addResourceToFrame(framePayload.id, frameResource);
     302        this._resourceTreeModel.addOrUpdateFrame(parentFrameId, framePayload.id, frameResource.displayName);
     303        this._resourceTreeModel.addResourceToFrame(framePayload.id, frameResource);
    348304
    349305        for (var i = 0; framePayload.children && i < framePayload.children.length; ++i)
     
    357313            var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
    358314            this._updateResourceWithCachedResource(resource, cachedResource);
    359             WebInspector.panels.storage.addResourceToFrame(framePayload.id, resource);
    360         }
     315            this._resourceTreeModel.addResourceToFrame(framePayload.id, resource);
     316        }
     317    },
     318
     319    resourceForURL: function(url)
     320    {
     321        return this._resourceTreeModel.resourceForURL(url);
     322    },
     323
     324    addConsoleMessage: function(msg)
     325    {
     326        var resource = this._resourceTreeModel.resourceForURL(msg.url);
     327        if (!resource)
     328            return;
     329
     330        switch (msg.level) {
     331        case WebInspector.ConsoleMessage.MessageLevel.Warning:
     332            resource.warnings += msg.repeatDelta;
     333            break;
     334        case WebInspector.ConsoleMessage.MessageLevel.Error:
     335            resource.errors += msg.repeatDelta;
     336            break;
     337        }
     338
     339        var view = WebInspector.ResourceManager.resourceViewForResource(resource);
     340        if (view.addMessage)
     341            view.addMessage(msg);
     342    },
     343
     344    clearConsoleMessages: function()
     345    {
     346        function callback(resource)
     347        {
     348            resource.clearErrorsAndWarnings();
     349        }
     350        this._resourceTreeModel.forAllResources(callback);
    361351    }
    362352}
     
    405395}
    406396
     397WebInspector.ResourceManager.existingResourceViewForResource = function(resource)
     398{
     399    if (!resource)
     400        return null;
     401    return resource._resourcesView;
     402}
     403
    407404WebInspector.ResourceManager.getContents = function(resource, callback)
    408405{
     
    418415        InspectorBackend.getResourceContent(resource.identifier, false, callback);
    419416}
     417
     418WebInspector.ResourceTreeModel = function()
     419{
     420    this._resourcesByFrameId = {};
     421    this._subframes = {};
     422    this._resourcesByURL = {};
     423}
     424
     425WebInspector.ResourceTreeModel.prototype = {
     426    addOrUpdateFrame: function(parentFrameId, frameId, displayName)
     427    {
     428        WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, frameId, displayName);
     429        var subframes = this._subframes[parentFrameId];
     430        if (!subframes) {
     431            subframes = {};
     432            this._subframes[parentFrameId || 0] = subframes;
     433        }
     434        subframes[frameId] = true;
     435    },
     436
     437    didCommitLoadForFrame: function(parentFrameId, loader)
     438    {
     439        this._clearChildFramesAndResources(loader.frameId, loader.loaderId);
     440
     441        var tmpResource = new WebInspector.Resource(null, loader.url);
     442        this.addOrUpdateFrame(parentFrameId, loader.frameId, tmpResource.displayName);
     443
     444        var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
     445        for (var i = 0; resourcesForFrame && i < resourcesForFrame.length; ++i)
     446            WebInspector.panels.storage.addResourceToFrame(loader.frameId, resourcesForFrame[i]);
     447    },
     448
     449    frameDetachedFromParent: function(frameId)
     450    {
     451        this._clearChildFramesAndResources(frameId, 0);
     452        WebInspector.panels.storage.removeFrame(frameId);
     453    },
     454
     455    _clearChildFramesAndResources: function(frameId, loaderId)
     456    {
     457        WebInspector.panels.storage.removeResourcesFromFrame(frameId);
     458
     459        this._clearResources(frameId, loaderId);
     460        var subframes = this._subframes[frameId];
     461        if (!subframes)
     462            return;
     463
     464        for (var childFrameId in subframes) {
     465            WebInspector.panels.storage.removeFrame(childFrameId);
     466            this._clearChildFramesAndResources(childFrameId, loaderId);
     467        }
     468        delete this._subframes[frameId];
     469    },
     470
     471    addResourceToFrame: function(frameId, resource)
     472    {
     473        var resourcesForFrame = this._resourcesByFrameId[frameId];
     474        if (!resourcesForFrame) {
     475            resourcesForFrame = [];
     476            this._resourcesByFrameId[frameId] = resourcesForFrame;
     477        }
     478        resourcesForFrame.push(resource);
     479        this._bindResourceURL(resource);
     480
     481        WebInspector.panels.storage.addResourceToFrame(frameId, resource);
     482    },
     483
     484    _clearResources: function(frameId, loaderToPreserveId)
     485    {
     486        var resourcesForFrame = this._resourcesByFrameId[frameId];
     487        if (!resourcesForFrame)
     488            return;
     489
     490        var preservedResourcesForFrame = [];
     491        for (var i = 0; i < resourcesForFrame.length; ++i) {
     492            var resource = resourcesForFrame[i];
     493            if (resource.loader.loaderId === loaderToPreserveId) {
     494                preservedResourcesForFrame.push(resource);
     495                continue;
     496            }
     497            this._unbindResourceURL(resource);
     498        }
     499
     500        delete this._resourcesByFrameId[frameId];
     501        if (preservedResourcesForFrame.length)
     502            this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
     503    },
     504
     505    _bindResourceURL: function(resource)
     506    {
     507        var resourceForURL = this._resourcesByURL[resource.url];
     508        if (!resourceForURL)
     509            this._resourcesByURL[resource.url] = resource;
     510        else if (resourceForURL instanceof Array)
     511            resourceForURL.push(resource);
     512        else
     513            this._resourcesByURL[resource.url] = [ resourceForURL ];
     514    },
     515
     516    _unbindResourceURL: function(resource)
     517    {
     518        var resourceForURL = this._resourcesByURL[resource.url];
     519        if (!resourceForURL)
     520            return;
     521
     522        if (resourceForURL instanceof Array) {
     523            resourceForURL.remove(resource, true);
     524            if (resourceForURL.length === 1)
     525                this._resourcesByURL[resource.url] = resourceForURL[0];
     526            return;
     527        }
     528
     529        delete this._resourcesByURL[resource.url];
     530    },
     531
     532    resourceForURL: function(url)
     533    {
     534        // FIXME: receive frameId here.
     535        var entry = this._resourcesByURL[url];
     536        if (entry instanceof Array)
     537            return entry[0];
     538        return entry;
     539    },
     540
     541    forAllResources: function(callback)
     542    {
     543        this._callForFrameResources(0, callback);
     544    },
     545
     546    _callForFrameResources: function(frameId, callback)
     547    {
     548        var resources = this._resourcesByFrameId[frameId];
     549        for (var i = 0; resources && i < resources.length; ++i)
     550            callback(resources[i]);
     551       
     552        var frames = this._subframes[frameId];
     553        if (frames) {
     554            for (var id in frames)
     555                this._callForFrameResources(id, callback);
     556        }
     557    }
     558}
  • trunk/WebCore/inspector/front-end/Settings.js

    r68636 r70445  
    4646    nativeInstrumentationEnabled: false,
    4747    resourceExportEnabled: false,
    48     networkPanelEnabled: false
     48    networkPanelEnabled: true
    4949}
    5050
  • trunk/WebCore/inspector/front-end/StoragePanel.js

    r70305 r70445  
    3434    this.createSidebar();
    3535    this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
     36    this.sidebarTreeElement.removeStyleClass("sidebar-tree");
    3637
    3738    if (Preferences.networkPanelEnabled) {
    38         this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Resources"), "frame-storage-tree-item");
     39        this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "frame-storage-tree-item");
    3940        this.sidebarTree.appendChild(this.resourcesListTreeElement);
    4041        this.resourcesListTreeElement.expand();
     
    115116
    116117        this.storageViewStatusBarItemsContainer.removeChildren();
    117        
     118
    118119        if (this.sidebarTree.selectedTreeElement)
    119120            this.sidebarTree.selectedTreeElement.deselect();
     
    158159        if (!frameTreeElement)
    159160            return;
    160 
    161         var children = frameTreeElement.children.slice();
    162         for (var i = 0; i < children.length; ++i)
    163             this.removeFrame(children[i]._frameId);
    164 
    165161        delete this._treeElementForFrameId[frameId];
    166         frameTreeElement.parent.removeChild(frameTreeElement);
     162        if (frameTreeElement.parent)
     163            frameTreeElement.parent.removeChild(frameTreeElement);
    167164    },
    168165
     
    254251    },
    255252
    256     showResource: function(resource)
     253    canShowSourceLine: function(url, line)
     254    {
     255        return !!WebInspector.resourceManager.resourceForURL(url);
     256    },
     257
     258    showSourceLine: function(url, line)
     259    {
     260        this.showResource(WebInspector.resourceManager.resourceForURL(url), line);
     261    },
     262
     263    showResource: function(resource, line)
     264    {
     265        var resourceTreeElement = this.sidebarTree.findTreeElement(resource);
     266        if (resourceTreeElement) {
     267            resourceTreeElement.reveal();
     268            resourceTreeElement.select();
     269        }
     270
     271        if (line) {
     272            var view = WebInspector.ResourceManager.resourceViewForResource(resource);
     273            view.selectContentTab(true);
     274            if (view.revealLine)
     275                view.revealLine(line);
     276            if (view.highlightLine)
     277                view.highlightLine(line);
     278        }
     279        return true;
     280    },
     281
     282    _showResourceView: function(resource)
    257283    {
    258284        var view = WebInspector.ResourceManager.resourceViewForResource(resource);
     
    504530        this.storageViewStatusBarItemsContainer.style.left = width + "px";
    505531        this.resize();
     532    },
     533
     534    get searchableViews()
     535    {
     536        var views = [];
     537
     538        if (!Preferences.networkPanelEnabled)
     539            return views;
     540
     541        const visibleView = this.visibleView;
     542        if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
     543            views.push(visibleView);
     544
     545        function callback(resourceTreeElement)
     546        {
     547            var resource = resourceTreeElement._resource;
     548            var resourceView = WebInspector.ResourceManager.resourceViewForResource(resource);
     549            if (resourceView.performSearch && resourceView !== visibleView)
     550                views.push(resourceView);
     551        }
     552        this._forAllResourceTreeElements(callback);
     553        return views;
     554    },
     555
     556    _forAllResourceTreeElements: function(callback)
     557    {
     558        var stop = false;
     559        for (var treeElement = this.resourcesListTreeElement; !stop && treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.resourcesListTreeElement, true)) {
     560            if (treeElement instanceof WebInspector.FrameResourceTreeElement)
     561                stop = callback(treeElement);
     562        }
     563    },
     564
     565    searchMatchFound: function(view, matches)
     566    {
     567        if (!view.resource)
     568            return;
     569        var treeElement = this.sidebarTree.findTreeElement(view.resource);
     570        if (treeElement)
     571            treeElement.searchMatchFound(matches);
     572    },
     573
     574    searchCanceled: function(startingNewSearch)
     575    {
     576        WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
     577
     578        if (startingNewSearch)
     579            return;
     580
     581        function callback(resourceTreeElement)
     582        {
     583            resourceTreeElement._errorsWarningsUpdated();
     584        }
     585        this._forAllResourceTreeElements(callback);
     586    },
     587
     588    performSearch: function(query)
     589    {
     590        function callback(resourceTreeElement)
     591        {
     592            resourceTreeElement._resetBubble();
     593        }
     594        this._forAllResourceTreeElements(callback);
     595        WebInspector.Panel.prototype.performSearch.call(this, query);
     596    },
     597
     598    showView: function(view)
     599    {
     600        if (view)
     601            this.showResource(view.resource);
    506602    }
    507603}
     
    509605WebInspector.StoragePanel.prototype.__proto__ = WebInspector.Panel.prototype;
    510606
    511 WebInspector.BaseStorageTreeElement = function(storagePanel, title, iconClass, hasChildren)
    512 {
    513     TreeElement.call(this, "", null, hasChildren);
     607WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
     608{
     609    TreeElement.call(this, "", representedObject, hasChildren);
    514610    this._storagePanel = storagePanel;
    515611    this._titleText = title;
     
    527623        this.listItemElement.appendChild(this.imageElement);
    528624
    529         this.titleElement = document.createElement("span");
     625        this.titleElement = document.createElement("div");
     626        this.titleElement.className = "base-storage-tree-element-title";
    530627        this.titleElement.textContent = this._titleText;
    531         this.titleElement.className = "storage-base-tree-element-title";
    532628        this.listItemElement.appendChild(this.titleElement);
    533629
     
    547643        this._titleText = titleText;
    548644        this.titleElement.textContent = this._titleText;
     645    },
     646
     647    isEventWithinDisclosureTriangle: function()
     648    {
     649        // Override it since we use margin-left in place of treeoutline's text-indent.
     650        // Hence we need to take padding into consideration. This all is needed for leading
     651        // icons in the tree.
     652        const paddingLeft = 14;
     653        var left = this.listItemElement.totalOffsetLeft + paddingLeft;
     654        return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
    549655    }
    550656}
     
    554660WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, iconClass)
    555661{
    556     WebInspector.BaseStorageTreeElement.call(this, storagePanel, categoryName, iconClass, true);
     662    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
    557663    this._categoryName = categoryName;
    558664}
     
    568674WebInspector.FrameTreeElement = function(storagePanel, frameId, displayName)
    569675{
    570     WebInspector.BaseStorageTreeElement.call(this, storagePanel, displayName, "frame-storage-tree-item");
     676    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayName, "frame-storage-tree-item");
    571677    this._frameId = frameId;
    572678    this._displayName = displayName;
     
    594700WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
    595701{
    596     WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
     702    WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
    597703    this._resource = resource;
     704    this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
     705    this.tooltip = resource.url;
    598706}
    599707
     
    601709    onselect: function()
    602710    {
    603         this._storagePanel.showResource(this._resource);
     711        this._storagePanel._showResourceView(this._resource);
     712    },
     713
     714    ondblclick: function(event)
     715    {
     716        InspectorBackend.openInInspectedWindow(this._resource.url);
    604717    },
    605718
     
    618731            this.listItemElement.replaceChild(iconElement, this.imageElement);
    619732        }
     733
     734        this._statusElement = document.createElement("div");
     735        this._statusElement.className = "status";
     736        this.listItemElement.insertBefore(this._statusElement, this.titleElement);
     737
     738        this.listItemElement.draggable = true;
     739        this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
     740    },
     741
     742    _ondragstart: function(event)
     743    {
     744        event.dataTransfer.setData("text/plain", this._resource.url);
     745        event.dataTransfer.setData("text/uri-list", this._resource.url + "\r\n");
     746        event.dataTransfer.effectAllowed = "copy";
     747        return true;
     748    },
     749
     750    _setBubbleText: function(x)
     751    {
     752        if (!this._bubbleElement) {
     753            this._bubbleElement = document.createElement("div");
     754            this._bubbleElement.className = "bubble";
     755            this._statusElement.appendChild(this._bubbleElement);
     756        }
     757
     758        this._bubbleElement.textContent = x;
     759    },
     760
     761    _resetBubble: function()
     762    {
     763        if (this._bubbleElement) {
     764            this._bubbleElement.textContent = "";
     765            this._bubbleElement.removeStyleClass("search-matches");
     766            this._bubbleElement.removeStyleClass("warning");
     767            this._bubbleElement.removeStyleClass("error");
     768        }
     769    },
     770
     771    searchMatchFound: function(matches)
     772    {
     773        this._resetBubble();
     774
     775        this._setBubbleText(matches);
     776        this._bubbleElement.addStyleClass("search-matches");
     777
     778        // Expand, do not scroll into view.
     779        var currentAncestor = this.parent;
     780        while (currentAncestor && !currentAncestor.root) {
     781            if (!currentAncestor.expanded)
     782                currentAncestor.expand();
     783            currentAncestor = currentAncestor.parent;
     784        }
     785    },
     786
     787    _errorsWarningsUpdated: function()
     788    {
     789        // FIXME: move to the Script/SourceView.
     790        if (!this._resource.warnings && !this._resource.errors) {
     791            var view = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
     792            if (view && view.clearMessages)
     793                view.clearMessages();
     794        }
     795
     796        if (this._storagePanel.currentQuery)
     797            return;
     798
     799        this._resetBubble();
     800
     801        if (this._resource.warnings || this._resource.errors)
     802            this._setBubbleText(this._resource.warnings + this._resource.errors);
     803
     804        if (this._resource.warnings)
     805            this._bubbleElement.addStyleClass("warning");
     806
     807        if (this._resource.errors)
     808            this._bubbleElement.addStyleClass("error");
    620809    }
    621810}
     
    625814WebInspector.DatabaseTreeElement = function(storagePanel, database)
    626815{
    627     WebInspector.BaseStorageTreeElement.call(this, storagePanel, database.name, "database-storage-tree-item", true);
     816    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
    628817    this._database = database;
    629818}
     
    660849WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
    661850{
    662     WebInspector.BaseStorageTreeElement.call(this, storagePanel, tableName, "database-storage-tree-item");
     851    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
    663852    this._database = database;
    664853    this._tableName = tableName;
     
    675864WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
    676865{
    677     WebInspector.BaseStorageTreeElement.call(this, storagePanel, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
     866    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
    678867    this._domStorage = domStorage;
    679868}
     
    689878WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
    690879{
    691     WebInspector.BaseStorageTreeElement.call(this, storagePanel, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
     880    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
    692881    this._cookieDomain = cookieDomain;
    693882}
     
    703892WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
    704893{
    705     WebInspector.BaseStorageTreeElement.call(this, storagePanel, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
     894    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
    706895    this._appcacheDomain = appcacheDomain;
    707896}
  • trunk/WebCore/inspector/front-end/inspector.css

    r70240 r70445  
    19211921    border-left: rgb(232, 232, 232);
    19221922    background-color: transparent;
    1923     overflow-x: auto;
    1924 }
    1925 
    1926 .storage.panel .sidebar.outline-disclosure > ol {
     1923    padding-left: 0px;
     1924}
     1925
     1926.storage.panel .outline-disclosure li {
     1927    height: 17px;
     1928    white-space: nowrap;
     1929    text-indent: 0;
     1930    margin-left: -2px;
     1931}
     1932
     1933.storage.panel .outline-disclosure li.parent {
     1934    text-indent: 0;
    19271935    margin-left: -12px;
    1928     padding-right: 0px !important;
    1929 }
    1930 
    1931 .storage.panel .outline-disclosure li {
    1932     white-space: nowrap;
    19331936}
    19341937
    19351938.storage.panel .outline-disclosure li .selection {
    19361939    height: 17px;
    1937     margin-left: -100px;
    1938     display: inline-block;
     1940    margin-top: -13px;
    19391941}
    19401942
     
    19451947}
    19461948
    1947 .storage-base-tree-element-title {
    1948     position: relative;
    1949     bottom: 4px;
    1950     left: 3px;
    1951 }
    1952 
    1953 .storage.panel .outline-disclosure ol {
    1954     -webkit-padding-start: 14px;
    1955 }
    1956 
    1957 .storage.panel .outline-disclosure li.selected {
    1958     color: white;
    1959     background-color: transparent;
    1960 }
    1961 
    19621949.storage.panel .outline-disclosure .icon {
    19631950    width: 16px;
    19641951    height: 16px;
    1965     display: inline-block;
     1952    float: left;
     1953}
     1954
     1955.storage.panel .base-storage-tree-element-title {
     1956    overflow: hidden;
     1957    position: relative;
     1958    text-overflow: ellipsis;
     1959    padding-left: 2px;
     1960    top: 1px;
     1961}
     1962
     1963.storage.panel .status {
     1964    float: right;
     1965    height: 16px;
     1966    margin-top: 1px;
     1967    margin-left: 4px;
     1968    line-height: 1em;
     1969}
     1970
     1971.storage.panel li .status .bubble {
     1972    height: 13px;
     1973    padding-top: 0;
    19661974}
    19671975
     
    32043212}
    32053213
    3206 .sidebar-tree-item .status {
     3214li .status {
    32073215    float: right;
    32083216    height: 16px;
     
    32123220}
    32133221
    3214 .sidebar-tree-item .status:empty {
    3215     display: none;
    3216 }
    3217 
    3218 .sidebar-tree-item .status .bubble {
     3222li .status:empty {
     3223    display: none;
     3224}
     3225
     3226li .status .bubble {
    32193227    display: inline-block;
    32203228    height: 14px;
     
    32353243}
    32363244
    3237 .sidebar-tree-item .status .bubble:empty {
    3238     display: none;
    3239 }
    3240 
    3241 .sidebar-tree-item.selected .status .bubble {
     3245li .status .bubble:empty {
     3246    display: none;
     3247}
     3248
     3249li.selected .status .bubble {
    32423250    background-color: white !important;
    32433251    color: rgb(132, 154, 190) !important;
    32443252}
    32453253
    3246 :focus .sidebar-tree-item.selected .status .bubble {
     3254:focus li.selected .status .bubble {
    32473255    color: rgb(36, 98, 172) !important;
    32483256}
    32493257
    3250 body.inactive .sidebar-tree-item.selected .status .bubble {
     3258body.inactive li.selected .status .bubble {
    32513259    color: rgb(159, 159, 159) !important;
    32523260}
     
    34693477}
    34703478
    3471 .sidebar-tree-item.selected .bubble.search-matches {
     3479li.selected .bubble.search-matches {
    34723480    background-image: url(Images/searchSmallBlue.png);
    34733481}
    34743482
    3475 :focus .sidebar-tree-item.selected .bubble.search-matches {
     3483:focus li.selected .bubble.search-matches {
    34763484    background-image: url(Images/searchSmallBrightBlue.png);
    34773485}
    34783486
    3479 body.inactive .sidebar-tree-item.selected .bubble.search-matches {
     3487body.inactive li.selected .bubble.search-matches {
    34803488    background-image: url(Images/searchSmallGray.png);
    34813489}
  • trunk/WebCore/inspector/front-end/inspector.js

    r70240 r70445  
    19191919        for (var panelName in this.panels) {
    19201920            var panel = this.panels[panelName];
    1921             if (panel.currentQuery && panel.searchCanceled)
     1921            var hadCurrentQuery = !!panel.currentQuery;
     1922            delete panel.currentQuery;
     1923            if (hadCurrentQuery && panel.searchCanceled)
    19221924                panel.searchCanceled();
    1923             delete panel.currentQuery;
    19241925        }
    19251926
Note: See TracChangeset for help on using the changeset viewer.