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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a Created 4 years, 5 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
Index: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
index aa928e594ab7eb4bd2971ab130001827a4f95c43..5dc4ec14b0b9e48e306e635413e20790bf615e0a 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
@@ -58,7 +58,7 @@ WebInspector.DebuggerModel = function(target)
this.enableDebugger();
}
-/** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?string, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */
+/** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?string, functionName: string}} */
WebInspector.DebuggerModel.FunctionDetails;
/**
@@ -664,24 +664,32 @@ WebInspector.DebuggerModel.prototype = {
*/
functionDetails: function(remoteObject, callback)
dgozman 2016/07/07 19:59:23 Should we migrate to promise while we are here?
kozy 2016/07/07 22:59:07 Done.
{
- this._agent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind(this));
+ remoteObject.getOwnPropertiesPromise().then(buildDetails.bind(this));
/**
- * @param {?Protocol.Error} error
- * @param {!DebuggerAgent.FunctionDetails} response
- * @this {WebInspector.DebuggerModel}
+ * @param {!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}} response
+ * @this {!WebInspector.DebuggerModel}
*/
- function didGetDetails(error, response)
+ function buildDetails(response)
{
- if (error) {
+ if (!response || !response.internalProperties) {
callback(null);
return;
}
- var location = response.location;
- var script = this.scriptForId(location.scriptId);
- var rawLocation = script ? this.createRawLocation(script, location.lineNumber, location.columnNumber || 0) : null;
- var sourceURL = script ? script.contentURL() : null;
- callback({location: rawLocation, sourceURL: sourceURL, functionName: response.functionName, scopeChain: response.scopeChain || null});
+ var location = null;
+ var functionName = null;
+ for (var prop of response.internalProperties) {
+ if (prop.name === "[[FunctionLocation]]")
+ location = prop.value;
+ if (prop.name === "[[FunctionName]]")
+ functionName = prop.value;
+ }
+
+ var debuggerLocation = null;
+ if (location)
+ debuggerLocation = this.createRawLocationByScriptId(location.value.scriptId, location.value.lineNumber, location.value.columnNumber);
+ callback({ location: debuggerLocation, sourceURL: null, functionName: functionName ? functionName.value : "" });
+ return;
dgozman 2016/07/07 19:59:23 useless return
kozy 2016/07/07 22:59:07 Done.
}
},

Powered by Google App Engine
This is Rietveld 408576698