[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:57:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b4a888c3781194d5570dfb77ac1180a8042f4863
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 13:52:40 2010 +0000

    2010-10-26  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: continue making resources panel optional.
            https://bugs.webkit.org/show_bug.cgi?id=48261
    
            This refactoring makes console, audits and extensions tests pass while taking data from
            resources panel. Network panel as a source is to follow.
    
            * http/tests/inspector/inspector-test2.js:
            (initialize_InspectorTest.InspectorTest.completeTest):
            (initialize_InspectorTest.InspectorTest.evaluateInConsole):
            (initialize_InspectorTest.InspectorTest.evaluateInPage):
            (initialize_InspectorTest.InspectorTest.evaluateInPageWithTimeout):
            (initialize_InspectorTest.InspectorTest.addResult):
            (initialize_InspectorTest.InspectorTest.addObject):
            (initialize_InspectorTest.InspectorTest.reloadPage):
            (initialize_InspectorTest.InspectorTest.reloadPageIfNeeded):
            (initialize_InspectorTest.InspectorTest.pageReloaded):
            (initialize_InspectorTest.InspectorTest.runAfterPendingDispatches):
            (initialize_InspectorTest.InspectorTest.enableResourceTracking):
            (initialize_InspectorTest.InspectorTest.disableResourceTracking):
            (initialize_InspectorTest.InspectorTest.findDOMNode):
            (initialize_InspectorTest.InspectorTest._addSniffer):
            * http/tests/inspector/resource-parameters.html:
            * inspector/audits-panel-functional.html:
            * inspector/styles-source-offsets.html:
    
    2010-10-26  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: continue making resources panel optional.
            https://bugs.webkit.org/show_bug.cgi?id=48261
    
            This refactoring makes console, audits and extensions tests pass while taking data from
            resources panel. Network panel as a source is to follow.
    
            * http/tests/inspector/inspector-test2.js:
            (initialize_InspectorTest.InspectorTest.completeTest):
            (initialize_InspectorTest.InspectorTest.evaluateInConsole):
            (initialize_InspectorTest.InspectorTest.evaluateInPage):
            (initialize_InspectorTest.InspectorTest.evaluateInPageWithTimeout):
            (initialize_InspectorTest.InspectorTest.addResult):
            (initialize_InspectorTest.InspectorTest.addObject):
            (initialize_InspectorTest.InspectorTest.reloadPage):
            (initialize_InspectorTest.InspectorTest.reloadPageIfNeeded):
            (initialize_InspectorTest.InspectorTest.pageReloaded):
            (initialize_InspectorTest.InspectorTest.runAfterPendingDispatches):
            (initialize_InspectorTest.InspectorTest.enableResourceTracking):
            (initialize_InspectorTest.InspectorTest.disableResourceTracking):
            (initialize_InspectorTest.InspectorTest.findDOMNode):
            (initialize_InspectorTest.InspectorTest._addSniffer):
            * http/tests/inspector/resource-parameters.html:
            * inspector/audits-panel-functional.html:
            * inspector/styles-source-offsets.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70518 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dcf60f2..0d0dbcd 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,32 @@
+2010-10-26  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: continue making resources panel optional.
+        https://bugs.webkit.org/show_bug.cgi?id=48261
+
+        This refactoring makes console, audits and extensions tests pass while taking data from
+        resources panel. Network panel as a source is to follow.
+
+        * http/tests/inspector/inspector-test2.js:
+        (initialize_InspectorTest.InspectorTest.completeTest):
+        (initialize_InspectorTest.InspectorTest.evaluateInConsole):
+        (initialize_InspectorTest.InspectorTest.evaluateInPage):
+        (initialize_InspectorTest.InspectorTest.evaluateInPageWithTimeout):
+        (initialize_InspectorTest.InspectorTest.addResult):
+        (initialize_InspectorTest.InspectorTest.addObject):
+        (initialize_InspectorTest.InspectorTest.reloadPage):
+        (initialize_InspectorTest.InspectorTest.reloadPageIfNeeded):
+        (initialize_InspectorTest.InspectorTest.pageReloaded):
+        (initialize_InspectorTest.InspectorTest.runAfterPendingDispatches):
+        (initialize_InspectorTest.InspectorTest.enableResourceTracking):
+        (initialize_InspectorTest.InspectorTest.disableResourceTracking):
+        (initialize_InspectorTest.InspectorTest.findDOMNode):
+        (initialize_InspectorTest.InspectorTest._addSniffer):
+        * http/tests/inspector/resource-parameters.html:
+        * inspector/audits-panel-functional.html:
+        * inspector/styles-source-offsets.html:
+
 2010-10-26  Abhishek Arya  <inferno at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/http/tests/inspector/inspector-test2.js b/LayoutTests/http/tests/inspector/inspector-test2.js
index e73672c..8d97340 100644
--- a/LayoutTests/http/tests/inspector/inspector-test2.js
+++ b/LayoutTests/http/tests/inspector/inspector-test2.js
@@ -6,7 +6,7 @@ var resultsSynchronized = false;
 InspectorTest.completeTest = function()
 {
     InspectorBackend.didEvaluateForTestInFrontend(InspectorTest.completeTestCallId, "");
-};
+}
 
 InspectorTest.evaluateInConsole = function(code, callback)
 {
@@ -20,17 +20,17 @@ InspectorTest.evaluateInConsole = function(code, callback)
             if (callback)
                 callback(commandResult.toMessageElement().textContent);
         });
