Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/Resource.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js |
| index 4db1ddc2a7f1040b27a84ea5231ff156ec6ea993..1136eccb090ba39d99a609311c56ca9fcb46f5fc 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js |
| @@ -38,8 +38,10 @@ |
| * @param {!NetworkAgent.LoaderId} loaderId |
| * @param {!WebInspector.ResourceType} type |
| * @param {string} mimeType |
| + * @param {?number} lastModified |
|
dgozman
2016/10/14 18:48:51
Let's pass ?Date instead.
lushnikov
2016/10/14 20:56:27
Done.
|
| + * @param {?number} contentSize |
| */ |
| -WebInspector.Resource = function(target, request, url, documentURL, frameId, loaderId, type, mimeType) |
| +WebInspector.Resource = function(target, request, url, documentURL, frameId, loaderId, type, mimeType, lastModified, contentSize) |
| { |
| WebInspector.SDKObject.call(this, target); |
| this._request = request; |
| @@ -50,6 +52,9 @@ WebInspector.Resource = function(target, request, url, documentURL, frameId, loa |
| this._type = type || WebInspector.resourceTypes.Other; |
| this._mimeType = mimeType; |
| + this._lastModified = lastModified ? new Date(lastModified * 1000) : null; |
| + this._contentSize = contentSize; |
| + |
| /** @type {?string} */ this._content; |
| /** @type {boolean} */ this._contentEncoded; |
| this._pendingContentCallbacks = []; |
| @@ -59,6 +64,28 @@ WebInspector.Resource = function(target, request, url, documentURL, frameId, loa |
| WebInspector.Resource.prototype = { |
| /** |
| + * @return {?Date} |
| + */ |
| + lastModified: function() |
| + { |
| + if (this._lastModified || !this._request) |
| + return this._lastModified; |
| + var lastModifiedHeader = this._request.responseLastModified(); |
| + this._lastModified = lastModifiedHeader ? new Date(lastModifiedHeader) : null; |
| + return this._lastModified; |
| + }, |
| + |
| + /** |
| + * @return {?number} |
| + */ |
| + contentSize: function() |
| + { |
| + if (typeof this._contentSize === "number" || !this._request) |
| + return this._contentSize; |
| + return this._request.resourceSize; |
| + }, |
| + |
| + /** |
| * @return {?WebInspector.NetworkRequest} |
| */ |
| get request() |