[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 14:55:35 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ecba691d78f9c4a936d7921c794b41e133d8ce49
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 25 09:36:59 2010 +0000

    2010-10-24  Pavel Feldman  <pfeldman at 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):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70445 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 50bbc15..58b8102 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,96 @@
+2010-10-24  Pavel Feldman  <pfeldman at 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):
+
 2010-10-24  Csaba Osztrogonác  <ossy at webkit.org>
 
         Reviewed by David Kilzer.
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index c547c0d..1062507 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -230,6 +230,8 @@ WebInspector.ConsoleView.prototype = {
                 if (WebInspector.panels.resources)
                     WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
             }
+            if (WebInspector.resourceManager)
+                WebInspector.resourceManager.addConsoleMessage(msg);
 
             this.commandSincePreviousMessage = false;
             this.previousMessage = msg;
@@ -303,6 +305,8 @@ WebInspector.ConsoleView.prototype = {
     {
         if (WebInspector.panels.resources)
             WebInspector.panels.resources.clearMessages();
+        if (WebInspector.resourceManager)
+            WebInspector.resourceManager.clearConsoleMessages();
 
         this.messages = [];
 
diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js
index acc12a3..0f57e6c 100644
--- a/WebCore/inspector/front-end/Resource.js
+++ b/WebCore/inspector/front-end/Resource.js
@@ -530,6 +530,7 @@ WebInspector.Resource.prototype = {
     set errors(x)
     {
         this._errors = x;
+        this.dispatchEventToListeners("errors-warnings-updated");
     },
 
     get warnings()
@@ -540,6 +541,14 @@ WebInspector.Resource.prototype = {
     set warnings(x)
     {
         this._warnings = x;
+        this.dispatchEventToListeners("errors-warnings-updated");
+    },
+
+    clearErrorsAndWarnings: function()
+    {
+        this._warnings = 0;
+        this._errors = 0;
+        this.dispatchEventToListeners("errors-warnings-updated");
     },
 
     _mimeTypeIsConsistentWithType: function()
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index 2d8dda1..5ca5532 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -48,8 +48,7 @@ WebInspector.ResourceManager = function()
         "didCloseWebSocket");
 
     this._resourcesById = {};
-    this._resourcesByFrameId = {};
-    this._lastCachedId = 0;
+    this._resourceTreeModel = new WebInspector.ResourceTreeModel();
     InspectorBackend.cachedResources(this._processCachedResources.bind(this));
 }
 
@@ -63,8 +62,10 @@ WebInspector.ResourceManager.prototype = {
     identifierForInitialRequest: function(identifier, url, loader, isMainResource)
     {
         var resource = this._createResource(identifier, url, loader);
-        if (isMainResource)
+        if (isMainResource) {
             resource.isMainResource = true;
+            WebInspector.mainResource = resource;
+        }
 
         WebInspector.panels.network.addResource(resource);
     },
@@ -72,15 +73,9 @@ WebInspector.ResourceManager.prototype = {
     _createResource: function(identifier, url, loader)
     {
         var resource = new WebInspector.Resource(identifier, url);
-        this._resourcesById[identifier] = resource;
-
         resource.loader = loader;
-        var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
-        if (!resourcesForFrame) {
-            resourcesForFrame = [];
-            this._resourcesByFrameId[loader.frameId] = resourcesForFrame;
-        }
-        resourcesForFrame.push(resource);
+
+        this._resourcesById[identifier] = resource;
         return resource;
     },
 
@@ -112,12 +107,8 @@ WebInspector.ResourceManager.prototype = {
 
     _appendRedirect: function(identifier, redirectURL)
     {
-        // We always store last redirect by the original id key. Rest of the redirects are referenced from within the last one.
-
         var originalResource = this._resourcesById[identifier];
-        var redirectIdentifier = originalResource.identifier + ":" + (originalResource.redirects ? originalResource.redirects.length : 0);
-        originalResource.identifier = redirectIdentifier;
-        this._resourcesById[redirectIdentifier] = originalResource;
+        originalResource.identifier = null;
 
         var newResource = this._createResource(identifier, redirectURL, originalResource.loader);
         newResource.redirects = originalResource.redirects || [];
@@ -146,7 +137,7 @@ WebInspector.ResourceManager.prototype = {
         resource.responseReceivedTime = time;
 
         WebInspector.panels.network.refreshResource(resource);
-        this._addResourceToStorageFrame(resource.loader.frameId, resource);
+        this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
     },
 
     _updateResourceWithResponse: function(resource, response)
@@ -195,6 +186,7 @@ WebInspector.ResourceManager.prototype = {
         resource.endTime = finishTime;
 
         WebInspector.panels.network.refreshResource(resource);
+        delete this._resourcesById[identifier];
     },
 
     didFailLoading: function(identifier, time, localizedDescription)
@@ -207,18 +199,18 @@ WebInspector.ResourceManager.prototype = {
         resource.endTime = time;
 
         WebInspector.panels.network.refreshResource(resource);
+        delete this._resourcesById[identifier];
     },
 
     didLoadResourceFromMemoryCache: function(time, cachedResource)
     {
-        var identifier = "cached:" + this._lastCachedId++;
-        var resource = this._createResource(identifier, cachedResource.url, cachedResource.loader);
+        var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
         this._updateResourceWithCachedResource(resource, cachedResource);
         resource.cached = true;
         resource.startTime = resource.responseReceivedTime = resource.endTime = time;
 
         WebInspector.panels.network.addResource(resource);
-        WebInspector.panels.storage.addResourceToFrame(resource.loader.frameId, resource);
+        this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
     },
 
     _updateResourceWithCachedResource: function(resource, cachedResource)
@@ -242,48 +234,12 @@ WebInspector.ResourceManager.prototype = {
 
     didCommitLoadForFrame: function(parentFrameId, loader)
     {
-        this._clearResources(loader.frameId, loader.loaderId);
-        WebInspector.panels.storage.removeResourcesFromFrame(loader.frameId);
-
-        var tmpResource = new WebInspector.Resource(null, loader.url);
-        WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, loader.frameId, tmpResource.displayName);
-
-        var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
-        for (var i = 0; i < resourcesForFrame.length; ++i)
-            this._addResourceToStorageFrame(loader.frameId, resourcesForFrame[i]);
-    },
-
-    _addResourceToStorageFrame: function(frameId, resource)
-    {
-        // Do not show redirects in resource browser.
-        if (resource.statusCode < 300 || resource.statusCode > 303)
-            WebInspector.panels.storage.addResourceToFrame(frameId, resource);
+        this._resourceTreeModel.didCommitLoadForFrame(parentFrameId, loader);
     },
 
     frameDetachedFromParent: function(frameId)
     {
-        this._clearResources(frameId, 0);
-        WebInspector.panels.storage.removeFrame(frameId);
-    },
-
-    _clearResources: function(frameId, loaderToPreserveId)
-    {
-        var resourcesForFrame = this._resourcesByFrameId[frameId];
-        if (!resourcesForFrame)
-            return;
-
-        var preservedResourcesForFrame = [];
-        for (var i = 0; i < resourcesForFrame.length; ++i) {
-            var resource = resourcesForFrame[i];
-            if (resource.loader.loaderId === loaderToPreserveId) {
-                preservedResourcesForFrame.push(resource);
-                continue;
-            }
-            delete this._resourcesById[id];
-        }
-        delete this._resourcesByFrameId[frameId];
-        if (preservedResourcesForFrame.length)
-            this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
+        this._resourceTreeModel.frameDetachedFromParent(frameId);
     },
 
     didCreateWebSocket: function(identifier, requestURL)
@@ -343,8 +299,8 @@ WebInspector.ResourceManager.prototype = {
     {
         var frameResource = this._createResource(null, framePayload.resource.url, framePayload.resource.loader);
         frameResource.type = WebInspector.Resource.Type["Document"];
-        WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, framePayload.id, frameResource.displayName);
-        WebInspector.panels.storage.addResourceToFrame(framePayload.id, frameResource);
+        this._resourceTreeModel.addOrUpdateFrame(parentFrameId, framePayload.id, frameResource.displayName);
+        this._resourceTreeModel.addResourceToFrame(framePayload.id, frameResource);
 
         for (var i = 0; framePayload.children && i < framePayload.children.length; ++i)
             this._addFramesRecursively(framePayload.id, framePayload.children[i]);
@@ -356,8 +312,42 @@ WebInspector.ResourceManager.prototype = {
             var cachedResource = framePayload.subresources[i];
             var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
             this._updateResourceWithCachedResource(resource, cachedResource);
-            WebInspector.panels.storage.addResourceToFrame(framePayload.id, resource);
+            this._resourceTreeModel.addResourceToFrame(framePayload.id, resource);
+        }
+    },
+
+    resourceForURL: function(url)
+    {
+        return this._resourceTreeModel.resourceForURL(url);
+    },
+
+    addConsoleMessage: function(msg)
+    {
+        var resource = this._resourceTreeModel.resourceForURL(msg.url);
+        if (!resource)
+            return;
+
+        switch (msg.level) {
+        case WebInspector.ConsoleMessage.MessageLevel.Warning:
+            resource.warnings += msg.repeatDelta;
+            break;
+        case WebInspector.ConsoleMessage.MessageLevel.Error:
+            resource.errors += msg.repeatDelta;
+            break;
         }
+
+        var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+        if (view.addMessage)
+            view.addMessage(msg);
+    },
+
+    clearConsoleMessages: function()
+    {
+        function callback(resource)
+        {
+            resource.clearErrorsAndWarnings();
+        }
+        this._resourceTreeModel.forAllResources(callback);
     }
 }
 
@@ -404,6 +394,13 @@ WebInspector.ResourceManager.resourceViewForResource = function(resource)
     return resource._resourcesView;
 }
 
+WebInspector.ResourceManager.existingResourceViewForResource = function(resource)
+{
+    if (!resource)
+        return null;
+    return resource._resourcesView;
+}
+
 WebInspector.ResourceManager.getContents = function(resource, callback)
 {
     if ("overridenContent" in resource) {
@@ -417,3 +414,145 @@ WebInspector.ResourceManager.getContents = function(resource, callback)
     else
         InspectorBackend.getResourceContent(resource.identifier, false, callback);
 }
+
+WebInspector.ResourceTreeModel = function()
+{
+    this._resourcesByFrameId = {};
+    this._subframes = {};
+    this._resourcesByURL = {};
+}
+
+WebInspector.ResourceTreeModel.prototype = {
+    addOrUpdateFrame: function(parentFrameId, frameId, displayName)
+    {
+        WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, frameId, displayName);
+        var subframes = this._subframes[parentFrameId];
+        if (!subframes) {
+            subframes = {};
+            this._subframes[parentFrameId || 0] = subframes;
+        }
+        subframes[frameId] = true;
+    },
+
+    didCommitLoadForFrame: function(parentFrameId, loader)
+    {
+        this._clearChildFramesAndResources(loader.frameId, loader.loaderId);
+
+        var tmpResource = new WebInspector.Resource(null, loader.url);
+        this.addOrUpdateFrame(parentFrameId, loader.frameId, tmpResource.displayName);
+
+        var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
+        for (var i = 0; resourcesForFrame && i < resourcesForFrame.length; ++i)
+            WebInspector.panels.storage.addResourceToFrame(loader.frameId, resourcesForFrame[i]);
+    },
+
+    frameDetachedFromParent: function(frameId)
+    {
+        this._clearChildFramesAndResources(frameId, 0);
+        WebInspector.panels.storage.removeFrame(frameId);
+    },
+
+    _clearChildFramesAndResources: function(frameId, loaderId)
+    {
+        WebInspector.panels.storage.removeResourcesFromFrame(frameId);
+
+        this._clearResources(frameId, loaderId);
+        var subframes = this._subframes[frameId];
+        if (!subframes)
+            return;
+
+        for (var childFrameId in subframes) {
+            WebInspector.panels.storage.removeFrame(childFrameId);
+            this._clearChildFramesAndResources(childFrameId, loaderId);
+        }
+        delete this._subframes[frameId];
+    },
+
+    addResourceToFrame: function(frameId, resource)
+    {
+        var resourcesForFrame = this._resourcesByFrameId[frameId];
+        if (!resourcesForFrame) {
+            resourcesForFrame = [];
+            this._resourcesByFrameId[frameId] = resourcesForFrame;
+        }
+        resourcesForFrame.push(resource);
+        this._bindResourceURL(resource);
+
+        WebInspector.panels.storage.addResourceToFrame(frameId, resource);
+    },
+
+    _clearResources: function(frameId, loaderToPreserveId)
+    {
+        var resourcesForFrame = this._resourcesByFrameId[frameId];
+        if (!resourcesForFrame)
+            return;
+
+        var preservedResourcesForFrame = [];
+        for (var i = 0; i < resourcesForFrame.length; ++i) {
+            var resource = resourcesForFrame[i];
+            if (resource.loader.loaderId === loaderToPreserveId) {
+                preservedResourcesForFrame.push(resource);
+                continue;
+            }
+            this._unbindResourceURL(resource);
+        }
+
+        delete this._resourcesByFrameId[frameId];
+        if (preservedResourcesForFrame.length)
+            this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
+    },
+
+    _bindResourceURL: function(resource)
+    {
+        var resourceForURL = this._resourcesByURL[resource.url];
+        if (!resourceForURL)
+            this._resourcesByURL[resource.url] = resource;
+        else if (resourceForURL instanceof Array)
+            resourceForURL.push(resource);
+        else
+            this._resourcesByURL[resource.url] = [ resourceForURL ];
+    },
+
+    _unbindResourceURL: function(resource)
+    {
+        var resourceForURL = this._resourcesByURL[resource.url];
+        if (!resourceForURL)
+            return;
+
+        if (resourceForURL instanceof Array) {
+            resourceForURL.remove(resource, true);
+            if (resourceForURL.length === 1)
+                this._resourcesByURL[resource.url] = resourceForURL[0];
+            return;
+        }
+
+        delete this._resourcesByURL[resource.url];
+    },
+
+    resourceForURL: function(url)
+    {
+        // FIXME: receive frameId here.
+        var entry = this._resourcesByURL[url];
+        if (entry instanceof Array)
+            return entry[0];
+        return entry;
+    },
+
+    forAllResources: function(callback)
+    {
+        this._callForFrameResources(0, callback);
+    },
+
+    _callForFrameResources: function(frameId, callback)
+    {
+        var resources = this._resourcesByFrameId[frameId];
+        for (var i = 0; resources && i < resources.length; ++i)
+            callback(resources[i]);
+        
+        var frames = this._subframes[frameId];
+        if (frames) {
+            for (var id in frames)
+                this._callForFrameResources(id, callback);
+        }
+    }
+}
diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js
index c6da14d..7a31edf 100644
--- a/WebCore/inspector/front-end/Settings.js
+++ b/WebCore/inspector/front-end/Settings.js
@@ -45,7 +45,7 @@ var Preferences = {
     onlineDetectionEnabled: true,
     nativeInstrumentationEnabled: false,
     resourceExportEnabled: false,
-    networkPanelEnabled: false
+    networkPanelEnabled: true
 }
 
 WebInspector.Settings = function(sessionScope)
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index 0d80082..c0b0b59 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -33,9 +33,10 @@ WebInspector.StoragePanel = function(database)
 
     this.createSidebar();
     this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
+    this.sidebarTreeElement.removeStyleClass("sidebar-tree");
 
     if (Preferences.networkPanelEnabled) {
-        this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Resources"), "frame-storage-tree-item");
+        this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "frame-storage-tree-item");
         this.sidebarTree.appendChild(this.resourcesListTreeElement);
         this.resourcesListTreeElement.expand();
         this._treeElementForFrameId = {};
@@ -114,7 +115,7 @@ WebInspector.StoragePanel.prototype = {
         this.storageViews.removeChildren();
 
         this.storageViewStatusBarItemsContainer.removeChildren();
-        
+
         if (this.sidebarTree.selectedTreeElement)
             this.sidebarTree.selectedTreeElement.deselect();
     },
@@ -157,13 +158,9 @@ WebInspector.StoragePanel.prototype = {
         var frameTreeElement = this._treeElementForFrameId[frameId];
         if (!frameTreeElement)
             return;
-
-        var children = frameTreeElement.children.slice();
-        for (var i = 0; i < children.length; ++i)
-            this.removeFrame(children[i]._frameId);
-
         delete this._treeElementForFrameId[frameId];
-        frameTreeElement.parent.removeChild(frameTreeElement);
+        if (frameTreeElement.parent)
+            frameTreeElement.parent.removeChild(frameTreeElement);
     },
 
     addResourceToFrame: function(frameId, resource)
@@ -253,7 +250,36 @@ WebInspector.StoragePanel.prototype = {
         }
     },
 
-    showResource: function(resource)
+    canShowSourceLine: function(url, line)
+    {
+        return !!WebInspector.resourceManager.resourceForURL(url);
+    },
+
+    showSourceLine: function(url, line)
+    {
+        this.showResource(WebInspector.resourceManager.resourceForURL(url), line);
+    },
+
+    showResource: function(resource, line)
+    {
+        var resourceTreeElement = this.sidebarTree.findTreeElement(resource);
+        if (resourceTreeElement) {
+            resourceTreeElement.reveal();
+            resourceTreeElement.select();
+        }
+
+        if (line) {
+            var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+            view.selectContentTab(true);
+            if (view.revealLine)
+                view.revealLine(line);
+            if (view.highlightLine)
+                view.highlightLine(line);
+        }
+        return true;
+    },
+
+    _showResourceView: function(resource)
     {
         var view = WebInspector.ResourceManager.resourceViewForResource(resource);
         view.headersVisible = false;
@@ -503,14 +529,84 @@ WebInspector.StoragePanel.prototype = {
         this.storageViews.style.left = width + "px";
         this.storageViewStatusBarItemsContainer.style.left = width + "px";
         this.resize();
+    },
+
+    get searchableViews()
+    {
+        var views = [];
+
+        if (!Preferences.networkPanelEnabled)
+            return views;
+
+        const visibleView = this.visibleView;
+        if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
+            views.push(visibleView);
+
+        function callback(resourceTreeElement)
+        {
+            var resource = resourceTreeElement._resource;
+            var resourceView = WebInspector.ResourceManager.resourceViewForResource(resource);
+            if (resourceView.performSearch && resourceView !== visibleView)
+                views.push(resourceView);
+        }
+        this._forAllResourceTreeElements(callback);
+        return views;
+    },
+
+    _forAllResourceTreeElements: function(callback)
+    {
+        var stop = false;
+        for (var treeElement = this.resourcesListTreeElement; !stop && treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.resourcesListTreeElement, true)) {
+            if (treeElement instanceof WebInspector.FrameResourceTreeElement)
+                stop = callback(treeElement);
+        }
+    },
+
+    searchMatchFound: function(view, matches)
+    {
+        if (!view.resource)
+            return;
+        var treeElement = this.sidebarTree.findTreeElement(view.resource);
+        if (treeElement)
+            treeElement.searchMatchFound(matches);
+    },
+
+    searchCanceled: function(startingNewSearch)
+    {
+        WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+
+        if (startingNewSearch)
+            return;
+
+        function callback(resourceTreeElement)
+        {
+            resourceTreeElement._errorsWarningsUpdated();
+        }
+        this._forAllResourceTreeElements(callback);
+    },
+
+    performSearch: function(query)
+    {
+        function callback(resourceTreeElement)
+        {
+            resourceTreeElement._resetBubble();
+        }
+        this._forAllResourceTreeElements(callback);
+        WebInspector.Panel.prototype.performSearch.call(this, query);
+    },
+
+    showView: function(view)
+    {
+        if (view)
+            this.showResource(view.resource);
     }
 }
 
 WebInspector.StoragePanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
-WebInspector.BaseStorageTreeElement = function(storagePanel, title, iconClass, hasChildren)
+WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
 {
-    TreeElement.call(this, "", null, hasChildren);
+    TreeElement.call(this, "", representedObject, hasChildren);
     this._storagePanel = storagePanel;
     this._titleText = title;
     this._iconClass = iconClass;
@@ -526,9 +622,9 @@ WebInspector.BaseStorageTreeElement.prototype = {
         this.imageElement.className = "icon";
         this.listItemElement.appendChild(this.imageElement);
 
-        this.titleElement = document.createElement("span");
+        this.titleElement = document.createElement("div");
+        this.titleElement.className = "base-storage-tree-element-title";
         this.titleElement.textContent = this._titleText;
-        this.titleElement.className = "storage-base-tree-element-title";
         this.listItemElement.appendChild(this.titleElement);
 
         var selectionElement = document.createElement("div");
@@ -546,6 +642,16 @@ WebInspector.BaseStorageTreeElement.prototype = {
     {
         this._titleText = titleText;
         this.titleElement.textContent = this._titleText;
+    },
+
+    isEventWithinDisclosureTriangle: function()
+    {
+        // Override it since we use margin-left in place of treeoutline's text-indent.
+        // Hence we need to take padding into consideration. This all is needed for leading
+        // icons in the tree.
+        const paddingLeft = 14;
+        var left = this.listItemElement.totalOffsetLeft + paddingLeft;
+        return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
     }
 }
 
@@ -553,7 +659,7 @@ WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
 
 WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, iconClass)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, categoryName, iconClass, true);
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
     this._categoryName = categoryName;
 }
 
@@ -567,7 +673,7 @@ WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseS
 
 WebInspector.FrameTreeElement = function(storagePanel, frameId, displayName)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, displayName, "frame-storage-tree-item");
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayName, "frame-storage-tree-item");
     this._frameId = frameId;
     this._displayName = displayName;
 }