-};
+}
 
 InspectorTest.evaluateInPage = function(code, callback)
 {
     InjectedScriptAccess.getDefault().evaluate(code, "console", callback || function() {});
-};
+}
 
 InspectorTest.evaluateInPageWithTimeout = function(code, callback)
 {
     InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'))", callback);
-};
+}
 
 InspectorTest.addResult = function(text)
 {
@@ -47,7 +47,7 @@ InspectorTest.addResult = function(text)
     {
         InspectorTest.evaluateInPage("output(unescape('" + escape(text) + "'))");
     }
-};
+}
 
 InspectorTest.addObject = function(object, nondeterministicProps, prefix, firstLinePrefix)
 {
@@ -71,16 +71,28 @@ InspectorTest.addObject = function(object, nondeterministicProps, prefix, firstL
             InspectorTest.addResult(prefixWithName + propValue);
     }
     InspectorTest.addResult(prefix + "}");
-};
+}
 
 InspectorTest.reloadPage = function(callback)
 {
     InspectorTest._reloadPageCallback = callback;
+
+    if (WebInspector.panels.network)
+        WebInspector.panels.network._reset();
     InspectorBackend.reloadPage();
-};
+}
+
+InspectorTest.reloadPageIfNeeded = function(callback)
+{
+    if (!InspectorTest._pageWasReloaded)
+        InspectorTest.reloadPage(callback);
+    else
+        callback();
+}
 
 InspectorTest.pageReloaded = function()
 {
+    InspectorTest._pageWasReloaded = true;
     resultsSynchronized = false;
     InspectorTest.addResult("Page reloaded.");
     if (InspectorTest._reloadPageCallback) {
@@ -88,28 +100,36 @@ InspectorTest.pageReloaded = function()
         delete InspectorTest._reloadPageCallback;
         callback();
     }
-};
+}
 
 InspectorTest.runAfterPendingDispatches = function(callback)
 {
     WebInspector.TestController.prototype.runAfterPendingDispatches(callback);
-};
+}
 
 InspectorTest.enableResourceTracking = function(callback)
 {
+    if (Preferences.networkPanelEnabled) {
+        InspectorTest.reloadPageIfNeeded(callback);
+        return;
+    }
+
     if (WebInspector.panels.resources.resourceTrackingEnabled)
         callback();
     else {
         InspectorTest._reloadPageCallback = callback;
         WebInspector.panels.resources._toggleResourceTracking();
     }
-};
+}
 
 InspectorTest.disableResourceTracking = function()
 {
+    if (Preferences.networkPanelEnabled)
+        return;
+
     if (WebInspector.panels.resources.resourceTrackingEnabled)
         WebInspector.panels.resources._toggleResourceTracking();
-};
+}
 
 InspectorTest.findDOMNode = function(root, filter, callback)
 {
@@ -150,7 +170,7 @@ InspectorTest.findDOMNode = function(root, filter, callback)
                 findDOMNode(children[i]);
         }
     }
-};
+}
 
 InspectorTest._addSniffer = function(receiver, methodName, override, opt_sticky)
 {
@@ -173,7 +193,7 @@ InspectorTest._addSniffer = function(receiver, methodName, override, opt_sticky)
         }
         return result;
     };
-};
+}
 
 };
 
