Title: [101126] trunk
Revision
101126
Author
pfeld...@chromium.org
Date
2011-11-24 00:11:05 -0800 (Thu, 24 Nov 2011)

Log Message

Web Inspector: get rid of the WebInspector.mainResource, use WebInspector.inspectedPageURL instead.
https://bugs.webkit.org/show_bug.cgi?id=73024

Source/WebCore:

We use it for the URL mostly, no need to create artificial resource for that upon
attaching to the existing page.

Reviewed by Yury Semikhatsky.

* inspector/front-end/AuditsPanel.js:
* inspector/front-end/HAREntry.js:
(WebInspector.HARLog.prototype._buildPages):
(WebInspector.HARLog.prototype._pageEventTime):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._updateSummaryBar):
(WebInspector.NetworkLogView.prototype._exportAll):
* inspector/front-end/Resource.js:
(WebInspector.Resource.prototype.set url):
(WebInspector.Resource.prototype.get displayName):
(WebInspector.Resource.prototype.get displayDomain):
* inspector/front-end/ResourceTreeModel.js:
(WebInspector.ResourceTreeModel.prototype._processCachedResources):
(WebInspector.ResourceTreeModel.prototype._dispatchInspectedURLChanged):
(WebInspector.ResourceTreeModel.prototype._frameNavigated):
(WebInspector.ResourceTreeModel.prototype._addFramesRecursively):
* inspector/front-end/ResourceUtils.js:
(WebInspector.displayNameForURL):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype._initDefaultSelection):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._addRecordToTimeline):
* inspector/front-end/utilities.js:
(String.prototype.asParsedURL):

LayoutTests:

Reviewed by Yury Semikhatsky.

* inspector/debugger/debugger-breakpoints-not-activated-on-reload.html:
* inspector/debugger/debugger-scripts.html:
* inspector/debugger/linkifier.html:
* inspector/debugger/selected-call-frame-after-formatting-source.html:
* inspector/debugger/watch-expressions-panel-switch.html:
* inspector/extensions/extensions-events.html:
* inspector/performance/resources/first-open-resources.html:
* inspector/performance/resources/performance-test.js:
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
(initialize_TimeTracker.InspectorTest.runPerformanceTest):
* inspector/performance/resources/show-panel.html:
* inspector/styles/styles-history.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101125 => 101126)


--- trunk/LayoutTests/ChangeLog	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/ChangeLog	2011-11-24 08:11:05 UTC (rev 101126)
@@ -1,3 +1,23 @@
+2011-11-23  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: get rid of the WebInspector.mainResource, use WebInspector.inspectedPageURL instead.
+        https://bugs.webkit.org/show_bug.cgi?id=73024
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/debugger-breakpoints-not-activated-on-reload.html:
+        * inspector/debugger/debugger-scripts.html:
+        * inspector/debugger/linkifier.html:
+        * inspector/debugger/selected-call-frame-after-formatting-source.html:
+        * inspector/debugger/watch-expressions-panel-switch.html:
+        * inspector/extensions/extensions-events.html:
+        * inspector/performance/resources/first-open-resources.html:
+        * inspector/performance/resources/performance-test.js:
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest):
+        * inspector/performance/resources/show-panel.html:
+        * inspector/styles/styles-history.html:
+
 2011-11-23  Csaba Osztrogonác  <o...@webkit.org>
 
         [Qt] Couple of tests have different results on 64 bit and/or in debug mode compared to 32 bit and/or release mode

Modified: trunk/LayoutTests/inspector/debugger/debugger-breakpoints-not-activated-on-reload.html (101125 => 101126)