@@ -593,14 +699,21 @@ WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTree
 
 WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
     this._resource = resource;
+    this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
+    this.tooltip = resource.url;
 }
 
 WebInspector.FrameResourceTreeElement.prototype = {
     onselect: function()
     {
-        this._storagePanel.showResource(this._resource);
+        this._storagePanel._showResourceView(this._resource);
+    },
+
+    ondblclick: function(event)
+    {
+        InspectorBackend.openInInspectedWindow(this._resource.url);
     },
 
     onattach: function()
@@ -617,6 +730,82 @@ WebInspector.FrameResourceTreeElement.prototype = {
             iconElement.appendChild(previewImage);
             this.listItemElement.replaceChild(iconElement, this.imageElement);
         }
+
+        this._statusElement = document.createElement("div");
+        this._statusElement.className = "status";
+        this.listItemElement.insertBefore(this._statusElement, this.titleElement);
+
+        this.listItemElement.draggable = true;
+        this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
+    },
+
+    _ondragstart: function(event)
+    {
+        event.dataTransfer.setData("text/plain", this._resource.url);
+        event.dataTransfer.setData("text/uri-list", this._resource.url + "\r\n");
+        event.dataTransfer.effectAllowed = "copy";
+        return true;
+    },
+
+    _setBubbleText: function(x)
+    {
+        if (!this._bubbleElement) {
+            this._bubbleElement = document.createElement("div");
+            this._bubbleElement.className = "bubble";
+            this._statusElement.appendChild(this._bubbleElement);
+        }
+
+        this._bubbleElement.textContent = x;
+    },
+
+    _resetBubble: function()
+    {
+        if (this._bubbleElement) {
+            this._bubbleElement.textContent = "";
+            this._bubbleElement.removeStyleClass("search-matches");
+            this._bubbleElement.removeStyleClass("warning");
+            this._bubbleElement.removeStyleClass("error");
+        }
+    },
+
+    searchMatchFound: function(matches)
+    {
+        this._resetBubble();
+
+        this._setBubbleText(matches);
+        this._bubbleElement.addStyleClass("search-matches");
+
+        // Expand, do not scroll into view.
+        var currentAncestor = this.parent;
+        while (currentAncestor && !currentAncestor.root) {
+            if (!currentAncestor.expanded)
+                currentAncestor.expand();
+            currentAncestor = currentAncestor.parent;
+        }
+    },
+
+    _errorsWarningsUpdated: function()
+    {
+        // FIXME: move to the Script/SourceView.
+        if (!this._resource.warnings && !this._resource.errors) {
+            var view = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
+            if (view && view.clearMessages)
+                view.clearMessages();
+        }
+
+        if (this._storagePanel.currentQuery)
+            return;
+
+        this._resetBubble();
+
+        if (this._resource.warnings || this._resource.errors)
+            this._setBubbleText(this._resource.warnings + this._resource.errors);
+
+        if (this._resource.warnings)
+            this._bubbleElement.addStyleClass("warning");
+
+        if (this._resource.errors)
+            this._bubbleElement.addStyleClass("error");
     }
 }
 
