Chromium Code Reviews| Index: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
| index 2816c3702a91ec38991e394481357226608cbf2f..c7b0fb03c48a744625abf13506d9f983f21f4ecd 100644 |
| --- a/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
| +++ b/third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js |
| @@ -418,13 +418,14 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) |
| var location; |
| var scopeStartLocations; |
| var scopeEndLocations; |
| + var object; |
| function createLocation(script, pos) |
| { |
| if (!script) |
| return null; |
| - location = script.locationFromPosition(pos, true); |
| + var location = script.locationFromPosition(pos, true); |
| return { |
| "lineNumber": location.line, |
| "columnNumber": location.column, |
| @@ -465,34 +466,45 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) |
| return scopeChain; |
| } |
| - function lazyScopeTypes() |
| + function lazyObject() |
| { |
| - if (!scopeChain) |
| - lazyScopeChain(); |
| - return scopeTypes; |
| - } |
| - |
| - function lazyScopeNames() |
| - { |
| - if (!scopeChain) |
| - lazyScopeChain(); |
| - return scopeNames; |
| - } |
| - |
| - function lazyScopeStartLocations() |
| - { |
| - if (!scopeChain) |
| - lazyScopeChain(); |
| - |
| - return scopeStartLocations; |
| - } |
| - |
| - function lazyScopeEndLocations() |
| - { |
| - if (!scopeChain) |
| - lazyScopeChain(); |
| - |
| - return scopeEndLocations; |
| + if (!object) { |
| + var scopeObjects = lazyScopeChain(); |
| + var script = ensureFuncMirror().script(); |
| + var scopes = []; |
| + for (var i = 0; i < scopeObjects.length; ++i) { |
| + var scope = { |
| + "type": scopeTypes[i], |
| + "object": scopeObjects[i], |
| + }; |
| + if (scopeNames[i]) |
| + scope.name = scopeNames[i]; |
| + if (scopeStartLocations[i]) |
| + scope.startLocation = scopeStartLocations[i]; |
| + if (scopeEndLocations[i]) |
| + scope.endLocation = scopeEndLocations[i]; |
| + scopes.push(scope); |
| + } |
| + var functionLocation = ensureFuncMirror().sourceLocation(); |
| + object = { |
| + "functionName": ensureFuncMirror().debugName(), |
| + "location": { |
| + "lineNumber": line(), |
| + "columnNumber": column(), |
| + "scriptId": String(script.id()) |
| + }, |
| + "functionLocation": { |
| + "lineNumber": functionLocation.line, |
|
dgozman
2016/03/23 18:46:31
Previous code checked that there could be no funct
kozy
2016/03/23 19:15:10
Done.
|
| + "columnNumber": functionLocation.column, |
|
dgozman
2016/03/23 18:46:31
ditto
kozy
2016/03/23 19:15:10
Done.
|
| + "scriptId": String(script.id()) |
| + }, |
| + "this": thisObject, |
| + "scopeChain": scopes |
| + }; |
| + if (isAtReturn) |
| + object.returnValue = returnValue; |
| + } |
| + return object; |
| } |
| function ensureFuncMirror() |
| @@ -533,29 +545,6 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) |
| return script && script.id(); |
| } |
| - function scriptName() |
| - { |
| - var script = ensureFuncMirror().script(); |
| - return script && script.name(); |
| - } |
| - |
| - function functionName() |
| - { |
| - return ensureFuncMirror().debugName(); |
| - } |
| - |
| - function functionLine() |
| - { |
| - var location = ensureFuncMirror().sourceLocation(); |
| - return location ? location.line : 0; |
| - } |
| - |
| - function functionColumn() |
| - { |
| - var location = ensureFuncMirror().sourceLocation(); |
| - return location ? location.column : 0; |
| - } |
| - |
| function evaluate(expression) |
| { |
| return frameMirror.evaluate(expression, false).value(); |
| @@ -571,49 +560,17 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) |
| return DebuggerScript._setScopeVariableValue(frameMirror, scopeNumber, variableName, newValue); |
| } |
| - function stepInPositions() |
| - { |
| - var stepInPositionsV8 = frameMirror.stepInPositions(); |
| - var stepInPositionsProtocol; |
| - if (stepInPositionsV8) { |
| - stepInPositionsProtocol = []; |
| - var script = ensureFuncMirror().script(); |
| - if (script) { |
| - var scriptId = String(script.id()); |
| - for (var i = 0; i < stepInPositionsV8.length; i++) { |
| - var item = { |
| - scriptId: scriptId, |
| - lineNumber: stepInPositionsV8[i].position.line, |
| - columnNumber: stepInPositionsV8[i].position.column |
| - }; |
| - stepInPositionsProtocol.push(item); |
| - } |
| - } |
| - } |
| - return JSON.stringify(stepInPositionsProtocol); |
| - } |
| - |
| return { |
| "sourceID": sourceID, |
| "line": line, |
| "column": column, |
| - "scriptName": scriptName, |
| - "functionName": functionName, |
| - "functionLine": functionLine, |
| - "functionColumn": functionColumn, |
| "thisObject": thisObject, |
| - "scopeChain": lazyScopeChain, |
| - "scopeType": lazyScopeTypes, |
| - "scopeName": lazyScopeNames, |
| - "scopeStartLocation": lazyScopeStartLocations, |
| - "scopeEndLocation": lazyScopeEndLocations, |
| "evaluate": evaluate, |
| "caller": callerFrame, |
| "restart": restart, |
| "setVariableValue": setVariableValue, |
| - "stepInPositions": stepInPositions, |
| "isAtReturn": isAtReturn, |
| - "returnValue": returnValue |
| + "object": lazyObject |
|
dgozman
2016/03/23 18:46:31
details
kozy
2016/03/23 19:15:10
Done.
|
| }; |
| } |