--- trunk/LayoutTests/inspector/debugger/debugger-breakpoints-not-activated-on-reload.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/debugger/debugger-breakpoints-not-activated-on-reload.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -11,7 +11,7 @@
 
 var test = function()
 {
-    var testName = WebInspector.mainResource.url;
+    var testName = WebInspector.inspectedPageURL;
     testName = testName.substring(testName.lastIndexOf('/') + 1);
 
     InspectorTest.startDebuggerTest(step1);

Modified: trunk/LayoutTests/inspector/debugger/debugger-scripts.html (101125 => 101126)


--- trunk/LayoutTests/inspector/debugger/debugger-scripts.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/debugger/debugger-scripts.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -18,7 +18,7 @@
     function step2(event)
     {
         var script = event.data;
-        if (script.sourceURL !== WebInspector.mainResource.url)
+        if (script.sourceURL !== WebInspector.inspectedPageURL)
             return;
         scripts.push(script);
         if (scripts.length === 6)

Modified: trunk/LayoutTests/inspector/debugger/linkifier.html (101125 => 101126)


--- trunk/LayoutTests/inspector/debugger/linkifier.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/debugger/linkifier.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -21,7 +21,7 @@
                 return;
 
             var script = event.data;
-            if (script.sourceURL === WebInspector.mainResource._documentURL) {
+            if (script.sourceURL === WebInspector.inspectedPageURL) {
                 continued = true;
                 setTimeout(debuggerTest, 0);
             }
@@ -34,10 +34,10 @@
     function debuggerTest()
     {
         linkifier = WebInspector.debuggerPresentationModel.createLinkifier();
-        rawSourceCode = WebInspector.debuggerPresentationModel._rawSourceCodeForScriptWithURL(WebInspector.mainResource._documentURL);
+        rawSourceCode = WebInspector.debuggerPresentationModel._rawSourceCodeForScriptWithURL(WebInspector.inspectedPageURL);
 
         var count1 = listenersCount(rawSourceCode);
-        link = linkifier.linkifyLocation(WebInspector.mainResource._documentURL, 20, 0, "dummy-class");
+        link = linkifier.linkifyLocation(WebInspector.inspectedPageURL, 20, 0, "dummy-class");
         var count2 = listenersCount(rawSourceCode);
 
         InspectorTest.addResult("listeners added on raw source code: " + (count2 - count1));

Modified: trunk/LayoutTests/inspector/debugger/selected-call-frame-after-formatting-source.html (101125 => 101126)


--- trunk/LayoutTests/inspector/debugger/selected-call-frame-after-formatting-source.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/debugger/selected-call-frame-after-formatting-source.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -23,7 +23,7 @@
 
     function step1()
     {
-        var testName = WebInspector.mainResource.url;
+        var testName = WebInspector.inspectedPageURL;
         testName = testName.substring(testName.lastIndexOf('/') + 1);
         InspectorTest.showScriptSource(testName, step2);
     }

Modified: trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html (101125 => 101126)


--- trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -29,7 +29,7 @@
         watchExpressionsSection.watchExpressions.push("windowa.document");
         watchExpressionsSection.update();
 
-        var testName = WebInspector.mainResource.url;
+        var testName = WebInspector.inspectedPageURL;
         testName = testName.substring(testName.lastIndexOf('/') + 1);
         InspectorTest.showScriptSource(testName, didShowScriptSource);
     }

Modified: trunk/LayoutTests/inspector/extensions/extensions-events.html (101125 => 101126)


--- trunk/LayoutTests/inspector/extensions/extensions-events.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/extensions/extensions-events.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -43,7 +43,7 @@
         if (loadCount !== urls.length)
             return;
         if (loadCount === 1)
-            evaluateOnFrontend("InspectorTest.navigate(WebInspector.mainResource.url.substring(0, WebInspector.mainResource.url.indexOf('?')), reply)", onLoad);
+            evaluateOnFrontend("InspectorTest.navigate(WebInspector.inspectedPageURL.substring(0, WebInspector.inspectedPageURL.indexOf('?')), reply)", onLoad);
         else {
             webInspector.network.onNavigated.removeListener(onNavigated);
             for (var i = 0; i < urls.length; ++i)
@@ -57,7 +57,7 @@
         processEvent();
     }
     webInspector.network.onNavigated.addListener(onNavigated);
-    evaluateOnFrontend("InspectorTest.navigate(WebInspector.mainResource.url + '?navigated', reply)", onLoad);
+    evaluateOnFrontend("InspectorTest.navigate(WebInspector.inspectedPageURL + '?navigated', reply)", onLoad);
 }
 
 function extension_testViewShowHide(nextTest)

Modified: trunk/LayoutTests/inspector/performance/resources/first-open-resources.html (101125 => 101126)


--- trunk/LayoutTests/inspector/performance/resources/first-open-resources.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/performance/resources/first-open-resources.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -7,7 +7,7 @@
 function test()
 {
     WebInspector.showPanel("resources");
-    WebInspector.settings.resourcesLastSelectedItem.set(WebInspector.mainResource._documentURL);
+    WebInspector.settings.resourcesLastSelectedItem.set(WebInspector.inspectedPageURL);
 
     function test(timer)
     {

Modified: trunk/LayoutTests/inspector/performance/resources/performance-test.js (101125 => 101126)


--- trunk/LayoutTests/inspector/performance/resources/performance-test.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/performance/resources/performance-test.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -73,7 +73,7 @@
             for (var testName in this._times)
                 InspectorTest.dumpTestStats(testName, this._times[testName]);
 
-            var url = ""
+            var url = ""
             var regExp = /([^\/]+)\.html/;
             var matches = regExp.exec(url);
             InspectorTest.dumpTestStats("heap-delta-kb-" + matches[1], this._heapSizeDeltas, 1024);

Modified: trunk/LayoutTests/inspector/performance/resources/show-panel.html (101125 => 101126)


--- trunk/LayoutTests/inspector/performance/resources/show-panel.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/performance/resources/show-panel.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -26,7 +26,7 @@
     }
 
     WebInspector.showPanel("resources");
-    WebInspector.settings.resourcesLastSelectedItem.set(WebInspector.mainResource._documentURL);
+    WebInspector.settings.resourcesLastSelectedItem.set(WebInspector.inspectedPageURL);
 
     WebInspector.showPanel("network");
     InspectorTest.evaluateInPage("makeXHRRequests(200)", runTest);

Modified: trunk/LayoutTests/inspector/styles/styles-history.html (101125 => 101126)


--- trunk/LayoutTests/inspector/styles/styles-history.html	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/LayoutTests/inspector/styles/styles-history.html	2011-11-24 08:11:05 UTC (rev 101126)
@@ -9,7 +9,7 @@
 
 function test()
 {
-    if (!WebInspector.mainResource)
+    if (!WebInspector.resourceTreeModel._cachedResourcesProcessed)
         WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, runTestSuite);
     else
         runTestSuite();

Modified: trunk/Source/WebCore/ChangeLog (101125 => 101126)


--- trunk/Source/WebCore/ChangeLog	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/ChangeLog	2011-11-24 08:11:05 UTC (rev 101126)
@@ -1,3 +1,38 @@
+2011-11-23  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: get rid of the WebInspector.mainResource, use WebInspector.inspectedPageURL instead.
+        https://bugs.webkit.org/show_bug.cgi?id=73024
+
+        We use it for the URL mostly, no need to create artificial resource for that upon
+        attaching to the existing page.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/AuditsPanel.js:
+        * inspector/front-end/HAREntry.js:
+        (WebInspector.HARLog.prototype._buildPages):
+        (WebInspector.HARLog.prototype._pageEventTime):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype._updateSummaryBar):
+        (WebInspector.NetworkLogView.prototype._exportAll):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.set url):
+        (WebInspector.Resource.prototype.get displayName):
+        (WebInspector.Resource.prototype.get displayDomain):
+        * inspector/front-end/ResourceTreeModel.js:
+        (WebInspector.ResourceTreeModel.prototype._processCachedResources):
+        (WebInspector.ResourceTreeModel.prototype._dispatchInspectedURLChanged):
+        (WebInspector.ResourceTreeModel.prototype._frameNavigated):
+        (WebInspector.ResourceTreeModel.prototype._addFramesRecursively):
+        * inspector/front-end/ResourceUtils.js:
+        (WebInspector.displayNameForURL):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype._initDefaultSelection):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._addRecordToTimeline):
+        * inspector/front-end/utilities.js:
+        (String.prototype.asParsedURL):
+
 2011-11-23  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: exceptions in shared workers should be logged to web inspector console

