| 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 d8fa7126b96a79200ab6089ea39126e41824eb70..c9fe53447687a615341bf9bcd86372eb0a99a5eb 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
|
| @@ -62,9 +62,6 @@ WebInspector.DebuggerModel = function(target)
|
| /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?string, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */
|
| WebInspector.DebuggerModel.FunctionDetails;
|
|
|
| -/** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?string, functionName: string, status: string}} */
|
| -WebInspector.DebuggerModel.GeneratorObjectDetails;
|
| -
|
| /**
|
| * Keep these in sync with WebCore::V8Debugger
|
| *
|
| @@ -718,29 +715,36 @@ WebInspector.DebuggerModel.prototype = {
|
|
|
| /**
|
| * @param {!WebInspector.RemoteObject} remoteObject
|
| - * @param {function(?WebInspector.DebuggerModel.GeneratorObjectDetails)} callback
|
| + * @return {!Promise<?WebInspector.DebuggerModel.Location>}
|
| */
|
| - generatorObjectDetails: function(remoteObject, callback)
|
| + generatorObjectLocation: function(remoteObject)
|
| {
|
| - this._agent.getGeneratorObjectDetails(remoteObject.objectId, didGetDetails.bind(this));
|
| + if (remoteObject.subtype !== "generator")
|
| + return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Location} */(null));
|
| + return remoteObject.getOwnPropertiesPromise().then(requestLocation.bind(this));
|
|
|
| /**
|
| - * @param {?Protocol.Error} error
|
| - * @param {!DebuggerAgent.GeneratorObjectDetails} response
|
| - * @this {WebInspector.DebuggerModel}
|
| + * @this {!WebInspector.DebuggerModel}
|
| + * @param {!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}} response
|
| + * @return {!Promise<?WebInspector.DebuggerModel.Location>}
|
| */
|
| - function didGetDetails(error, response)
|
| + function requestLocation(response)
|
| {
|
| - if (error) {
|
| - console.error(error);
|
| - callback(null);
|
| - return;
|
| + if (!response || !response.internalProperties)
|
| + return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Location} */(null));
|
| + var generatorFunction = null;
|
| + for (var prop of response.internalProperties) {
|
| + if (prop.name === "[[GeneratorSuspendedLocation]]") {
|
| + generatorFunction = null;
|
| + var loc = prop.value.value;
|
| + return Promise.resolve(this.createRawLocationByScriptId(loc.scriptId, loc.lineNumber, loc.columnNumber));
|
| + }
|
| + if (prop.name === "[[GeneratorFunction]]")
|
| + generatorFunction = prop.value;
|
| }
|
| - var location = response.location;
|
| - var script = location && 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, status: response.status});
|
| + if (generatorFunction)
|
| + return generatorFunction.functionDetailsPromise().then(response => response.location);
|
| + return Promise.resolve(/** @type {?WebInspector.DebuggerModel.Location} */(null));
|
| }
|
| },
|
|
|
|
|