@@ -624,7 +813,7 @@ WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseSto
 
 WebInspector.DatabaseTreeElement = function(storagePanel, database)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, database.name, "database-storage-tree-item", true);
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
     this._database = database;
 }
 
@@ -659,7 +848,7 @@ WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageT
 
 WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, tableName, "database-storage-tree-item");
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
     this._database = database;
     this._tableName = tableName;
 }
@@ -674,7 +863,7 @@ WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseSto
 
 WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
     this._domStorage = domStorage;
 }
 
@@ -688,7 +877,7 @@ WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorag
 
 WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
     this._cookieDomain = cookieDomain;
 }
 
@@ -702,7 +891,7 @@ WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTre
 
 WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
     this._appcacheDomain = appcacheDomain;
 }
 
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index db29a6a..1031b0e 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -1920,22 +1920,24 @@ body.inactive .sidebar {
 .storage.panel .sidebar {
     border-left: rgb(232, 232, 232);
     background-color: transparent;
-    overflow-x: auto;
-}
-
-.storage.panel .sidebar.outline-disclosure > ol {
-    margin-left: -12px;
-    padding-right: 0px !important;
+    padding-left: 0px;
 }
 
 .storage.panel .outline-disclosure li {
+    height: 17px;
     white-space: nowrap;
+    text-indent: 0;
+    margin-left: -2px;
+}
+
+.storage.panel .outline-disclosure li.parent {
+    text-indent: 0;
+    margin-left: -12px;
 }
 
 .storage.panel .outline-disclosure li .selection {
     height: 17px;
-    margin-left: -100px;
-    display: inline-block;
+    margin-top: -13px;
 }
 
 .storage.panel .sidebar-resizer-vertical {
@@ -1944,25 +1946,31 @@ body.inactive .sidebar {
     border-right: 1px solid gray;
 }
 
-.storage-base-tree-element-title {
-    position: relative;
-    bottom: 4px;
-    left: 3px;
+.storage.panel .outline-disclosure .icon {
+    width: 16px;
+    height: 16px;
+    float: left;
 }
 
-.storage.panel .outline-disclosure ol {
-    -webkit-padding-start: 14px;
+.storage.panel .base-storage-tree-element-title {
+    overflow: hidden;
+    position: relative;
+    text-overflow: ellipsis;
+    padding-left: 2px;
+    top: 1px;
 }
 
-.storage.panel .outline-disclosure li.selected {
-    color: white;
-    background-color: transparent;
+.storage.panel .status {
+    float: right;
+    height: 16px;
+    margin-top: 1px;
+    margin-left: 4px;
+    line-height: 1em;
 }
 
-.storage.panel .outline-disclosure .icon {
-    width: 16px;
-    height: 16px;
-    display: inline-block;
+.storage.panel li .status .bubble {
+    height: 13px;
+    padding-top: 0;
 }
 
 .storage-view {
@@ -3203,7 +3211,7 @@ body.inactive .sidebar-tree-item .disclosure-button:active {
     margin-right: 3px;
 }
 
-.sidebar-tree-item .status {
+li .status {
     float: right;
     height: 16px;
     margin-top: 9px;
@@ -3211,11 +3219,11 @@ body.inactive .sidebar-tree-item .disclosure-button:active {
     line-height: 1em;
 }
 
-.sidebar-tree-item .status:empty {
+li .status:empty {
     display: none;
 }
 
-.sidebar-tree-item .status .bubble {
+li .status .bubble {
     display: inline-block;
     height: 14px;
     min-width: 16px;
@@ -3234,20 +3242,20 @@ body.inactive .sidebar-tree-item .disclosure-button:active {
     -webkit-border-radius: 7px;
 }
 
-.sidebar-tree-item .status .bubble:empty {
+li .status .bubble:empty {
     display: none;
 }
 
-.sidebar-tree-item.selected .status .bubble {
+li.selected .status .bubble {
     background-color: white !important;
     color: rgb(132, 154, 190) !important;
 }
 
-:focus .sidebar-tree-item.selected .status .bubble {
+:focus li.selected .status .bubble {
     color: rgb(36, 98, 172) !important;
 }
 
-body.inactive .sidebar-tree-item.selected .status .bubble {
+body.inactive li.selected .status .bubble {
     color: rgb(159, 159, 159) !important;
 }
 
@@ -3468,15 +3476,15 @@ body.inactive .sidebar-tree-item.selected {
     padding-left: 13px !important;
 }
 
-.sidebar-tree-item.selected .bubble.search-matches {
+li.selected .bubble.search-matches {
     background-image: url(Images/searchSmallBlue.png);
 }
 
-:focus .sidebar-tree-item.selected .bubble.search-matches {
+:focus li.selected .bubble.search-matches {
     background-image: url(Images/searchSmallBrightBlue.png);
 }
 
-body.inactive .sidebar-tree-item.selected .bubble.search-matches {
+body.inactive li.selected .bubble.search-matches {
     background-image: url(Images/searchSmallGray.png);
 }
 
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 4afc474..6ed47ef 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1918,9 +1918,10 @@ WebInspector.doPerformSearch = function(query, forceSearch, isBackwardSearch, re
 
         for (var panelName in this.panels) {
             var panel = this.panels[panelName];
-            if (panel.currentQuery && panel.searchCanceled)
-                panel.searchCanceled();
+            var hadCurrentQuery = !!panel.currentQuery;
             delete panel.currentQuery;
+            if (hadCurrentQuery && panel.searchCanceled)
+                panel.searchCanceled();
         }
 
         this.updateSearchMatchesCount();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list