diff --git a/LayoutTests/http/tests/inspector/resource-parameters.html b/LayoutTests/http/tests/inspector/resource-parameters.html
index 1b28bf2..16fb4dc 100644
--- a/LayoutTests/http/tests/inspector/resource-parameters.html
+++ b/LayoutTests/http/tests/inspector/resource-parameters.html
@@ -41,7 +41,7 @@ function frontend_enableResourceTracking(testController)
 
 function frontend_dumpFormData(testController)
 {
-    var resource = WebInspector.resourceURLMap["http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2="];
+    var resource = WebInspector.resourceForURL("http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=");
 
     WebInspector.panels.resources._toggleResourceTracking();
 
diff --git a/LayoutTests/inspector/audits-panel-functional.html b/LayoutTests/inspector/audits-panel-functional.html
index 23fa491..05f5c35 100644
--- a/LayoutTests/inspector/audits-panel-functional.html
+++ b/LayoutTests/inspector/audits-panel-functional.html
@@ -33,7 +33,14 @@ function doit()
 
 function frontend_runAudits(testController)
 {
-    if (!WebInspector.panels.resources.resourceTrackingEnabled) {
+    if (Preferences.networkPanelEnabled) {
+        if (!WebInspector.panels.network._pageWasReloaded) {
+            WebInspector.panels.network._pageWasReloaded = true;
+            WebInspector.panels.network._reset();
+            InspectorBackend.reloadPage();
+            return "refreshing";
+        }
+    } else if (!WebInspector.panels.resources.resourceTrackingEnabled) {
         WebInspector.panels.resources._toggleResourceTracking();
         return "refreshing";
     }
@@ -52,7 +59,8 @@ function frontend_runAudits(testController)
             // Audits are done, check results.
             var output = frontend_collectAuditResults();
             // Avoid influencing tests that require resource tracking to be disabled.
-            WebInspector.panels.resources._toggleResourceTracking();
+            if (!Preferences.networkPanelEnabled)
+                WebInspector.panels.resources._toggleResourceTracking();
             testController.runAfterPendingDispatches(function() {
                 testController.notifyDone(output.join("\n"));
             });
diff --git a/LayoutTests/inspector/styles-source-offsets.html b/LayoutTests/inspector/styles-source-offsets.html
index fcf928f..205f467 100644
--- a/LayoutTests/inspector/styles-source-offsets.html
+++ b/LayoutTests/inspector/styles-source-offsets.html
@@ -24,7 +24,7 @@ function doit()
 
 function frontend_runTest(testController)
 {
-    if (!WebInspector.panels.resources.resourceTrackingEnabled) {
+    if (!Preferences.networkPanelEnabled && !WebInspector.panels.resources.resourceTrackingEnabled) {
         WebInspector.panels.resources._toggleResourceTracking();
         return "refreshing";
     }
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e348d57..cb4df10 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,77 @@
+2010-10-26  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: continue making resources panel optional.
+        https://bugs.webkit.org/show_bug.cgi?id=48261
+
+        This refactoring makes console, audits and extensions tests pass while taking data from
+        resources panel. Network panel as a source is to follow.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::connectFrontend):
+        * inspector/front-end/AuditLauncherView.js:
+        (WebInspector.AuditLauncherView.prototype._createLauncherUI):
+        * inspector/front-end/AuditsPanel.js:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.addMessage):
+        * inspector/front-end/CookieItemsView.js:
+        (WebInspector.CookieItemsView.prototype._filterCookiesForDomain.populateResourcesForDocuments):
+        (WebInspector.CookieItemsView.prototype._filterCookiesForDomain):
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource):
+        (WebInspector.ExtensionServer.prototype._onGetResources):
+        (WebInspector.ExtensionServer.prototype._onGetResourceContent):
+        * inspector/front-end/HAREntry.js:
+        (WebInspector.HARLog.prototype.build):
+        (WebInspector.HARLog.prototype.buildMainResourceTimings):
+        (WebInspector.HARLog.prototype._convertResource):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel):
+        (WebInspector.NetworkPanel.prototype._reset):
+        (WebInspector.NetworkPanel.prototype.get resources):
+        (WebInspector.NetworkPanel.prototype.addResource):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.set category):
+        * inspector/front-end/ResourceCategory.js:
+        (WebInspector.ResourceCategory):
+        (WebInspector.ResourceCategory.prototype.toString):
+        * inspector/front-end/ResourceManager.js:
+        (WebInspector.ResourceManager.prototype.identifierForInitialRequest):
+        (WebInspector.ResourceManager.prototype.willSendRequest):
+        (WebInspector.ResourceManager.prototype.didFinishLoading):
+        (WebInspector.ResourceManager.prototype.didFailLoading):
+        (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
+        (WebInspector.ResourceManager.prototype.setOverrideContent):
+        (WebInspector.ResourceTreeModel.prototype._callForFrameResources):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+        (WebInspector.ResourcesPanel.prototype.reset):
+        (WebInspector.ResourcesPanel.prototype.addResource):
+        (WebInspector.ResourcesPanel.prototype.removeResource):
+        (WebInspector.ResourcesPanel.prototype._toggleResourceTracking):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.addScript):
+        (WebInspector.ScriptsPanel.prototype._resourceLoadingFinished):
+        (WebInspector.ScriptsPanel.prototype._breakpointAdded):
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL):
+        * inspector/front-end/inspector.js:
+        (WebInspector._updateFocusedNode):
+        (WebInspector.get networkResources):
+        (WebInspector.forAllResources):
+        (WebInspector.resourceForURL):
+        (WebInspector.updateResource):
+        (WebInspector.domContentEventFired):
+        (WebInspector.loadEventFired):
+        (WebInspector.removeResource):
+        (WebInspector.reset):
+        (WebInspector.displayNameForURL):
+        (WebInspector.linkifyStringAsFragment):
+        (WebInspector.resourceURLForRelatedNode.callback):
+        (WebInspector.resourceURLForRelatedNode):
+
 2010-10-26  Abhishek Arya  <inferno at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/inspector/front-end/AuditLauncherView.js b/WebCore/inspector/front-end/AuditLauncherView.js
