Changeset 70045 in webkit
- Timestamp:
- Oct 19, 2010 3:35:21 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70043 r70045 1 2010-10-19 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: do not access ResourcePanel from resources directly. 6 https://bugs.webkit.org/show_bug.cgi?id=47892 7 8 * inspector/front-end/Resource.js: 9 (WebInspector.Resource.prototype.set documentURL): 10 (WebInspector.Resource.prototype.set startTime): 11 (WebInspector.Resource.prototype.set responseReceivedTime): 12 (WebInspector.Resource.prototype.set endTime): 13 (WebInspector.Resource.prototype.set resourceSize): 14 (WebInspector.Resource.prototype.set expectedContentLength): 15 (WebInspector.Resource.prototype.set category): 16 (WebInspector.Resource.prototype.set cached): 17 (WebInspector.Resource.prototype.set mimeType): 18 (WebInspector.Resource.prototype.get requestHeaders): 19 (WebInspector.Resource.prototype.set requestHeaders): 20 (WebInspector.Resource.prototype.get responseHeaders): 21 (WebInspector.Resource.prototype.set responseHeaders): 22 * inspector/front-end/ResourcesPanel.js: 23 (WebInspector.ResourcesPanel.prototype.addResource): 24 (WebInspector.ResourcesPanel.prototype.refreshResource): 25 (WebInspector.ResourcesPanel.prototype._recreateViewForResourceIfNeeded): 26 (WebInspector.ResourcesPanel.prototype._resourceViewIsConsistentWithCategory): 27 (WebInspector.ResourceGraph): 28 (WebInspector.ResourceGraph.prototype.refresh): 29 * inspector/front-end/inspector.js: 30 (WebInspector.updateResource): 31 1 32 2010-10-19 Yuta Kitamura <yutak@chromium.org> 2 33 -
trunk/WebCore/inspector/front-end/Resource.js
r69948 r70045 120 120 set documentURL(x) 121 121 { 122 if (this._documentURL === x)123 return;124 122 this._documentURL = x; 125 123 }, … … 154 152 set startTime(x) 155 153 { 156 if (this._startTime === x)157 return;158 159 154 this._startTime = x; 160 161 if (WebInspector.panels.resources)162 WebInspector.panels.resources.refreshResource(this);163 155 }, 164 156 … … 175 167 set responseReceivedTime(x) 176 168 { 177 if (this._responseReceivedTime === x)178 return;179 180 169 this._responseReceivedTime = x; 181 182 if (WebInspector.panels.resources)183 WebInspector.panels.resources.refreshResource(this);184 170 }, 185 171 … … 197 183 this.responseReceivedTime = x; 198 184 199 if (this._endTime === x)200 return;201 202 185 this._endTime = x; 203 204 if (WebInspector.panels.resources)205 WebInspector.panels.resources.refreshResource(this);206 186 }, 207 187 … … 234 214 set resourceSize(x) 235 215 { 236 if (this._resourceSize === x)237 return;238 239 216 this._resourceSize = x; 240 241 if (WebInspector.panels.resources)242 WebInspector.panels.resources.refreshResource(this);243 217 }, 244 218 … … 256 230 set expectedContentLength(x) 257 231 { 258 if (this._expectedContentLength === x)259 return;260 232 this._expectedContentLength = x; 261 233 }, … … 307 279 if (this._category) 308 280 this._category.addResource(this); 309 310 if (WebInspector.panels.resources) {311 WebInspector.panels.resources.refreshResource(this);312 WebInspector.panels.resources.recreateViewForResourceIfNeeded(this);313 }314 281 }, 315 282 … … 322 289 { 323 290 this._cached = x; 324 this.dispatchEventToListeners("cached changed");325 291 }, 326 292 … … 332 298 set mimeType(x) 333 299 { 334 if (this._mimeType === x)335 return;336 337 300 this._mimeType = x; 338 301 }, … … 381 344 get requestHeaders() 382 345 { 383 if (this._requestHeaders === undefined) 384 this._requestHeaders = {}; 385 return this._requestHeaders; 346 return this._requestHeaders || {}; 386 347 }, 387 348 388 349 set requestHeaders(x) 389 350 { 390 if (this._requestHeaders === x)391 return;392 393 351 this._requestHeaders = x; 394 352 delete this._sortedRequestHeaders; … … 428 386 get responseHeaders() 429 387 { 430 if (this._responseHeaders === undefined) 431 this._responseHeaders = {}; 432 return this._responseHeaders; 388 return this._responseHeaders || {}; 433 389 }, 434 390 435 391 set responseHeaders(x) 436 392 { 437 if (this._responseHeaders === x)438 return;439 440 393 this._responseHeaders = x; 441 394 delete this._sortedResponseHeaders; -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r69948 r70045 758 758 { 759 759 this._resources.push(resource); 760 this.refreshResource(resource);761 760 }, 762 761 … … 816 815 refreshResource: function(resource) 817 816 { 817 this._recreateViewForResourceIfNeeded(resource); 818 818 this.refreshItem(resource); 819 819 }, 820 820 821 recreateViewForResourceIfNeeded: function(resource)821 _recreateViewForResourceIfNeeded: function(resource) 822 822 { 823 823 if (!resource || !resource._resourcesView) 824 824 return; 825 825 826 if (this._resourceViewIsConsistentWithCategory(resource, resource._resourcesView)) 827 return; 828 826 829 var newView = this._createResourceView(resource); 827 if (newView.__proto__ === resource._resourcesView.__proto__)828 return;829 830 830 if (!this.currentQuery && resource._itemsTreeElement) 831 831 resource._itemsTreeElement.updateErrorsAndWarnings(); … … 1067 1067 this.sortingFunction = selectedOption.sortingFunction; 1068 1068 this.calculator = this.summaryBar.calculator = selectedOption.calculator; 1069 }, 1070 1071 _resourceViewIsConsistentWithCategory: function(resource, resourceView) 1072 { 1073 switch (resource.category) { 1074 case WebInspector.resourceCategories.documents: 1075 case WebInspector.resourceCategories.stylesheets: 1076 case WebInspector.resourceCategories.scripts: 1077 case WebInspector.resourceCategories.xhr: 1078 return resourceView.__proto__ === WebInspector.SourceView.prototype; 1079 case WebInspector.resourceCategories.images: 1080 return resourceView.__proto__ === WebInspector.ImageView.prototype; 1081 case WebInspector.resourceCategories.fonts: 1082 return resourceView.__proto__ === WebInspector.FontView.prototype; 1083 default: 1084 return resourceView.__proto__ === WebInspector.ResourceView.prototype; 1085 } 1069 1086 }, 1070 1087 … … 1820 1837 this._graphElement.addEventListener("mouseover", this.refreshLabelPositions.bind(this), false); 1821 1838 1822 this._cachedChanged(); 1839 if (this.resource.cached) 1840 this._graphElement.addStyleClass("resource-cached"); 1823 1841 1824 1842 this._barAreaElement = document.createElement("div"); … … 1844 1862 1845 1863 this._graphElement.addStyleClass("resources-category-" + resource.category.name); 1846 1847 resource.addEventListener("cached changed", this._cachedChanged, this);1848 1864 } 1849 1865 … … 1969 1985 this._labelRightElement.title = tooltip; 1970 1986 this._barRightElement.title = tooltip; 1971 }, 1972 1973 _cachedChanged: function() 1974 { 1975 if (this.resource.cached) 1987 1988 if (this.resource.cached && !this._graphElement.hasStyleClass("resource-cached")) 1976 1989 this._graphElement.addStyleClass("resource-cached"); 1977 1990 } -
trunk/WebCore/inspector/front-end/inspector.js
r69976 r70045 1282 1282 resource.endTime = payload.endTime; 1283 1283 } 1284 this.panels.resources.refreshResource(resource); 1284 1285 } 1285 1286
Note: See TracChangeset
for help on using the changeset viewer.