Modified: trunk/Source/WebCore/inspector/front-end/AuditsPanel.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/AuditsPanel.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/AuditsPanel.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -132,7 +132,7 @@
             rulesRemaining += categories[i].ruleCount;
 
         var results = [];
-        var mainResourceURL = WebInspector.mainResource.url;
+        var mainResourceURL = WebInspector.inspectedPageURL;
 
         function ruleResultReadyCallback(categoryResult, ruleResult)
         {

Modified: trunk/Source/WebCore/inspector/front-end/HAREntry.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/HAREntry.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/HAREntry.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -237,8 +237,8 @@
     {
         return [
             {
-                startedDateTime: new Date(WebInspector.mainResource.startTime * 1000),
-                id: WebInspector.mainResource.documentURL,
+                startedDateTime: new Date(WebInspector.mainResourceStartTime * 1000),
+                id: WebInspector.inspectedPageURL,
                 title: "",
                 pageTimings: this.buildMainResourceTimings()
             }
@@ -260,7 +260,7 @@
 
     _pageEventTime: function(time)
     {
-        var startTime = WebInspector.mainResource.startTime;
+        var startTime = WebInspector.mainResourceStartTime;
         if (time === -1 || startTime === -1)
             return -1;
         return WebInspector.HAREntry._toMilliseconds(time - startTime);

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -392,8 +392,10 @@
                 selectedRequestsNumber++;
                 selectedTransferSize += resourceTransferSize;
             }
-            if (resource === WebInspector.mainResource)
+            if (resource.url ="" WebInspector.inspectedPageURL) {
                 baseTime = resource.startTime;
+                WebInspector.mainResourceStartTime = resource.startTime;
+            }
             if (resource.endTime > maxTime)
                 maxTime = resource.endTime;
         }
@@ -980,7 +982,8 @@
         var harArchive = {
             log: (new WebInspector.HARLog(this._resources)).build()
         };
-        InspectorFrontendHost.saveAs(WebInspector.mainResource.domain + ".har", JSON.stringify(harArchive));
+        
+        InspectorFrontendHost.saveAs(WebInspector.inspectedPageDomain + ".har", JSON.stringify(harArchive));
     },
 
     _exportResource: function(resource)

Modified: trunk/Source/WebCore/inspector/front-end/Resource.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/Resource.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/Resource.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -270,19 +270,7 @@
         this.domain = parsedURL ? parsedURL.host : "";
         this.path = parsedURL ? parsedURL.path : "";
         this.urlFragment = parsedURL ? parsedURL.fragment : "";
-        this.lastPathComponent = "";
-        if (parsedURL && parsedURL.path) {
-            // First cut the query params.
-            var path = parsedURL.path;
-            var indexOfQuery = path.indexOf("?");
-            if (indexOfQuery !== -1)
-                path = path.substring(0, indexOfQuery);
-
-            // Then take last path component.
-            var lastSlashIndex = path.lastIndexOf("/");
-            if (lastSlashIndex !== -1)
-                this.lastPathComponent = path.substring(lastSlashIndex + 1);
-        }
+        this.lastPathComponent = parsedURL ? parsedURL.lastPathComponent : "";
         this.lastPathComponentLowerCase = this.lastPathComponent.toLowerCase();
     },
 