index a922715..d4bbf90 100644
--- a/WebCore/inspector/front-end/AuditLauncherView.js
+++ b/WebCore/inspector/front-end/AuditLauncherView.js
@@ -269,6 +269,7 @@ WebInspector.AuditLauncherView.prototype = {
         this._selectAllClicked(this._selectAllCheckboxElement.checked);
         this.updateResourceTrackingState();
         this._updateButton();
+        this._updateResourceProgress();
     },
 
     _updateResourceProgress: function()
diff --git a/WebCore/inspector/front-end/AuditsPanel.js b/WebCore/inspector/front-end/AuditsPanel.js
index 82be58f..8947f2c 100644
--- a/WebCore/inspector/front-end/AuditsPanel.js
+++ b/WebCore/inspector/front-end/AuditsPanel.js
@@ -130,8 +130,8 @@ WebInspector.AuditsPanel.prototype = {
     _executeAudit: function(categories, resultCallback)
     {
         var resources = [];
-        for (var id in WebInspector.resources)
-            resources.push(WebInspector.resources[id]);
+        for (var id in WebInspector.networkResources)
+            resources.push(WebInspector.networkResources[id]);
 
         var rulesRemaining = 0;
         for (var i = 0; i < categories.length; ++i)
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 1062507..3b3b971 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -225,12 +225,14 @@ WebInspector.ConsoleView.prototype = {
             this._incrementErrorWarningCount(msg);
 
             // Add message to the resource panel
-            if (msg.url in WebInspector.resourceURLMap) {
-                msg.resource = WebInspector.resourceURLMap[msg.url];
-                if (WebInspector.panels.resources)
-                    WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
-            }
-            if (WebInspector.resourceManager)
+            if (!Preferences.networkPanelEnabled) {
+                var resource = WebInspector.resourceForURL(msg.url);
+                if (resource) {
+                    msg.resource = resource;
+                    if (WebInspector.panels.resources)
+                        WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
+                }
+            } else
                 WebInspector.resourceManager.addConsoleMessage(msg);
 
             this.commandSincePreviousMessage = false;
diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js
index 0b05f2a..bedefc2 100644
--- a/WebCore/inspector/front-end/CookieItemsView.js
+++ b/WebCore/inspector/front-end/CookieItemsView.js
@@ -120,12 +120,13 @@ WebInspector.CookieItemsView.prototype = {
         var resourceURLsForDocumentURL = [];
         this._totalSize = 0;
 
-        for (var id in WebInspector.resources) {
-            var resource = WebInspector.resources[id];
+        function populateResourcesForDocuments(resource)
+        {
             var url = resource.documentURL.asParsedURL();
             if (url && url.host == this._cookieDomain)
                 resourceURLsForDocumentURL.push(resource.url);
         }
+        WebInspector.forAllResources(populateResourcesForDocuments);
 
         for (var i = 0; i < allCookies.length; ++i) {
             var pushed = false;
diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js
index 4fd69cf..75361a2 100644
--- a/WebCore/inspector/front-end/ExtensionServer.js
+++ b/WebCore/inspector/front-end/ExtensionServer.js
@@ -240,7 +240,7 @@ WebInspector.ExtensionServer.prototype = {
         var id = message.id;
         var resource = null;
 
-        resource = WebInspector.resources[id] || WebInspector.resourceForURL(id);
+        resource = WebInspector.networkResources[id] || WebInspector.resourceForURL(id);
         if (!resource)
             return this._status.E_NOTFOUND(typeof id + ": " + id);
         if (Preferences.networkPanelEnabled) {
@@ -261,14 +261,14 @@ WebInspector.ExtensionServer.prototype = {
     {
         function resourceWrapper(id)
         {
-            return WebInspector.extensionServer._convertResource(WebInspector.resources[id]);
+            return WebInspector.extensionServer._convertResource(WebInspector.networkResources[id]);
         }
 
         var response;
         if (request.id)
-            response = WebInspector.resources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id);
+            response = WebInspector.networkResources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id);
         else
-            response = Object.keys(WebInspector.resources).map(resourceWrapper);
+            response = Object.keys(WebInspector.networkResources).map(resourceWrapper);
         return response;
     },
 
@@ -298,7 +298,7 @@ WebInspector.ExtensionServer.prototype = {
 
         for (var i = 0; i < ids.length; ++i) {
             var id = ids[i];
-            var resource = WebInspector.resources[id];
+            var resource = WebInspector.networkResources[id];
             if (!resource)
                 response.push(this._status.E_NOTFOUND(id));
             else {
diff --git a/WebCore/inspector/front-end/HAREntry.js b/WebCore/inspector/front-end/HAREntry.js
index 2b8f41b..f3bfb06 100644
--- a/WebCore/inspector/front-end/HAREntry.js
+++ b/WebCore/inspector/front-end/HAREntry.js
@@ -180,7 +180,7 @@ WebInspector.HAREntry.prototype = {
         var startTime = timing[start];
         return typeof startTime !== "number" || startTime === -1 ? -1 : Math.round(timing[end] - startTime);
     }
-};
+}
 
 WebInspector.HAREntry._toMilliseconds = function(time)
 {
@@ -203,7 +203,7 @@ WebInspector.HARLog.prototype = {
                 version: webKitVersion ? webKitVersion[1] : "n/a"
             },
             pages: this._buildPages(),
-            entries: Object.keys(WebInspector.resources).map(this._convertResource)
+            entries: Object.keys(WebInspector.networkResources).map(this._convertResource)
         }
     },
 
@@ -221,17 +221,15 @@ WebInspector.HARLog.prototype = {
 
     buildMainResourceTimings: function()
     {
-        var resourcesPanel = WebInspector.panels.resources;
-        var startTime = WebInspector.mainResource.startTime;
         return {
-             onContentLoad: this._pageEventTime(resourcesPanel.mainResourceDOMContentTime),
-             onLoad: this._pageEventTime(resourcesPanel.mainResourceLoadTime),
+             onContentLoad: this._pageEventTime(WebInspector.mainResourceDOMContentTime),
+             onLoad: this._pageEventTime(WebInspector.mainResourceLoadTime),
         }
     },
 
     _convertResource: function(id)
     {
-        return (new WebInspector.HAREntry(WebInspector.resources[id])).build();
+        return (new WebInspector.HAREntry(WebInspector.networkResources[id])).build();
     },
 
     _pageEventTime: function(time)
@@ -241,4 +239,4 @@ WebInspector.HARLog.prototype = {
             return -1;
         return WebInspector.HAREntry._toMilliseconds(time - startTime);
     }
-};
+}
diff --git a/WebCore/inspector/front-end/NetworkPanel.js b/WebCore/inspector/front-end/NetworkPanel.js
index 7cbad5b..e31ff0d 100644
--- a/WebCore/inspector/front-end/NetworkPanel.js
+++ b/WebCore/inspector/front-end/NetworkPanel.js
@@ -36,6 +36,8 @@ WebInspector.NetworkPanel = function()
     this.sidebarElement.className = "network-sidebar";
 
     this._resources = [];
+    this._resourcesById = {};
+    this._lastIdentifier = 0;
     this._staleResources = [];
     this._resourceGridNodes = {};
     this._mainResourceLoadTime = -1;
@@ -758,6 +760,7 @@ WebInspector.NetworkPanel.prototype = {
             this._calculator.reset();
 
         this._resources = [];
+        this._resourcesById = {};
         this._staleResources = [];
         this._resourceGridNodes = {};
 
@@ -773,9 +776,17 @@ WebInspector.NetworkPanel.prototype = {
         this._resetSummaryBar();
     },
 
+    get resources()
+    {
+        return this._resourcesById;
+    },
+
     addResource: function(resource)
     {
         this._resources.push(resource);
+        if (!resource.identifier)
+            resource.identifier = "network:" + this._lastIdentifier++;
+        this._resourcesById[resource.identifier] = resource;
         this.refreshResource(resource);
     },
 
diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js
index 716b5d7..817af0e 100644
--- a/WebCore/inspector/front-end/Resource.js
+++ b/WebCore/inspector/front-end/Resource.js
@@ -274,17 +274,7 @@ WebInspector.Resource.prototype = {
 
     set category(x)
     {
-        if (this._category === x)
-            return;
-
-        var oldCategory = this._category;
-        if (oldCategory)
-            oldCategory.removeResource(this);
-
         this._category = x;
-
-        if (this._category)
-            this._category.addResource(this);
     },
 
     get cached()
diff --git a/WebCore/inspector/front-end/ResourceCategory.js b/WebCore/inspector/front-end/ResourceCategory.js
index 7d95a1f..43c7c2b 100644
--- a/WebCore/inspector/front-end/ResourceCategory.js
+++ b/WebCore/inspector/front-end/ResourceCategory.js
@@ -31,40 +31,11 @@ WebInspector.ResourceCategory = function(name, title, color)
     this.name = name;
     this.title = title;
     this.color = color;
-    this.resources = [];
 }
 
 WebInspector.ResourceCategory.prototype = {
-
     toString: function()
     {
         return this.title;
-    },
-
-    addResource: function(resource)
-    {
-        var a = resource;
-        var resourcesLength = this.resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var b = this.resources[i];
-            if (a.lastPathComponentLowerCase && b.lastPathComponentLowerCase)
-                if (a.lastPathComponentLowerCase < b.lastPathComponentLowerCase)
-                    break;
-            else if (a.name && b.name)
-                if (a.name < b.name)
-                    break;
-        }
-
-        this.resources.splice(i, 0, resource);
-    },
-
-    removeResource: function(resource)
-    {
-        this.resources.remove(resource, true);
-    },
-
-    removeAllResources: function(resource)
-    {
-        this.resources = [];
     }
 }
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index 5ca5532..8eb7f04 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -68,6 +68,7 @@ WebInspector.ResourceManager.prototype = {
         }
 
         WebInspector.panels.network.addResource(resource);
+        WebInspector.panels.audits.resourceStarted(resource);
     },
 
     _createResource: function(identifier, url, loader)
@@ -99,9 +100,10 @@ WebInspector.ResourceManager.prototype = {
         resource.requestFormData = request.requestFormData;
         resource.startTime = time;
 
-        if (isRedirect)
+        if (isRedirect) {
             WebInspector.panels.network.addResource(resource);
-        else
+            WebInspector.panels.audits.resourceStarted(resource);
+        } else 
             WebInspector.panels.network.refreshResource(resource);
     },
 
@@ -186,6 +188,7 @@ WebInspector.ResourceManager.prototype = {
         resource.endTime = finishTime;
 
         WebInspector.panels.network.refreshResource(resource);
+        WebInspector.panels.audits.resourceFinished(resource);
         delete this._resourcesById[identifier];
     },
 
@@ -199,6 +202,7 @@ WebInspector.ResourceManager.prototype = {
         resource.endTime = time;
 
         WebInspector.panels.network.refreshResource(resource);
+        WebInspector.panels.audits.resourceFinished(resource);
         delete this._resourcesById[identifier];
     },
 
@@ -210,6 +214,8 @@ WebInspector.ResourceManager.prototype = {
         resource.startTime = resource.responseReceivedTime = resource.endTime = time;
 
         WebInspector.panels.network.addResource(resource);
+        WebInspector.panels.audits.resourceStarted(resource);
+        WebInspector.panels.audits.resourceFinished(resource);
         this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
     },
 
@@ -229,7 +235,7 @@ WebInspector.ResourceManager.prototype = {
         resource.type = WebInspector.Resource.Type[type];
         resource.overridenContent = sourceString;
 
-        WebInspector.panels.network.addResource(resource);
+        WebInspector.panels.network.refreshResource(resource);
     },
 
     didCommitLoadForFrame: function(parentFrameId, loader)
@@ -546,13 +552,18 @@ WebInspector.ResourceTreeModel.prototype = {
     _callForFrameResources: function(frameId, callback)
     {
         var resources = this._resourcesByFrameId[frameId];
-        for (var i = 0; resources && i < resources.length; ++i)
-            callback(resources[i]);
+        for (var i = 0; resources && i < resources.length; ++i) {
+            if (callback(resources[i]))
+                return true;
+        }
         
         var frames = this._subframes[frameId];
         if (frames) {
-            for (var id in frames)
-                this._callForFrameResources(id, callback);
+            for (var id in frames) {
+                if (this._callForFrameResources(id, callback))
+                    return true;
+            }
         }
+        return false;
     }
 }
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 2cb399b..cba0cae 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -30,7 +30,7 @@
 WebInspector.ResourcesPanel = function()
 {
     WebInspector.Panel.call(this, "resources");
-
+    this.resourceURLMap = {};
     this._items = [];
     this._staleItems = [];
 
@@ -752,10 +752,12 @@ WebInspector.ResourcesPanel.prototype = {
             this.sortingSelectElement.addStyleClass("hidden");
             this.panelEnablerView.visible = true;
         }
+        this.resourceURLMap = {};
     },
 
     addResource: function(resource)
     {
+        this.resourceURLMap[resource.url] = resource;
         this._resources.push(resource);
     },
 
@@ -770,6 +772,7 @@ WebInspector.ResourcesPanel.prototype = {
         resource.errors = 0;
 
         delete resource._resourcesView;
+        delete this.resourceURLMap[resource.url];
     },
 
     addMessageToResource: function(resource, msg)
@@ -1082,7 +1085,7 @@ WebInspector.ResourcesPanel.prototype = {
             this.largerResourcesButton.visible = false;
             this.sortingSelectElement.visible = false;
             WebInspector.resources = {};
-            WebInspector.resourceURLMap = {};
+            this.resourceURLMap = {};
             InspectorBackend.setResourceTrackingEnabled(false, true, callback);
         } else {
             this.largerResourcesButton.visible = true;
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index d6f86b6..7559ba6 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -241,9 +241,12 @@ WebInspector.ScriptsPanel.prototype = {
         var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, scriptWorldType);
         this._sourceIDMap[sourceID] = script;
 
-        var resource = WebInspector.resourceURLMap[sourceURL];
+        WebInspector.log("addScript:" + sourceURL);
+        var resource = WebInspector.resourceForURL(sourceURL);
         if (resource) {
+            WebInspector.log("resource:" + resource.url);
             if (resource.finished) {
+                WebInspector.log("resource finished:" + resource.url);
                 // Resource is finished, bind the script right away.
                 resource.addScript(script);
                 this._sourceIDMap[sourceID] = resource;
@@ -269,6 +272,7 @@ WebInspector.ScriptsPanel.prototype = {
     _resourceLoadingFinished: function(e)
     {
         var resource = e.target;
+        WebInspector.log("_resourceLoadingFinished:" + resource.url);
         for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) {
             // Bind script to resource.
             var script = resource._scriptsPendingResourceLoad[i];
@@ -289,7 +293,7 @@ WebInspector.ScriptsPanel.prototype = {
 
         var sourceFrame;
         if (breakpoint.url) {
-            var resource = WebInspector.resourceURLMap[breakpoint.url];
+            var resource = WebInspector.resourceForURL(breakpoint.url);
             if (resource && resource.finished)
                 sourceFrame = this._sourceFrameForScriptOrResource(resource);
         }
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index 36d854c..138fbfc 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -1186,7 +1186,8 @@ WebInspector.StylePropertyTreeElement.prototype = {
             {
                 var container = document.createDocumentFragment();
                 container.appendChild(document.createTextNode("url("));
-                container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, (url in WebInspector.resourceURLMap)));
+                var hasResource = !!WebInspector.resourceForURL(url);
+                container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, hasResource));
                 container.appendChild(document.createTextNode(")"));
                 return container;
             }
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 8936741..cc950cf 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -50,7 +50,6 @@
 
 var WebInspector = {
     resources: {},
-    resourceURLMap: {},
     cookieDomains: {},
     applicationCacheDomains: {},
     missingLocalizedStrings: {},
@@ -452,6 +451,33 @@ var WebInspector = {
     {
         this.currentPanel = this.panels.elements;
         this.panels.elements.updateFocusedNode(nodeId);
+    },
+
+    get networkResources()
+    {
+        if (Preferences.networkPanelEnabled)
+            return this.panels.network.resources;
+        else
+            return this.resources;
+    },
+
+    forAllResources: function(callback)
+    {
+        if (Preferences.networkPanelEnabled)
+            WebInspector.resourceManager.forAllResources(callback);
+        else {
+            for (var id in WebInspector.panels.resources.resources) {
+                if (callback(WebInspector.panels.resources.resources[id]))
+                    return;
+            }
+        }
+    },
+
+    resourceForURL: function(url)
+    {
+        if (Preferences.networkPanelEnabled)
+            return this.resourceManager.resourceForURL(url);
+        return this.panels.resources.resourceURLMap[url];
     }
 }
 
@@ -1245,7 +1271,6 @@ WebInspector.updateResource = function(payload)
     if (!resource) {
         resource = new WebInspector.Resource(identifier, payload.url);
         this.resources[identifier] = resource;
-        this.resourceURLMap[resource.url] = resource;
         this.panels.resources.addResource(resource);
         this.panels.audits.resourceStarted(resource);
     }
@@ -1317,6 +1342,7 @@ WebInspector.domContentEventFired = function(time)
     this.panels.audits.mainResourceDOMContentTime = time;
     if (this.panels.network)
         this.panels.network.mainResourceDOMContentTime = time;
+    this.mainResourceDOMContentTime = time;
 }
 
 WebInspector.loadEventFired = function(time)
@@ -1326,6 +1352,7 @@ WebInspector.loadEventFired = function(time)
     this.panels.audits.mainResourceLoadTime = time;
     if (this.panels.network)
         this.panels.network.mainResourceLoadTime = time;
+    this.mainResourceLoadTime = time;
 }
 
 WebInspector.removeResource = function(identifier)
@@ -1337,8 +1364,6 @@ WebInspector.removeResource = function(identifier)
     if (!resource)
         return;
 
-    resource.category.removeResource(resource);
-    delete this.resourceURLMap[resource.url];
     delete this.resources[identifier];
 
     if (this.panels.resources)
@@ -1482,16 +1507,13 @@ WebInspector.reset = function()
 
     this.sessionSettings.reset();
 
-    for (var category in this.resourceCategories)
-        this.resourceCategories[category].removeAllResources();
-
     this.resources = {};
-    this.resourceURLMap = {};
     this.cookieDomains = {};
     this.applicationCacheDomains = {};
     this.highlightDOMNode(0);
 
-    delete this.mainResource;
+    if (!Preferences.networkPanelEnabled)
+        delete this.mainResource;
 
     this.console.clearMessages();
     this.extensionServer.notifyInspectorReset();
@@ -1701,13 +1723,7 @@ WebInspector.displayNameForURL = function(url)
     if (!url)
         return "";
 
-    if (WebInspector.resourceManager) {
-        var resource = WebInspector.resourceManager.resourceForURL(url);
-        if (resource)
-            return resource.displayName;
-    }
-
-    var resource = this.resourceURLMap[url];
+    var resource = this.resourceForURL(url);
     if (resource)
         return resource.displayName;
 
@@ -1725,21 +1741,6 @@ WebInspector.displayNameForURL = function(url)
     return url.trimURL(WebInspector.mainResource.domain);
 }
 
-WebInspector.resourceForURL = function(url)
-{
-    if (url in this.resourceURLMap)
-        return this.resourceURLMap[url];
-
-    // No direct match found. Search for resources that contain
-    // a substring of the URL.
-    for (var resourceURL in this.resourceURLMap) {
-        if (resourceURL.hasSubstring(url))
-            return this.resourceURLMap[resourceURL];
-    }
-
-    return null;
-}
-
 WebInspector._choosePanelToShowSourceLine = function(url, line, preferredPanel)
 {
     preferredPanel = preferredPanel || "resources";
@@ -1788,7 +1789,8 @@ WebInspector.linkifyStringAsFragment = function(string)
             title = WebInspector.panels.profiles.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);
 
         var realURL = (linkString.indexOf("www.") === 0 ? "http://" + linkString : linkString);
-        container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, (realURL in WebInspector.resourceURLMap)));
+        var hasResourceWithURL = !!WebInspector.resourceForURL(realURL);
+        container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, hasResourceWithURL));
         string = string.substring(linkIndex + linkString.length, string.length);
     }
 
@@ -1856,13 +1858,17 @@ WebInspector.resourceURLForRelatedNode = function(node, url)
     }
 
     // documentURL not found or has bad value
-    for (var resourceURL in WebInspector.resourceURLMap) {
-        var parsedURL = resourceURL.asParsedURL();
-        if (parsedURL && parsedURL.path === url)
-            return resourceURL;
+    var resourceURL = url;
+    function callback(resource)
+    {
+        if (resource.path === url) {
+            resourceURL = resource.url;
+            return true;
+        }
     }
-    return url;
-},
+    WebInspector.forAllResources(callback);
+    return resourceURL;
+}
 
 WebInspector.completeURL = function(baseURL, href)
 {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list