Chromium Code Reviews| Index: Source/devtools/front_end/resources/ResourcesPanel.js |
| diff --git a/Source/devtools/front_end/resources/ResourcesPanel.js b/Source/devtools/front_end/resources/ResourcesPanel.js |
| index 92898fee85e9cafca57065ba7ac827853e8cfb34..7a251dc56a96324d367a527346615c8973ee4475 100644 |
| --- a/Source/devtools/front_end/resources/ResourcesPanel.js |
| +++ b/Source/devtools/front_end/resources/ResourcesPanel.js |
| @@ -481,7 +481,7 @@ WebInspector.ResourcesPanel.prototype = { |
| return treeElement.sourceView(); |
| } |
| - switch (resource.type) { |
| + switch (resource.resourceType()) { |
| case WebInspector.resourceTypes.Image: |
| return new WebInspector.ImageView(resource.url, resource.mimeType, resource); |
| case WebInspector.resourceTypes.Font: |
| @@ -1085,15 +1085,19 @@ WebInspector.FrameTreeElement.prototype = { |
| } |
| }, |
| + /** |
| + * @param {!WebInspector.Resource} resource |
| + */ |
| appendResource: function(resource) |
| { |
| if (resource.isHidden()) |
| return; |
| - var categoryName = resource.type.name(); |
| - var categoryElement = resource.type === WebInspector.resourceTypes.Document ? this : this._categoryElements[categoryName]; |
| + var resourceType = resource.resourceType(); |
| + var categoryName = resourceType.name(); |
| + var categoryElement = resourceType === WebInspector.resourceTypes.Document ? this : this._categoryElements[categoryName]; |
| if (!categoryElement) { |
| - categoryElement = new WebInspector.StorageCategoryTreeElement(this._storagePanel, resource.type.categoryTitle(), categoryName, null, true); |
| - this._categoryElements[resource.type.name()] = categoryElement; |
| + categoryElement = new WebInspector.StorageCategoryTreeElement(this._storagePanel, resource.resourceType().categoryTitle(), categoryName, null, true); |
| + this._categoryElements[resourceType.name()] = categoryElement; |
| this._insertInPresentationOrder(this, categoryElement); |
| } |
| var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this._storagePanel, resource); |
| @@ -1161,10 +1165,13 @@ WebInspector.FrameTreeElement.prototype = { |
| /** |
| * @constructor |
| * @extends {WebInspector.BaseStorageTreeElement} |
| + * @param {!WebInspector.ResourcesPanel} storagePanel |
| + * @param {!WebInspector.Resource} resource |
| */ |
| WebInspector.FrameResourceTreeElement = function(storagePanel, resource) |
| { |
| - WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, ["resource-sidebar-tree-item", "resources-type-" + resource.type.name()]); |
| + WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, ["resource-sidebar-tree-item", "resources-type-" + resource.resourceType().name()]); |
| + /** @type {!WebInspector.Resource} */ |
| this._resource = resource; |
| this._resource.addEventListener(WebInspector.Resource.Events.MessageAdded, this._consoleMessageAdded, this); |
| this._resource.addEventListener(WebInspector.Resource.Events.MessagesCleared, this._consoleMessagesCleared, this); |
| @@ -1205,7 +1212,7 @@ WebInspector.FrameResourceTreeElement.prototype = { |
| { |
| WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); |
| - if (this._resource.type === WebInspector.resourceTypes.Image) { |
| + if (this._resource.resourceType() === WebInspector.resourceTypes.Image) { |
| var iconElement = createElementWithClass("div", "icon"); |
| var previewImage = iconElement.createChild("img", "image-resource-icon-preview"); |
| this._resource.populateImageSource(previewImage); |
| @@ -1228,7 +1235,7 @@ WebInspector.FrameResourceTreeElement.prototype = { |
| */ |
| _ondragstart: function(event) |
| { |
| - event.dataTransfer.setData("text/plain", this._resource.content); |
| + event.dataTransfer.setData("text/plain", this._resource.content || ""); |
| event.dataTransfer.effectAllowed = "copy"; |
| return true; |
| }, |
| @@ -1267,7 +1274,7 @@ WebInspector.FrameResourceTreeElement.prototype = { |
| this._resetBubble(); |
| if (this._resource.warnings || this._resource.errors) |
| - this._setBubbleText(this._resource.warnings + this._resource.errors); |
| + this._setBubbleText((this._resource.warnings + this._resource.errors) + ""); |
|
apavlov
2014/10/22 07:40:05
String(this._resource.warnings + this._resource.er
eustas
2014/10/22 08:23:00
Done. Thanks.
|
| if (this._resource.warnings) |
| this._bubbleElement.classList.add("warning"); |