@@ -304,7 +292,7 @@
         if (!this._displayName)
             this._displayName = this.displayDomain;
         if (!this._displayName && this.url)
-            this._displayName = this.url.trimURL(WebInspector.mainResource ? WebInspector.mainResource.domain : "");
+            this._displayName = this.url.trimURL(WebInspector.inspectedPageDomain ? WebInspector.inspectedPageDomain : "");
         if (this._displayName === "/")
             this._displayName = this.url;
         return this._displayName;
@@ -323,7 +311,7 @@
     get displayDomain()
     {
         // WebInspector.Database calls this, so don't access more than this.domain.
-        if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain)))
+        if (this.domain && (!WebInspector.inspectedPageDomain || (WebInspector.inspectedPageDomain && this.domain !== WebInspector.inspectedPageDomain)))
             return this.domain;
         return "";
     },

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


--- trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -31,12 +31,13 @@
 /**
  * @constructor
  * @extends {WebInspector.Object}
+ * @param {WebInspector.NetworkManager} networkManager
  */
 WebInspector.ResourceTreeModel = function(networkManager)
 {
-    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
-    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this);
-    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
+    networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
+    networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this);
+    networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this);
 
     WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this);
     WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._consoleMessageAdded, this);
@@ -84,17 +85,21 @@
 
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);
         this._addFramesRecursively(mainFramePayload);
