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

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 67fe2cd8e98be304d61dc18ee9f5dcfa5cc350a2..f8635384cabe6e4ad29833344a9cad8786c91b36 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, functionName: string}} */
WebInspector.DebuggerModel.FunctionDetails;
/**
@@ -659,28 +659,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;
+ for (var prop of response.internalProperties) {
+ if (prop.name === "[[FunctionLocation]]")
+ location = prop.value;
+ }
+ var functionName = null;
+ if (response.properties) {
+ 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, functionName: functionName ? functionName.value : "" };
}
},

Powered by Google App Engine
This is Rietveld 408576698