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

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: addressed comments 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..89bd3969989eaec3fe669e1ea8cad84c0faebf94 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;
/**
@@ -660,28 +660,41 @@ WebInspector.DebuggerModel.prototype = {
/**
* @param {!WebInspector.RemoteObject} remoteObject
- * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback
+ * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>}
*/
- functionDetails: function(remoteObject, callback)
+ functionDetailsPromise: function(remoteObject)
{
- this._agent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind(this));
+ return remoteObject.getAllPropertiesPromise(/* accessorPropertiesOnly */false).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
+ * @return {?WebInspector.DebuggerModel.FunctionDetails}
+ * @this {!WebInspector.DebuggerModel}
*/
- function didGetDetails(error, response)
+ function buildDetails(response)
{
- if (error) {
- callback(null);
- return;
+ if (!response || !response.internalProperties)
+ return null;
+ var location = null;
+ var functionName = null;
+ for (var prop of response.internalProperties) {
+ if (prop.name === "[[FunctionLocation]]")
+ location = prop.value;
+ }
+ if (!functionName && response.properties) {
dgozman 2016/07/09 01:47:29 functionName is always null here.
kozy 2016/07/11 17:50:39 Done.
+ for (var prop of response.properties) {
+ if (prop.name === "name" && prop.value && prop.value.type === "string")
+ functionName = prop.value;
+ if (prop.name === "displayName" && prop.value && prop.value.type === "string") {
+ functionName = prop.value;
+ break;
+ }
+ }
}
- 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 debuggerLocation = null;
+ if (location)
+ debuggerLocation = this.createRawLocationByScriptId(location.value.scriptId, location.value.lineNumber, location.value.columnNumber);
+ return { location: debuggerLocation, sourceURL: null, functionName: functionName ? functionName.value : "" };
dgozman 2016/07/09 01:47:29 Why null sourceURL? Either remove it or get it fro
kozy 2016/07/11 17:50:39 Done.
}
},

Powered by Google App Engine
This is Rietveld 408576698