-        this._dispatchInspectedURLChanged(WebInspector.mainResource.url);
+
+        WebInspector.inspectedPageURL = mainFramePayload.frame.url;
+        WebInspector.inspectedPageDomain = WebInspector.inspectedPageURL.asParsedURL().host;
+
+        this._dispatchInspectedURLChanged();
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);
         WebInspector.Resource.restoreRevisions();
 
         this._cachedResourcesProcessed = true;
     },
 
-    _dispatchInspectedURLChanged: function(url)
+    _dispatchInspectedURLChanged: function()
     {
-        InspectorFrontendHost.inspectedURLChanged(url);
-        this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, url);
+        InspectorFrontendHost.inspectedURLChanged(WebInspector.inspectedPageURL);
+        this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, WebInspector.inspectedPageURL);
     },
 
     _addFrame: function(frame)
@@ -136,8 +141,10 @@
 
         if (isMainFrame) {
             this._cleanupFramesAfterNavigation(frame);
-            if (this.resourceForURL(frame.url))
-                WebInspector.mainResource = this.resourceForURL(frame.url);
+            if (this.resourceForURL(frame.url)) {
+                WebInspector.inspectedPageURL = frame.url;
+                WebInspector.inspectedPageDomain = WebInspector.inspectedPageURL.asParsedURL().host;
+            }
         }
         // Do nothing unless cached resource tree is processed - it will overwrite everything.
         if (!this._cachedResourcesProcessed)
@@ -164,7 +171,7 @@
         }
 
         if (isMainFrame)
-            this._dispatchInspectedURLChanged(frame.url);
+            this._dispatchInspectedURLChanged();
     },
 
     _cleanupFramesAfterNavigation: function(newMainFrame)
@@ -373,7 +380,8 @@
         frameResource.finished = true;
 
         if (!framePayload.parentId) {
-            WebInspector.mainResource = frameResource;
+            WebInspector.inspectedPageURL = frameResource.url;
+            WebInspector.inspectedPageDomain = WebInspector.inspectedPageURL.asParsedURL().host;
             this._currentMainFrameId = framePayload.id;
         }
         this._addFrame(framePayload);
@@ -452,8 +460,3 @@
  * @type {WebInspector.ResourceTreeModel}
  */
 WebInspector.resourceTreeModel = null;
-
-/**
- * @type {WebInspector.Resource}
- */
-WebInspector.mainResource = null;

Modified: trunk/Source/WebCore/inspector/front-end/ResourceUtils.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -58,18 +58,19 @@
     if (resource)
         return resource.displayName;
 
-    if (!WebInspector.mainResource)
+    if (!WebInspector.inspectedPageURL)
         return url.trimURL("");
 
