Changeset 70532 in webkit
- Timestamp:
- Oct 26, 2010 10:06:55 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70531 r70532 1 2010-10-26 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: continue making resources panel optional. 6 https://bugs.webkit.org/show_bug.cgi?id=48261 7 8 This refactoring makes console, audits and extensions tests pass while taking data from 9 resources panel. Network panel as a source is to follow. 10 11 * http/tests/inspector/inspector-test2.js: 12 (initialize_InspectorTest.InspectorTest.completeTest): 13 (initialize_InspectorTest.InspectorTest.evaluateInConsole): 14 (initialize_InspectorTest.InspectorTest.evaluateInPage): 15 (initialize_InspectorTest.InspectorTest.evaluateInPageWithTimeout): 16 (initialize_InspectorTest.InspectorTest.addResult): 17 (initialize_InspectorTest.InspectorTest.addObject): 18 (initialize_InspectorTest.InspectorTest.reloadPage): 19 (initialize_InspectorTest.InspectorTest.reloadPageIfNeeded): 20 (initialize_InspectorTest.InspectorTest.pageReloaded): 21 (initialize_InspectorTest.InspectorTest.runAfterPendingDispatches): 22 (initialize_InspectorTest.InspectorTest.enableResourceTracking): 23 (initialize_InspectorTest.InspectorTest.disableResourceTracking): 24 (initialize_InspectorTest.InspectorTest.findDOMNode): 25 (initialize_InspectorTest.InspectorTest._addSniffer): 26 * http/tests/inspector/resource-parameters.html: 27 * inspector/audits-panel-functional.html: 28 * inspector/styles-source-offsets.html: 29 1 30 2010-10-26 Jeremy Orlow <jorlow@chromium.org> 2 31 -
trunk/LayoutTests/http/tests/inspector/inspector-test2.js
r70525 r70532 7 7 { 8 8 InspectorBackend.didEvaluateForTestInFrontend(InspectorTest.completeTestCallId, ""); 9 } ;9 } 10 10 11 11 InspectorTest.evaluateInConsole = function(code, callback) … … 21 21 callback(commandResult.toMessageElement().textContent); 22 22 }); 23 } ;23 } 24 24 25 25 InspectorTest.evaluateInPage = function(code, callback) 26 26 { 27 27 InjectedScriptAccess.getDefault().evaluate(code, "console", callback || function() {}); 28 } ;28 } 29 29 30 30 InspectorTest.evaluateInPageWithTimeout = function(code, callback) 31 31 { 32 32 InspectorTest.evaluateInPage("setTimeout(unescape('" + escape(code) + "'))", callback); 33 } ;33 } 34 34 35 35 InspectorTest.addResult = function(text) … … 48 48 InspectorTest.evaluateInPage("output(unescape('" + escape(text) + "'))"); 49 49 } 50 } ;50 } 51 51 52 52 InspectorTest.addObject = function(object, nondeterministicProps, prefix, firstLinePrefix) … … 72 72 } 73 73 InspectorTest.addResult(prefix + "}"); 74 } ;74 } 75 75 76 76 InspectorTest.reloadPage = function(callback) 77 77 { 78 78 InspectorTest._reloadPageCallback = callback; 79 80 if (WebInspector.panels.network) 81 WebInspector.panels.network._reset(); 79 82 InspectorBackend.reloadPage(); 80 }; 83 } 84 85 InspectorTest.reloadPageIfNeeded = function(callback) 86 { 87 if (!InspectorTest._pageWasReloaded) 88 InspectorTest.reloadPage(callback); 89 else 90 callback(); 91 } 81 92 82 93 InspectorTest.pageReloaded = function() 83 94 { 95 InspectorTest._pageWasReloaded = true; 84 96 resultsSynchronized = false; 85 97 InspectorTest.addResult("Page reloaded."); … … 89 101 callback(); 90 102 } 91 } ;103 } 92 104 93 105 InspectorTest.runAfterPendingDispatches = function(callback) 94 106 { 95 107 WebInspector.TestController.prototype.runAfterPendingDispatches(callback); 96 } ;108 } 97 109 98 110 InspectorTest.enableResourceTracking = function(callback) 99 111 { 112 if (Preferences.networkPanelEnabled) { 113 InspectorTest.reloadPageIfNeeded(callback); 114 return; 115 } 116 100 117 if (WebInspector.panels.resources.resourceTrackingEnabled) 101 118 callback(); … … 104 121 WebInspector.panels.resources._toggleResourceTracking(); 105 122 } 106 } ;123 } 107 124 108 125 InspectorTest.disableResourceTracking = function() 109 126 { 127 if (Preferences.networkPanelEnabled) 128 return; 129 110 130 if (WebInspector.panels.resources.resourceTrackingEnabled) 111 131 WebInspector.panels.resources._toggleResourceTracking(); 112 } ;132 } 113 133 114 134 InspectorTest.findDOMNode = function(root, filter, callback) … … 151 171 } 152 172 } 153 } ;173 } 154 174 155 175 InspectorTest._addSniffer = function(receiver, methodName, override, opt_sticky) … … 174 194 return result; 175 195 }; 176 } ;196 } 177 197 178 198 }; -
trunk/LayoutTests/http/tests/inspector/resource-parameters.html
r70525 r70532 42 42 function frontend_dumpFormData(testController) 43 43 { 44 var resource = WebInspector.resource URLMap["http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2="];44 var resource = WebInspector.resourceForURL("http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2="); 45 45 46 46 WebInspector.panels.resources._toggleResourceTracking(); -
trunk/LayoutTests/inspector/audits-panel-functional.html
r70525 r70532 34 34 function frontend_runAudits(testController) 35 35 { 36 if (!WebInspector.panels.resources.resourceTrackingEnabled) { 36 if (Preferences.networkPanelEnabled) { 37 if (!WebInspector.panels.network._pageWasReloaded) { 38 WebInspector.panels.network._pageWasReloaded = true; 39 WebInspector.panels.network._reset(); 40 InspectorBackend.reloadPage(); 41 return "refreshing"; 42 } 43 } else if (!WebInspector.panels.resources.resourceTrackingEnabled) { 37 44 WebInspector.panels.resources._toggleResourceTracking(); 38 45 return "refreshing"; … … 53 60 var output = frontend_collectAuditResults(); 54 61 // Avoid influencing tests that require resource tracking to be disabled. 55 WebInspector.panels.resources._toggleResourceTracking(); 62 if (!Preferences.networkPanelEnabled) 63 WebInspector.panels.resources._toggleResourceTracking(); 56 64 testController.runAfterPendingDispatches(function() { 57 65 testController.notifyDone(output.join("\n")); -
trunk/LayoutTests/inspector/styles-source-offsets.html
r70525 r70532 25 25 function frontend_runTest(testController) 26 26 { 27 if (! WebInspector.panels.resources.resourceTrackingEnabled) {27 if (!Preferences.networkPanelEnabled && !WebInspector.panels.resources.resourceTrackingEnabled) { 28 28 WebInspector.panels.resources._toggleResourceTracking(); 29 29 return "refreshing"; -
trunk/WebCore/ChangeLog
r70531 r70532 1 2010-10-26 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: continue making resources panel optional. 4 https://bugs.webkit.org/show_bug.cgi?id=48261 5 6 This refactoring makes console, audits and extensions tests pass while taking data from 7 resources panel. Network panel as a source is to follow. 8 9 * inspector/front-end/AuditLauncherView.js: 10 (WebInspector.AuditLauncherView.prototype._createLauncherUI): 11 * inspector/front-end/AuditsPanel.js: 12 * inspector/front-end/ConsoleView.js: 13 (WebInspector.ConsoleView.prototype.addMessage): 14 * inspector/front-end/CookieItemsView.js: 15 (WebInspector.CookieItemsView.prototype._filterCookiesForDomain.populateResourcesForDocuments): 16 (WebInspector.CookieItemsView.prototype._filterCookiesForDomain): 17 * inspector/front-end/ExtensionServer.js: 18 (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource): 19 (WebInspector.ExtensionServer.prototype._onGetResources): 20 (WebInspector.ExtensionServer.prototype._onGetResourceContent): 21 * inspector/front-end/HAREntry.js: 22 (WebInspector.HARLog.prototype.build): 23 (WebInspector.HARLog.prototype.buildMainResourceTimings): 24 (WebInspector.HARLog.prototype._convertResource): 25 * inspector/front-end/NetworkPanel.js: 26 (WebInspector.NetworkPanel): 27 (WebInspector.NetworkPanel.prototype._reset): 28 (WebInspector.NetworkPanel.prototype.get resources): 29 (WebInspector.NetworkPanel.prototype.addResource): 30 * inspector/front-end/Resource.js: 31 (WebInspector.Resource.prototype.set category): 32 * inspector/front-end/ResourceCategory.js: 33 (WebInspector.ResourceCategory): 34 (WebInspector.ResourceCategory.prototype.toString): 35 * inspector/front-end/ResourceManager.js: 36 (WebInspector.ResourceManager.prototype.identifierForInitialRequest): 37 (WebInspector.ResourceManager.prototype.willSendRequest): 38 (WebInspector.ResourceManager.prototype.didFinishLoading): 39 (WebInspector.ResourceManager.prototype.didFailLoading): 40 (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache): 41 (WebInspector.ResourceManager.prototype.setOverrideContent): 42 (WebInspector.ResourceTreeModel.prototype._callForFrameResources): 43 * inspector/front-end/ResourcesPanel.js: 44 (WebInspector.ResourcesPanel): 45 (WebInspector.ResourcesPanel.prototype.reset): 46 (WebInspector.ResourcesPanel.prototype.addResource): 47 (WebInspector.ResourcesPanel.prototype.removeResource): 48 (WebInspector.ResourcesPanel.prototype._toggleResourceTracking): 49 * inspector/front-end/ScriptsPanel.js: 50 (WebInspector.ScriptsPanel.prototype.addScript): 51 (WebInspector.ScriptsPanel.prototype._resourceLoadingFinished): 52 (WebInspector.ScriptsPanel.prototype._breakpointAdded): 53 * inspector/front-end/StylesSidebarPane.js: 54 (WebInspector.StylePropertyTreeElement.prototype.updateTitle.linkifyURL): 55 * inspector/front-end/inspector.js: 56 (WebInspector._updateFocusedNode): 57 (WebInspector.get networkResources): 58 (WebInspector.forAllResources): 59 (WebInspector.resourceForURL): 60 (WebInspector.updateResource): 61 (WebInspector.domContentEventFired): 62 (WebInspector.loadEventFired): 63 (WebInspector.removeResource): 64 (WebInspector.reset): 65 (WebInspector.displayNameForURL): 66 (WebInspector.linkifyStringAsFragment): 67 (WebInspector.resourceURLForRelatedNode.callback): 68 (WebInspector.resourceURLForRelatedNode): 69 1 70 2010-10-26 Jeremy Orlow <jorlow@chromium.org> 2 71 -
trunk/WebCore/inspector/front-end/AuditLauncherView.js
r70525 r70532 270 270 this.updateResourceTrackingState(); 271 271 this._updateButton(); 272 this._updateResourceProgress(); 272 273 }, 273 274 -
trunk/WebCore/inspector/front-end/AuditsPanel.js
r70525 r70532 131 131 { 132 132 var resources = []; 133 for (var id in WebInspector. resources)134 resources.push(WebInspector. resources[id]);133 for (var id in WebInspector.networkResources) 134 resources.push(WebInspector.networkResources[id]); 135 135 136 136 var rulesRemaining = 0; -
trunk/WebCore/inspector/front-end/ConsoleView.js
r70525 r70532 226 226 227 227 // Add message to the resource panel 228 if (msg.url in WebInspector.resourceURLMap) { 229 msg.resource = WebInspector.resourceURLMap[msg.url]; 230 if (WebInspector.panels.resources) 231 WebInspector.panels.resources.addMessageToResource(msg.resource, msg); 232 } 233 if (WebInspector.resourceManager) 228 if (!Preferences.networkPanelEnabled) { 229 var resource = WebInspector.resourceForURL(msg.url); 230 if (resource) { 231 msg.resource = resource; 232 if (WebInspector.panels.resources) 233 WebInspector.panels.resources.addMessageToResource(msg.resource, msg); 234 } 235 } else 234 236 WebInspector.resourceManager.addConsoleMessage(msg); 235 237 -
trunk/WebCore/inspector/front-end/CookieItemsView.js
r70529 r70532 250 250 this._totalSize = 0; 251 251 252 f or (var id in WebInspector.resources) {253 var resource = WebInspector.resources[id];252 function populateResourcesForDocuments(resource) 253 { 254 254 var url = resource.documentURL.asParsedURL(); 255 255 if (url && url.host == this._cookieDomain) 256 256 resourceURLsForDocumentURL.push(resource.url); 257 257 } 258 WebInspector.forAllResources(populateResourcesForDocuments); 258 259 259 260 for (var i = 0; i < allCookies.length; ++i) { -
trunk/WebCore/inspector/front-end/ExtensionServer.js
r70525 r70532 241 241 var resource = null; 242 242 243 resource = WebInspector. resources[id] || WebInspector.resourceForURL(id);243 resource = WebInspector.networkResources[id] || WebInspector.resourceForURL(id); 244 244 if (!resource) 245 245 return this._status.E_NOTFOUND(typeof id + ": " + id); … … 262 262 function resourceWrapper(id) 263 263 { 264 return WebInspector.extensionServer._convertResource(WebInspector. resources[id]);264 return WebInspector.extensionServer._convertResource(WebInspector.networkResources[id]); 265 265 } 266 266 267 267 var response; 268 268 if (request.id) 269 response = WebInspector. resources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id);270 else 271 response = Object.keys(WebInspector. resources).map(resourceWrapper);269 response = WebInspector.networkResources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id); 270 else 271 response = Object.keys(WebInspector.networkResources).map(resourceWrapper); 272 272 return response; 273 273 }, … … 299 299 for (var i = 0; i < ids.length; ++i) { 300 300 var id = ids[i]; 301 var resource = WebInspector. resources[id];301 var resource = WebInspector.networkResources[id]; 302 302 if (!resource) 303 303 response.push(this._status.E_NOTFOUND(id)); -
trunk/WebCore/inspector/front-end/HAREntry.js
r70525 r70532 181 181 return typeof startTime !== "number" || startTime === -1 ? -1 : Math.round(timing[end] - startTime); 182 182 } 183 } ;183 } 184 184 185 185 WebInspector.HAREntry._toMilliseconds = function(time) … … 204 204 }, 205 205 pages: this._buildPages(), 206 entries: Object.keys(WebInspector. resources).map(this._convertResource)206 entries: Object.keys(WebInspector.networkResources).map(this._convertResource) 207 207 } 208 208 }, … … 222 222 buildMainResourceTimings: function() 223 223 { 224 var resourcesPanel = WebInspector.panels.resources; 225 var startTime = WebInspector.mainResource.startTime; 226 return { 227 onContentLoad: this._pageEventTime(resourcesPanel.mainResourceDOMContentTime), 228 onLoad: this._pageEventTime(resourcesPanel.mainResourceLoadTime), 224 return { 225 onContentLoad: this._pageEventTime(WebInspector.mainResourceDOMContentTime), 226 onLoad: this._pageEventTime(WebInspector.mainResourceLoadTime), 229 227 } 230 228 }, … … 232 230 _convertResource: function(id) 233 231 { 234 return (new WebInspector.HAREntry(WebInspector. resources[id])).build();232 return (new WebInspector.HAREntry(WebInspector.networkResources[id])).build(); 235 233 }, 236 234 … … 242 240 return WebInspector.HAREntry._toMilliseconds(time - startTime); 243 241 } 244 } ;242 } -
trunk/WebCore/inspector/front-end/NetworkPanel.js
r70525 r70532 37 37 38 38 this._resources = []; 39 this._resourcesById = {}; 40 this._lastIdentifier = 0; 39 41 this._staleResources = []; 40 42 this._resourceGridNodes = {}; … … 759 761 760 762 this._resources = []; 763 this._resourcesById = {}; 761 764 this._staleResources = []; 762 765 this._resourceGridNodes = {}; … … 774 777 }, 775 778 779 get resources() 780 { 781 return this._resourcesById; 782 }, 783 776 784 addResource: function(resource) 777 785 { 778 786 this._resources.push(resource); 787 if (!resource.identifier) 788 resource.identifier = "network:" + this._lastIdentifier++; 789 this._resourcesById[resource.identifier] = resource; 779 790 this.refreshResource(resource); 780 791 }, -
trunk/WebCore/inspector/front-end/Resource.js
r70525 r70532 278 278 set category(x) 279 279 { 280 if (this._category === x)281 return;282 283 var oldCategory = this._category;284 if (oldCategory)285 oldCategory.removeResource(this);286 287 280 this._category = x; 288 289 if (this._category)290 this._category.addResource(this);291 281 }, 292 282 -
trunk/WebCore/inspector/front-end/ResourceCategory.js
r70525 r70532 32 32 this.title = title; 33 33 this.color = color; 34 this.resources = [];35 34 } 36 35 37 36 WebInspector.ResourceCategory.prototype = { 38 39 37 toString: function() 40 38 { 41 39 return this.title; 42 },43 44 addResource: function(resource)45 {46 var a = resource;47 var resourcesLength = this.resources.length;48 for (var i = 0; i < resourcesLength; ++i) {49 var b = this.resources[i];50 if (a.lastPathComponentLowerCase && b.lastPathComponentLowerCase)51 if (a.lastPathComponentLowerCase < b.lastPathComponentLowerCase)52 break;53 else if (a.name && b.name)54 if (a.name < b.name)55 break;56 }57 58 this.resources.splice(i, 0, resource);59 },60 61 removeResource: function(resource)62 {63 this.resources.remove(resource, true);64 },65 66 removeAllResources: function(resource)67 {68 this.resources = [];69 40 } 70 41 } -
trunk/WebCore/inspector/front-end/ResourceManager.js
r70525 r70532 69 69 70 70 WebInspector.panels.network.addResource(resource); 71 WebInspector.panels.audits.resourceStarted(resource); 71 72 }, 72 73 … … 100 101 resource.startTime = time; 101 102 102 if (isRedirect) 103 if (isRedirect) { 103 104 WebInspector.panels.network.addResource(resource); 104 else 105 WebInspector.panels.audits.resourceStarted(resource); 106 } else 105 107 WebInspector.panels.network.refreshResource(resource); 106 108 }, … … 187 189 188 190 WebInspector.panels.network.refreshResource(resource); 191 WebInspector.panels.audits.resourceFinished(resource); 189 192 delete this._resourcesById[identifier]; 190 193 }, … … 200 203 201 204 WebInspector.panels.network.refreshResource(resource); 205 WebInspector.panels.audits.resourceFinished(resource); 202 206 delete this._resourcesById[identifier]; 203 207 }, … … 211 215 212 216 WebInspector.panels.network.addResource(resource); 217 WebInspector.panels.audits.resourceStarted(resource); 218 WebInspector.panels.audits.resourceFinished(resource); 213 219 this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource); 214 220 }, … … 230 236 resource.overridenContent = sourceString; 231 237 232 WebInspector.panels.network. addResource(resource);238 WebInspector.panels.network.refreshResource(resource); 233 239 }, 234 240 … … 547 553 { 548 554 var resources = this._resourcesByFrameId[frameId]; 549 for (var i = 0; resources && i < resources.length; ++i) 550 callback(resources[i]); 555 for (var i = 0; resources && i < resources.length; ++i) { 556 if (callback(resources[i])) 557 return true; 558 } 551 559 552 560 var frames = this._subframes[frameId]; 553 561 if (frames) { 554 for (var id in frames) 555 this._callForFrameResources(id, callback); 556 } 562 for (var id in frames) { 563 if (this._callForFrameResources(id, callback)) 564 return true; 565 } 566 } 567 return false; 557 568 } 558 569 } -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r70525 r70532 31 31 { 32 32 WebInspector.Panel.call(this, "resources"); 33 33 this.resourceURLMap = {}; 34 34 this._items = []; 35 35 this._staleItems = []; … … 753 753 this.panelEnablerView.visible = true; 754 754 } 755 this.resourceURLMap = {}; 755 756 }, 756 757 757 758 addResource: function(resource) 758 759 { 760 this.resourceURLMap[resource.url] = resource; 759 761 this._resources.push(resource); 760 762 }, … … 771 773 772 774 delete resource._resourcesView; 775 delete this.resourceURLMap[resource.url]; 773 776 }, 774 777 … … 1083 1086 this.sortingSelectElement.visible = false; 1084 1087 WebInspector.resources = {}; 1085 WebInspector.resourceURLMap = {};1088 this.resourceURLMap = {}; 1086 1089 InspectorBackend.setResourceTrackingEnabled(false, true, callback); 1087 1090 } else { -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r70525 r70532 242 242 this._sourceIDMap[sourceID] = script; 243 243 244 var resource = WebInspector.resource URLMap[sourceURL];244 var resource = WebInspector.resourceForURL(sourceURL); 245 245 if (resource) { 246 246 if (resource.finished) { … … 270 270 { 271 271 var resource = e.target; 272 WebInspector.log("_resourceLoadingFinished:" + resource.url); 272 273 for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) { 273 274 // Bind script to resource. … … 290 291 var sourceFrame; 291 292 if (breakpoint.url) { 292 var resource = WebInspector.resource URLMap[breakpoint.url];293 var resource = WebInspector.resourceForURL(breakpoint.url); 293 294 if (resource && resource.finished) 294 295 sourceFrame = this._sourceFrameForScriptOrResource(resource); -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r70525 r70532 1187 1187 var container = document.createDocumentFragment(); 1188 1188 container.appendChild(document.createTextNode("url(")); 1189 container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, (url in WebInspector.resourceURLMap))); 1189 var hasResource = !!WebInspector.resourceForURL(url); 1190 container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, hasResource)); 1190 1191 container.appendChild(document.createTextNode(")")); 1191 1192 return container; -
trunk/WebCore/inspector/front-end/inspector.js
r70525 r70532 51 51 var WebInspector = { 52 52 resources: {}, 53 resourceURLMap: {},54 53 cookieDomains: {}, 55 54 applicationCacheDomains: {}, … … 453 452 this.currentPanel = this.panels.elements; 454 453 this.panels.elements.updateFocusedNode(nodeId); 454 }, 455 456 get networkResources() 457 { 458 if (Preferences.networkPanelEnabled) 459 return this.panels.network.resources; 460 else 461 return this.resources; 462 }, 463 464 forAllResources: function(callback) 465 { 466 if (Preferences.networkPanelEnabled) 467 WebInspector.resourceManager.forAllResources(callback); 468 else { 469 for (var id in WebInspector.panels.resources.resources) { 470 if (callback(WebInspector.panels.resources.resources[id])) 471 return; 472 } 473 } 474 }, 475 476 resourceForURL: function(url) 477 { 478 if (Preferences.networkPanelEnabled) 479 return this.resourceManager.resourceForURL(url); 480 return this.panels.resources.resourceURLMap[url]; 455 481 } 456 482 } … … 1246 1272 resource = new WebInspector.Resource(identifier, payload.url); 1247 1273 this.resources[identifier] = resource; 1248 this.resourceURLMap[resource.url] = resource;1249 1274 this.panels.resources.addResource(resource); 1250 1275 this.panels.audits.resourceStarted(resource); … … 1318 1343 if (this.panels.network) 1319 1344 this.panels.network.mainResourceDOMContentTime = time; 1345 this.mainResourceDOMContentTime = time; 1320 1346 } 1321 1347 … … 1327 1353 if (this.panels.network) 1328 1354 this.panels.network.mainResourceLoadTime = time; 1355 this.mainResourceLoadTime = time; 1329 1356 } 1330 1357 … … 1338 1365 return; 1339 1366 1340 resource.category.removeResource(resource);1341 delete this.resourceURLMap[resource.url];1342 1367 delete this.resources[identifier]; 1343 1368 … … 1483 1508 this.sessionSettings.reset(); 1484 1509 1485 for (var category in this.resourceCategories)1486 this.resourceCategories[category].removeAllResources();1487 1488 1510 this.resources = {}; 1489 this.resourceURLMap = {};1490 1511 this.cookieDomains = {}; 1491 1512 this.applicationCacheDomains = {}; 1492 1513 this.highlightDOMNode(0); 1493 1514 1494 delete this.mainResource; 1515 if (!Preferences.networkPanelEnabled) 1516 delete this.mainResource; 1495 1517 1496 1518 this.console.clearMessages(); … … 1702 1724 return ""; 1703 1725 1704 if (WebInspector.resourceManager) { 1705 var resource = WebInspector.resourceManager.resourceForURL(url); 1706 if (resource) 1707 return resource.displayName; 1708 } 1709 1710 var resource = this.resourceURLMap[url]; 1726 var resource = this.resourceForURL(url); 1711 1727 if (resource) 1712 1728 return resource.displayName; … … 1726 1742 } 1727 1743 1728 WebInspector.resourceForURL = function(url)1729 {1730 if (url in this.resourceURLMap)1731 return this.resourceURLMap[url];1732 1733 // No direct match found. Search for resources that contain1734 // a substring of the URL.1735 for (var resourceURL in this.resourceURLMap) {1736 if (resourceURL.hasSubstring(url))1737 return this.resourceURLMap[resourceURL];1738 }1739 1740 return null;1741 }1742 1743 1744 WebInspector._choosePanelToShowSourceLine = function(url, line, preferredPanel) 1744 1745 { … … 1789 1790 1790 1791 var realURL = (linkString.indexOf("www.") === 0 ? "http://" + linkString : linkString); 1791 container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, (realURL in WebInspector.resourceURLMap))); 1792 var hasResourceWithURL = !!WebInspector.resourceForURL(realURL); 1793 container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, hasResourceWithURL)); 1792 1794 string = string.substring(linkIndex + linkString.length, string.length); 1793 1795 } … … 1857 1859 1858 1860 // documentURL not found or has bad value 1859 for (var resourceURL in WebInspector.resourceURLMap) { 1860 var parsedURL = resourceURL.asParsedURL(); 1861 if (parsedURL && parsedURL.path === url) 1862 return resourceURL; 1863 } 1864 return url; 1865 }, 1861 var resourceURL = url; 1862 function callback(resource) 1863 { 1864 if (resource.path === url) { 1865 resourceURL = resource.url; 1866 return true; 1867 } 1868 } 1869 WebInspector.forAllResources(callback); 1870 return resourceURL; 1871 } 1866 1872 1867 1873 WebInspector.completeURL = function(baseURL, href)
Note: See TracChangeset
for help on using the changeset viewer.