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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 enableDebugger(callback) { | 97 enableDebugger(callback) { |
98 if (this._debuggerEnabled) { | 98 if (this._debuggerEnabled) { |
99 if (callback) | 99 if (callback) |
100 callback(); | 100 callback(); |
101 return; | 101 return; |
102 } | 102 } |
103 this._agent.enable(callback); | 103 this._agent.enable(callback); |
104 this._debuggerEnabled = true; | 104 this._debuggerEnabled = true; |
105 this._pauseOnExceptionStateChanged(); | 105 this._pauseOnExceptionStateChanged(); |
106 this.asyncStackTracesStateChanged(); | 106 this.asyncStackTracesStateChanged(); |
107 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled); | 107 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled, t
his); |
108 } | 108 } |
109 | 109 |
110 /** | 110 /** |
111 * @param {function()=} callback | 111 * @param {function()=} callback |
112 */ | 112 */ |
113 disableDebugger(callback) { | 113 disableDebugger(callback) { |
114 if (!this._debuggerEnabled) { | 114 if (!this._debuggerEnabled) { |
115 if (callback) | 115 if (callback) |
116 callback(); | 116 callback(); |
117 return; | 117 return; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 */ | 309 */ |
310 _breakpointResolved(breakpointId, location) { | 310 _breakpointResolved(breakpointId, location) { |
311 this._breakpointResolvedEventTarget.dispatchEventToListeners( | 311 this._breakpointResolvedEventTarget.dispatchEventToListeners( |
312 breakpointId, SDK.DebuggerModel.Location.fromPayload(this, location)); | 312 breakpointId, SDK.DebuggerModel.Location.fromPayload(this, location)); |
313 } | 313 } |
314 | 314 |
315 globalObjectCleared() { | 315 globalObjectCleared() { |
316 this._setDebuggerPausedDetails(null); | 316 this._setDebuggerPausedDetails(null); |
317 this._reset(); | 317 this._reset(); |
318 // TODO(dgozman): move clients to ExecutionContextDestroyed/ScriptCollected
events. | 318 // TODO(dgozman): move clients to ExecutionContextDestroyed/ScriptCollected
events. |
319 this.dispatchEventToListeners(SDK.DebuggerModel.Events.GlobalObjectCleared); | 319 this.dispatchEventToListeners(SDK.DebuggerModel.Events.GlobalObjectCleared,
this); |
320 } | 320 } |
321 | 321 |
322 _reset() { | 322 _reset() { |
323 this._scripts = {}; | 323 this._scripts = {}; |
324 this._scriptsBySourceURL.clear(); | 324 this._scriptsBySourceURL.clear(); |
325 } | 325 } |
326 | 326 |
327 /** | 327 /** |
328 * @return {!Object.<string, !SDK.Script>} | 328 * @return {!Object.<string, !SDK.Script>} |
329 */ | 329 */ |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 * @return {boolean} | 408 * @return {boolean} |
409 */ | 409 */ |
410 _setDebuggerPausedDetails(debuggerPausedDetails) { | 410 _setDebuggerPausedDetails(debuggerPausedDetails) { |
411 this._isPausing = false; | 411 this._isPausing = false; |
412 this._debuggerPausedDetails = debuggerPausedDetails; | 412 this._debuggerPausedDetails = debuggerPausedDetails; |
413 if (this._debuggerPausedDetails) { | 413 if (this._debuggerPausedDetails) { |
414 if (Runtime.experiments.isEnabled('emptySourceMapAutoStepping') && this._b
eforePausedCallback) { | 414 if (Runtime.experiments.isEnabled('emptySourceMapAutoStepping') && this._b
eforePausedCallback) { |
415 if (!this._beforePausedCallback.call(null, this._debuggerPausedDetails)) | 415 if (!this._beforePausedCallback.call(null, this._debuggerPausedDetails)) |
416 return false; | 416 return false; |
417 } | 417 } |
418 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerPaused, thi
s._debuggerPausedDetails); | 418 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerPaused, thi
s); |
419 } | 419 } |
420 if (debuggerPausedDetails) | 420 if (debuggerPausedDetails) |
421 this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]); | 421 this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]); |
422 else | 422 else |
423 this.setSelectedCallFrame(null); | 423 this.setSelectedCallFrame(null); |
424 return true; | 424 return true; |
425 } | 425 } |
426 | 426 |
427 /** | 427 /** |
428 * @param {?function(!SDK.DebuggerPausedDetails):boolean} callback | 428 * @param {?function(!SDK.DebuggerPausedDetails):boolean} callback |
(...skipping 11 matching lines...) Expand all Loading... |
440 */ | 440 */ |
441 _pausedScript(callFrames, reason, auxData, breakpointIds, asyncStackTrace) { | 441 _pausedScript(callFrames, reason, auxData, breakpointIds, asyncStackTrace) { |
442 var pausedDetails = | 442 var pausedDetails = |
443 new SDK.DebuggerPausedDetails(this, callFrames, reason, auxData, breakpo
intIds, asyncStackTrace); | 443 new SDK.DebuggerPausedDetails(this, callFrames, reason, auxData, breakpo
intIds, asyncStackTrace); |
444 if (!this._setDebuggerPausedDetails(pausedDetails)) | 444 if (!this._setDebuggerPausedDetails(pausedDetails)) |
445 this._agent.stepInto(); | 445 this._agent.stepInto(); |
446 } | 446 } |
447 | 447 |
448 _resumedScript() { | 448 _resumedScript() { |
449 this._setDebuggerPausedDetails(null); | 449 this._setDebuggerPausedDetails(null); |
450 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerResumed); | 450 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerResumed, this
); |
451 } | 451 } |
452 | 452 |
453 /** | 453 /** |
454 * @param {!Protocol.Runtime.ScriptId} scriptId | 454 * @param {!Protocol.Runtime.ScriptId} scriptId |
455 * @param {string} sourceURL | 455 * @param {string} sourceURL |
456 * @param {number} startLine | 456 * @param {number} startLine |
457 * @param {number} startColumn | 457 * @param {number} startColumn |
458 * @param {number} endLine | 458 * @param {number} endLine |
459 * @param {number} endColumn | 459 * @param {number} endColumn |
460 * @param {!Protocol.Runtime.ExecutionContextId} executionContextId | 460 * @param {!Protocol.Runtime.ExecutionContextId} executionContextId |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 stack.callFrames.shift(); | 1313 stack.callFrames.shift(); |
1314 if (previous && !stack.callFrames.length) | 1314 if (previous && !stack.callFrames.length) |
1315 previous.parent = stack.parent; | 1315 previous.parent = stack.parent; |
1316 else | 1316 else |
1317 previous = stack; | 1317 previous = stack; |
1318 stack = stack.parent; | 1318 stack = stack.parent; |
1319 } | 1319 } |
1320 return asyncStackTrace; | 1320 return asyncStackTrace; |
1321 } | 1321 } |
1322 }; | 1322 }; |
OLD | NEW |