| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 200 } |
| 201 | 201 |
| 202 DebuggerScript.currentCallFrame = function(execState, maximumLimit) | 202 DebuggerScript.currentCallFrame = function(execState, maximumLimit) |
| 203 { | 203 { |
| 204 var frameCount = execState.frameCount(); | 204 var frameCount = execState.frameCount(); |
| 205 if (maximumLimit >= 0 && maximumLimit < frameCount) | 205 if (maximumLimit >= 0 && maximumLimit < frameCount) |
| 206 frameCount = maximumLimit; | 206 frameCount = maximumLimit; |
| 207 var topFrame = undefined; | 207 var topFrame = undefined; |
| 208 for (var i = frameCount - 1; i >= 0; i--) { | 208 for (var i = frameCount - 1; i >= 0; i--) { |
| 209 var frameMirror = execState.frame(i); | 209 var frameMirror = execState.frame(i); |
| 210 topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFram
e); | 210 topFrame = DebuggerScript._frameMirrorToJSCallFrame(execState, frameMirr
or, topFrame); |
| 211 } | 211 } |
| 212 return topFrame; | 212 return topFrame; |
| 213 } | 213 } |
| 214 | 214 |
| 215 DebuggerScript.stepIntoStatement = function(execState) | 215 DebuggerScript.stepIntoStatement = function(execState) |
| 216 { | 216 { |
| 217 execState.prepareStep(Debug.StepAction.StepIn, 1); | 217 execState.prepareStep(Debug.StepAction.StepIn, 1); |
| 218 } | 218 } |
| 219 | 219 |
| 220 DebuggerScript.stepOverStatement = function(execState, callFrame) | 220 DebuggerScript.stepOverStatement = function(execState, callFrame) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 return numbers; | 304 return numbers; |
| 305 } | 305 } |
| 306 | 306 |
| 307 DebuggerScript.isEvalCompilation = function(eventData) | 307 DebuggerScript.isEvalCompilation = function(eventData) |
| 308 { | 308 { |
| 309 var script = eventData.script(); | 309 var script = eventData.script(); |
| 310 return (script.compilationType() === Debug.ScriptCompilationType.Eval); | 310 return (script.compilationType() === Debug.ScriptCompilationType.Eval); |
| 311 } | 311 } |
| 312 | 312 |
| 313 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) | 313 DebuggerScript._frameMirrorToJSCallFrame = function(execState, frameMirror, call
erFrame) |
| 314 { | 314 { |
| 315 // Get function name and display name. | 315 // Get function name and display name. |
| 316 var funcMirror; | 316 var funcMirror; |
| 317 var displayName; | 317 var displayName; |
| 318 try { | 318 try { |
| 319 funcMirror = frameMirror.func(); | 319 funcMirror = frameMirror.func(); |
| 320 if (funcMirror) { | 320 if (funcMirror) { |
| 321 var valueMirror = funcMirror.property("displayName").value(); | 321 var valueMirror = funcMirror.property("displayName").value(); |
| 322 if (valueMirror && valueMirror.isString()) | 322 if (valueMirror && valueMirror.isString()) |
| 323 displayName = valueMirror.value(); | 323 displayName = valueMirror.value(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 342 var returnValue = isAtReturn ? frameMirror.details_.returnValue() : undefine
d; | 342 var returnValue = isAtReturn ? frameMirror.details_.returnValue() : undefine
d; |
| 343 | 343 |
| 344 var scopeChain = []; | 344 var scopeChain = []; |
| 345 var scopeType = []; | 345 var scopeType = []; |
| 346 for (var i = 0; i < frameMirror.scopeCount(); i++) { | 346 for (var i = 0; i < frameMirror.scopeCount(); i++) { |
| 347 var scopeMirror = frameMirror.scope(i); | 347 var scopeMirror = frameMirror.scope(i); |
| 348 scopeType.push(scopeMirror.scopeType()); | 348 scopeType.push(scopeMirror.scopeType()); |
| 349 scopeChain.push(DebuggerScript._buildScopeObject(scopeMirror)); | 349 scopeChain.push(DebuggerScript._buildScopeObject(scopeMirror)); |
| 350 } | 350 } |
| 351 | 351 |
| 352 function evaluate(expression) | 352 function evaluate(expression, contextExtension) |
| 353 { | 353 { |
| 354 return frameMirror.evaluate(expression, false).value(); | 354 return frameMirror.evaluate(expression, false, contextExtension).value()
; |
| 355 } |
| 356 |
| 357 function evaluateGlobal(expression, contextExtension) |
| 358 { |
| 359 return execState.evaluateGlobal(expression, false, contextExtension).val
ue(); |
| 355 } | 360 } |
| 356 | 361 |
| 357 function restart() | 362 function restart() |
| 358 { | 363 { |
| 359 return Debug.LiveEdit.RestartFrame(frameMirror); | 364 return Debug.LiveEdit.RestartFrame(frameMirror); |
| 360 } | 365 } |
| 361 | 366 |
| 362 function setVariableValue(scopeNumber, variableName, newValue) | 367 function setVariableValue(scopeNumber, variableName, newValue) |
| 363 { | 368 { |
| 364 return DebuggerScript._setScopeVariableValue(frameMirror, scopeNumber, v
ariableName, newValue); | 369 return DebuggerScript._setScopeVariableValue(frameMirror, scopeNumber, v
ariableName, newValue); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 388 | 393 |
| 389 return { | 394 return { |
| 390 "sourceID": sourceID, | 395 "sourceID": sourceID, |
| 391 "line": location ? location.line : 0, | 396 "line": location ? location.line : 0, |
| 392 "column": location ? location.column : 0, | 397 "column": location ? location.column : 0, |
| 393 "functionName": functionName, | 398 "functionName": functionName, |
| 394 "thisObject": thisObject, | 399 "thisObject": thisObject, |
| 395 "scopeChain": scopeChain, | 400 "scopeChain": scopeChain, |
| 396 "scopeType": scopeType, | 401 "scopeType": scopeType, |
| 397 "evaluate": evaluate, | 402 "evaluate": evaluate, |
| 403 "evaluateGlobal": evaluateGlobal, |
| 398 "caller": callerFrame, | 404 "caller": callerFrame, |
| 399 "restart": restart, | 405 "restart": restart, |
| 400 "setVariableValue": setVariableValue, | 406 "setVariableValue": setVariableValue, |
| 401 "stepInPositions": stepInPositions, | 407 "stepInPositions": stepInPositions, |
| 402 "isAtReturn": isAtReturn, | 408 "isAtReturn": isAtReturn, |
| 403 "returnValue": returnValue, | 409 "returnValue": returnValue, |
| 404 "frameMirror": frameMirror | 410 "frameMirror": frameMirror |
| 405 }; | 411 }; |
| 406 } | 412 } |
| 407 | 413 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 432 break; | 438 break; |
| 433 case ScopeType.Block: | 439 case ScopeType.Block: |
| 434 // Unsupported yet. Mustn't be reachable. | 440 // Unsupported yet. Mustn't be reachable. |
| 435 break; | 441 break; |
| 436 } | 442 } |
| 437 return scopeObject; | 443 return scopeObject; |
| 438 } | 444 } |
| 439 | 445 |
| 440 return DebuggerScript; | 446 return DebuggerScript; |
| 441 })(); | 447 })(); |
| OLD | NEW |