| Index: third_party/WebKit/Source/devtools/front_end/sources/SourceMapNamesResolver.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourceMapNamesResolver.js b/third_party/WebKit/Source/devtools/front_end/sources/SourceMapNamesResolver.js
|
| index 3eca7c8aecee812240d91218459c44a42f44cd1f..a3a1c9aa8e953717c419d751340ddade6f38d2d3 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sources/SourceMapNamesResolver.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourceMapNamesResolver.js
|
| @@ -288,6 +288,48 @@ WebInspector.SourceMapNamesResolver._resolveExpression = function(callFrame, uiS
|
| }
|
|
|
| /**
|
| + * @param {?WebInspector.DebuggerModel.CallFrame} callFrame
|
| + * @return {!Promise<?WebInspector.RemoteObject>}
|
| + */
|
| +WebInspector.SourceMapNamesResolver.resolveThisObject = function(callFrame)
|
| +{
|
| + if (!callFrame)
|
| + return Promise.resolve(/** @type {?WebInspector.RemoteObject} */(null));
|
| + if (!Runtime.experiments.isEnabled("resolveVariableNames"))
|
| + return Promise.resolve(callFrame.thisObject());
|
| +
|
| + return WebInspector.SourceMapNamesResolver._resolveScope(callFrame.scopeChain()[0])
|
| + .then(onScopeResolved);
|
| +
|
| + /**
|
| + * @param {!Map<string, string>} namesMapping
|
| + * @return {!Promise<?WebInspector.RemoteObject>}
|
| + */
|
| + function onScopeResolved(namesMapping)
|
| + {
|
| + var thisMappings = namesMapping.inverse().get("this");
|
| + if (!thisMappings || thisMappings.size !== 1)
|
| + return Promise.resolve(callFrame.thisObject());
|
| +
|
| + var thisMapping = thisMappings.valuesArray()[0];
|
| + var callback;
|
| + var promise = new Promise(fulfill => callback = fulfill);
|
| + callFrame.evaluate(thisMapping, "backtrace", false, true, false, true, onEvaluated.bind(null, callback));
|
| + return promise;
|
| + }
|
| +
|
| + /**
|
| + * @param {function(!WebInspector.RemoteObject)} callback
|
| + * @param {?RuntimeAgent.RemoteObject} evaluateResult
|
| + */
|
| + function onEvaluated(callback, evaluateResult)
|
| + {
|
| + var remoteObject = evaluateResult ? callFrame.target().runtimeModel.createRemoteObject(evaluateResult) : callFrame.thisObject();
|
| + callback(remoteObject);
|
| + }
|
| +}
|
| +
|
| +/**
|
| * @param {!WebInspector.DebuggerModel.Scope} scope
|
| * @return {!WebInspector.RemoteObject}
|
| */
|
|
|