| 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 : "" };
|
| }
|
| },
|
|
|
|
|