Index: third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js |
index d829e8ffc423712605e86c6f0400e7c641f2a7d5..602c9d52e4c0fcdefd82ec476e23c5da1b85e9bb 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js |
@@ -933,24 +933,23 @@ WebInspector.NetworkRequest.prototype = { |
/** |
* @override |
- * @param {function(?string)} callback |
+ * @return {!Promise<?string>} |
*/ |
- requestContent: function(callback) |
+ requestContent: function() |
{ |
// We do not support content retrieval for WebSockets at the moment. |
// Since WebSockets are potentially long-living, fail requests immediately |
// to prevent caller blocking until resource is marked as finished. |
- if (this._resourceType === WebInspector.resourceTypes.WebSocket) { |
- callback(null); |
- return; |
- } |
- if (typeof this._content !== "undefined") { |
- callback(this.content || null); |
- return; |
- } |
+ if (this._resourceType === WebInspector.resourceTypes.WebSocket) |
+ return Promise.resolve(/** @type {?string} */(null)); |
+ if (typeof this._content !== "undefined") |
+ return Promise.resolve(/** @type {?string} */(this.content || null)); |
+ var callback; |
+ var promise = new Promise(fulfill => callback = fulfill); |
this._pendingContentCallbacks.push(callback); |
if (this.finished) |
this._innerRequestContent(); |
+ return promise; |
pfeldman
2016/01/20 19:23:51
cache promise
|
}, |
/** |