Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1436)

Unified Diff: Source/devtools/front_end/resources/ResourcesPanel.js

Issue 667743002: DevTools: remove "type" getters in Resource and NetworkRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/network/RequestView.js ('k') | Source/devtools/front_end/sdk/NetworkManager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..09c7c39c0de65696509ab40429227394008db85b 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(String(this._resource.warnings + this._resource.errors));
if (this._resource.warnings)
this._bubbleElement.classList.add("warning");
« no previous file with comments | « Source/devtools/front_end/network/RequestView.js ('k') | Source/devtools/front_end/sdk/NetworkManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698