-    var lastPathComponent = WebInspector.mainResource.lastPathComponent;
-    var index = WebInspector.mainResource.url.indexOf(lastPathComponent);
-    if (index !== -1 && index + lastPathComponent.length === WebInspector.mainResource.url.length) {
-        var baseURL = WebInspector.mainResource.url.substring(0, index);
+    var parsedURL = WebInspector.inspectedPageURL.asParsedURL();
+    var lastPathComponent = parsedURL.lastPathComponent;
+    var index = WebInspector.inspectedPageURL.indexOf(lastPathComponent);
+    if (index !== -1 && index + lastPathComponent.length === WebInspector.inspectedPageURL.length) {
+        var baseURL = WebInspector.inspectedPageURL.substring(0, index);
         if (url.indexOf(baseURL) === 0)
             return url.substring(index);
     }
 
-    return url.trimURL(WebInspector.mainResource.domain);
+    return url.trimURL(parsedURL.host);
 }
 
 /**

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


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -131,8 +131,9 @@
             }
         }
 
-        if (WebInspector.mainResource && this.resourcesListTreeElement && this.resourcesListTreeElement.expanded)
-            this.showResource(WebInspector.mainResource);
+        var mainResource = WebInspector.inspectedPageURL && this.resourcesListTreeElement && this.resourcesListTreeElement.expanded && WebInspector.resourceTreeModel.resourceForURL(WebInspector.inspectedPageURL);
+        if (mainResource)
+            this.showResource(mainResource);
     },
 
     _reset: function()

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -388,16 +388,6 @@
 
     _addRecordToTimeline: function(record)
     {
-        if (record.type === WebInspector.TimelineAgent.RecordType.ResourceSendRequest) {
-            var isMainResource = (record.data["requestId"] === WebInspector.mainResource.requestId);
-            if (isMainResource && this._mainRequestId !== record.data["requestId"]) {
-                // We are loading new main resource -> clear the panel. Check above is necessary since
-                // there may be several resource loads with main resource marker upon redirects, redirects are reported with
-                // the original request id.
-                this._mainRequestId = record.data["requestId"];
-                this._clearPanel();
-            }
-        }
         this._model._addRecord(record);
         this._innerAddRecordToTimeline(record, this._rootRecord);
         this._scheduleRefresh(false);

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


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -341,7 +341,7 @@
     this.consoleView = new WebInspector.ConsoleView(WebInspector.WorkerManager.isWorkerFrontend());
 
     this.networkManager = new WebInspector.NetworkManager();
-    this.resourceTreeModel = new WebInspector.ResourceTreeModel();
+    this.resourceTreeModel = new WebInspector.ResourceTreeModel(this.networkManager);
     this.networkLog = new WebInspector.NetworkLog();
     this.domAgent = new WebInspector.DOMAgent();
     new WebInspector._javascript_ContextManager(this.resourceTreeModel, this.consoleView);

Modified: trunk/Source/WebCore/inspector/front-end/utilities.js (101125 => 101126)


--- trunk/Source/WebCore/inspector/front-end/utilities.js	2011-11-24 08:01:21 UTC (rev 101125)
+++ trunk/Source/WebCore/inspector/front-end/utilities.js	2011-11-24 08:11:05 UTC (rev 101126)
@@ -453,6 +453,20 @@
     result.port = match[3];
     result.path = match[4] || "/";
     result.fragment = match[5];
+
+    result.lastPathComponent = "";
+    if (result.path) {
+        // First cut the query params.
+        var path = result.path;
+        var indexOfQuery = path.indexOf("?");
+        if (indexOfQuery !== -1)
+            path = path.substring(0, indexOfQuery);
+
+        // Then take last path component.
+        var lastSlashIndex = path.lastIndexOf("/");
+        if (lastSlashIndex !== -1)
+            result.lastPathComponent = path.substring(lastSlashIndex + 1);
+    } 
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to