| Index: third_party/WebKit/Source/devtools/front_end/sdk/Script.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
|
| index ed72da66c2ed5e6074d32197a32813bf8116bf57..9614f6277ee469c5f4dfe3d4ada4512d4a6b5fe3 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
|
| @@ -138,14 +138,19 @@ WebInspector.Script.prototype = {
|
|
|
| /**
|
| * @override
|
| - * @param {function(?string)} callback
|
| + * @return {!Promise<?string>}
|
| */
|
| - requestContent: function(callback)
|
| + requestContent: function()
|
| {
|
| - if (this._source) {
|
| - callback(this._source);
|
| - return;
|
| - }
|
| + if (this._source)
|
| + return Promise.resolve(this._source);
|
| + if (!this.scriptId)
|
| + return Promise.resolve(/** @type {?string} */(""));
|
| +
|
| + var callback;
|
| + var promise = new Promise(fulfill => callback = fulfill);
|
| + this.target().debuggerAgent().getScriptSource(this.scriptId, didGetScriptSource.bind(this));
|
| + return promise;
|
|
|
| /**
|
| * @this {WebInspector.Script}
|
| @@ -157,11 +162,6 @@ WebInspector.Script.prototype = {
|
| this._source = WebInspector.Script._trimSourceURLComment(error ? "" : source);
|
| callback(this._source);
|
| }
|
| - if (this.scriptId) {
|
| - // Script failed to parse.
|
| - this.target().debuggerAgent().getScriptSource(this.scriptId, didGetScriptSource.bind(this));
|
| - } else
|
| - callback("");
|
| },
|
|
|
| /**
|
|
|