X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebInspectorUI%2FUserInterface%2FModels%2FScript.js;h=8340c35cae6a45aab06f28efdbc7ea21738beccc;hp=b4c9e29fece029da99699006ff827c04882ed0de;hb=d66075500dcd46d398a6b3aa475f0947d5a533cb;hpb=6a5d90c968782e2196a1f576a19f74ae9a50e0da diff --git a/Source/WebInspectorUI/UserInterface/Models/Script.js b/Source/WebInspectorUI/UserInterface/Models/Script.js index b4c9e29fece0..8340c35cae6a 100644 --- a/Source/WebInspectorUI/UserInterface/Models/Script.js +++ b/Source/WebInspectorUI/UserInterface/Models/Script.js @@ -110,22 +110,15 @@ WebInspector.Script.prototype = { return this._scriptSyntaxTree; }, - canRequestContentFromBackend: function() - { - // We can request content if we have an id. - return !!this._id; - }, - requestContentFromBackend: function(callback) { if (!this._id) { // There is no identifier to request content with. Return false to cause the // pending callbacks to get null content. - return false; + return Promise.reject({ message: "There is no identifier to request content with." }); } - DebuggerAgent.getScriptSource(this._id, callback); - return true; + return DebuggerAgent.getScriptSource.promise(this._id); }, saveIdentityToCookie: function(cookie) @@ -155,8 +148,10 @@ WebInspector.Script.prototype = { return; } - this.requestContent(function(error, sourceText) { - makeSyntaxTreeAndCallCallback(error ? null : sourceText); + this.requestContent().then(function(parameters) { + makeSyntaxTreeAndCallCallback(parameters.content); + }).catch(function(error) { + makeSyntaxTreeAndCallCallback(null); }); },