WebCore/ChangeLog

 12010-10-19 Pavel Feldman <pfeldman@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 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
1322010-10-19 Sheriff Bot <webkit.review.bot@gmail.com>
233
334 Unreviewed, rolling out r70034.

WebCore/inspector/front-end/Resource.js

@@WebInspector.Resource.prototype = {
119119
120120 set documentURL(x)
121121 {
122  if (this._documentURL === x)
123  return;
124122 this._documentURL = x;
125123 },
126124

@@WebInspector.Resource.prototype = {
153151
154152 set startTime(x)
155153 {
156  if (this._startTime === x)
157  return;
158 
159154 this._startTime = x;
160 
161  if (WebInspector.panels.resources)
162  WebInspector.panels.resources.refreshResource(this);
163155 },
164156
165157 get responseReceivedTime()

@@WebInspector.Resource.prototype = {
174166
175167 set responseReceivedTime(x)
176168 {
177  if (this._responseReceivedTime === x)
178  return;
179 
180169 this._responseReceivedTime = x;
181 
182  if (WebInspector.panels.resources)
183  WebInspector.panels.resources.refreshResource(this);
184170 },
185171
186172 get endTime()

@@WebInspector.Resource.prototype = {
196182 if (x < this.responseReceivedTime)
197183 this.responseReceivedTime = x;
198184
199  if (this._endTime === x)
200  return;
201 
202185 this._endTime = x;
203 
204  if (WebInspector.panels.resources)
205  WebInspector.panels.resources.refreshResource(this);
206186 },
207187
208188 get duration()

@@WebInspector.Resource.prototype = {
233213
234214 set resourceSize(x)
235215 {
236  if (this._resourceSize === x)
237  return;
238 
239216 this._resourceSize = x;
240 
241  if (WebInspector.panels.resources)
242  WebInspector.panels.resources.refreshResource(this);
243217 },
244218
245219 get transferSize()

@@WebInspector.Resource.prototype = {
255229
256230 set expectedContentLength(x)
257231 {
258  if (this._expectedContentLength === x)
259  return;
260232 this._expectedContentLength = x;
261233 },
262234

@@WebInspector.Resource.prototype = {
306278
307279 if (this._category)
308280 this._category.addResource(this);
309 
310  if (WebInspector.panels.resources) {
311  WebInspector.panels.resources.refreshResource(this);
312  WebInspector.panels.resources.recreateViewForResourceIfNeeded(this);
313  }
314281 },
315282
316283 get cached()

@@WebInspector.Resource.prototype = {
321288 set cached(x)
322289 {
323290 this._cached = x;
324  this.dispatchEventToListeners("cached changed");
325291 },
326292
327293 get mimeType()

@@WebInspector.Resource.prototype = {
331297
332298 set mimeType(x)
333299 {
334  if (this._mimeType === x)
335  return;
336 
337300 this._mimeType = x;
338301 },
339302

@@WebInspector.Resource.prototype = {
380343
381344 get requestHeaders()
382345 {
383  if (this._requestHeaders === undefined)
384  this._requestHeaders = {};
385  return this._requestHeaders;
 346 return this._requestHeaders || {};
386347 },
387348
388349 set requestHeaders(x)
389350 {
390  if (this._requestHeaders === x)
391  return;
392 
393351 this._requestHeaders = x;
394352 delete this._sortedRequestHeaders;
395353

@@WebInspector.Resource.prototype = {
427385
428386 get responseHeaders()
429387 {
430  if (this._responseHeaders === undefined)
431  this._responseHeaders = {};
432  return this._responseHeaders;
 388 return this._responseHeaders || {};
433389 },
434390
435391 set responseHeaders(x)
436392 {
437  if (this._responseHeaders === x)
438  return;
439 
440393 this._responseHeaders = x;
441394 delete this._sortedResponseHeaders;
442395

WebCore/inspector/front-end/ResourcesPanel.js

@@WebInspector.ResourcesPanel.prototype = {
757757 addResource: function(resource)
758758 {
759759 this._resources.push(resource);
760  this.refreshResource(resource);
761760 },
762761
763762 removeResource: function(resource)

@@WebInspector.ResourcesPanel.prototype = {
815814
816815 refreshResource: function(resource)
817816 {
 817 this._recreateViewForResourceIfNeeded(resource);
818818 this.refreshItem(resource);
819819 },
820820
821  recreateViewForResourceIfNeeded: function(resource)
 821 _recreateViewForResourceIfNeeded: function(resource)
822822 {
823823 if (!resource || !resource._resourcesView)
824824 return;
825825
826  var newView = this._createResourceView(resource);
827  if (newView.__proto__ === resource._resourcesView.__proto__)
 826 if (this._resourceViewIsConsistentWithCategory(resource, resource._resourcesView))
828827 return;
829828
 829 var newView = this._createResourceView(resource);
830830 if (!this.currentQuery && resource._itemsTreeElement)
831831 resource._itemsTreeElement.updateErrorsAndWarnings();
832832

@@WebInspector.ResourcesPanel.prototype = {
10681068 this.calculator = this.summaryBar.calculator = selectedOption.calculator;
10691069 },
10701070
 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 }
 1086 },
 1087
10711088 _createResourceView: function(resource)
10721089 {
10731090 switch (resource.category) {

@@WebInspector.ResourceGraph = function(resource)
18191836 this._graphElement.className = "resources-graph-side";
18201837 this._graphElement.addEventListener("mouseover", this.refreshLabelPositions.bind(this), false);
18211838
1822  this._cachedChanged();
 1839 if (this.resource.cached)
 1840 this._graphElement.addStyleClass("resource-cached");
18231841
18241842 this._barAreaElement = document.createElement("div");
18251843 this._barAreaElement.className = "resources-graph-bar-area hidden";

@@WebInspector.ResourceGraph = function(resource)
18431861 this._barAreaElement.appendChild(this._labelRightElement);
18441862
18451863 this._graphElement.addStyleClass("resources-category-" + resource.category.name);
1846 
1847  resource.addEventListener("cached changed", this._cachedChanged, this);
18481864}
18491865
18501866WebInspector.ResourceGraph.prototype = {

@@WebInspector.ResourceGraph.prototype = {
19681984 this._labelLeftElement.title = tooltip;
19691985 this._labelRightElement.title = tooltip;
19701986 this._barRightElement.title = tooltip;
1971  },
19721987
1973  _cachedChanged: function()
1974  {
1975  if (this.resource.cached)
 1988 if (this.resource.cached && !this._graphElement.hasStyleClass("resource-cached"))
19761989 this._graphElement.addStyleClass("resource-cached");
19771990 }
19781991}

WebCore/inspector/front-end/inspector.js

@@WebInspector.updateResource = function(payload)
12811281 if (payload.endTime)
12821282 resource.endTime = payload.endTime;
12831283 }
 1284 this.panels.resources.refreshResource(resource);
12841285}
12851286
12861287WebInspector.domContentEventFired = function(time)