| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 "use strict"; | 30 "use strict"; |
| 31 | 31 |
| 32 (function () { | 32 (function () { |
| 33 | 33 |
| 34 var DebuggerScript = {}; | 34 var DebuggerScript = {}; |
| 35 | 35 |
| 36 /** @enum */ | |
| 37 const PauseOnExceptionsState = { | |
| 38 DontPauseOnExceptions: 0, | |
| 39 PauseOnAllExceptions: 1, | |
| 40 PauseOnUncaughtExceptions: 2 | |
| 41 }; | |
| 42 DebuggerScript.PauseOnExceptionsState = PauseOnExceptionsState; | |
| 43 | |
| 44 DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.D
ontPauseOnExceptions; | |
| 45 Debug.clearBreakOnException(); | |
| 46 Debug.clearBreakOnUncaughtException(); | |
| 47 | |
| 48 /** | 36 /** |
| 49 * @param {?CompileEvent} eventData | 37 * @param {?CompileEvent} eventData |
| 50 */ | 38 */ |
| 51 DebuggerScript.getAfterCompileScript = function(eventData) | 39 DebuggerScript.getAfterCompileScript = function(eventData) |
| 52 { | 40 { |
| 53 var script = eventData.script().value(); | 41 var script = eventData.script().value(); |
| 54 if (!script.is_debugger_script) | 42 if (!script.is_debugger_script) |
| 55 return DebuggerScript._formatScript(eventData.script().value()); | 43 return DebuggerScript._formatScript(eventData.script().value()); |
| 56 return null; | 44 return null; |
| 57 } | 45 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 /** | 234 /** |
| 247 * @param {!ExecutionState} execState | 235 * @param {!ExecutionState} execState |
| 248 * @param {!{breakpointId: number}} info | 236 * @param {!{breakpointId: number}} info |
| 249 */ | 237 */ |
| 250 DebuggerScript.removeBreakpoint = function(execState, info) | 238 DebuggerScript.removeBreakpoint = function(execState, info) |
| 251 { | 239 { |
| 252 Debug.findBreakPoint(info.breakpointId, true); | 240 Debug.findBreakPoint(info.breakpointId, true); |
| 253 } | 241 } |
| 254 | 242 |
| 255 /** | 243 /** |
| 256 * @return {number} | |
| 257 */ | |
| 258 DebuggerScript.pauseOnExceptionsState = function() | |
| 259 { | |
| 260 return DebuggerScript._pauseOnExceptionsState; | |
| 261 } | |
| 262 | |
| 263 /** | |
| 264 * @param {number} newState | |
| 265 */ | |
| 266 DebuggerScript.setPauseOnExceptionsState = function(newState) | |
| 267 { | |
| 268 DebuggerScript._pauseOnExceptionsState = newState; | |
| 269 | |
| 270 if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState) | |
| 271 Debug.setBreakOnException(); | |
| 272 else | |
| 273 Debug.clearBreakOnException(); | |
| 274 | |
| 275 if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newS
tate) | |
| 276 Debug.setBreakOnUncaughtException(); | |
| 277 else | |
| 278 Debug.clearBreakOnUncaughtException(); | |
| 279 } | |
| 280 | |
| 281 /** | |
| 282 * @param {!ExecutionState} execState | 244 * @param {!ExecutionState} execState |
| 283 * @param {number} limit | 245 * @param {number} limit |
| 284 * @return {!Array<!JavaScriptCallFrame>} | 246 * @return {!Array<!JavaScriptCallFrame>} |
| 285 */ | 247 */ |
| 286 DebuggerScript.currentCallFrames = function(execState, limit) | 248 DebuggerScript.currentCallFrames = function(execState, limit) |
| 287 { | 249 { |
| 288 var frames = []; | 250 var frames = []; |
| 289 for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i) | 251 for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i) |
| 290 frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i))
); | 252 frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i))
); |
| 291 return frames; | 253 return frames; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 break; | 677 break; |
| 716 } | 678 } |
| 717 return result; | 679 return result; |
| 718 } | 680 } |
| 719 | 681 |
| 720 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. | 682 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. |
| 721 ToggleMirrorCache(false); | 683 ToggleMirrorCache(false); |
| 722 | 684 |
| 723 return DebuggerScript; | 685 return DebuggerScript; |
| 724 })(); | 686 })(); |
| OLD | NEW |