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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 this._scriptsBySourceURL = new Map(); | 55 this._scriptsBySourceURL = new Map(); |
56 /** @type {!Array.<!SDK.Script>} */ | 56 /** @type {!Array.<!SDK.Script>} */ |
57 this._discardableScripts = []; | 57 this._discardableScripts = []; |
58 | 58 |
59 /** @type {!Common.Object} */ | 59 /** @type {!Common.Object} */ |
60 this._breakpointResolvedEventTarget = new Common.Object(); | 60 this._breakpointResolvedEventTarget = new Common.Object(); |
61 | 61 |
62 this._isPausing = false; | 62 this._isPausing = false; |
63 Common.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this._paus
eOnExceptionStateChanged, this); | 63 Common.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this._paus
eOnExceptionStateChanged, this); |
64 Common.moduleSetting('pauseOnCaughtException').addChangeListener(this._pause
OnExceptionStateChanged, this); | 64 Common.moduleSetting('pauseOnCaughtException').addChangeListener(this._pause
OnExceptionStateChanged, this); |
65 Common.moduleSetting('enableAsyncStackTraces').addChangeListener(this.asyncS
tackTracesStateChanged, this); | 65 Common.moduleSetting('disableAsyncStackTraces').addChangeListener(this._asyn
cStackTracesStateChanged, this); |
66 | 66 |
67 /** @type {!Map<string, string>} */ | 67 /** @type {!Map<string, string>} */ |
68 this._fileURLToNodeJSPath = new Map(); | 68 this._fileURLToNodeJSPath = new Map(); |
69 this.enableDebugger(); | 69 this.enableDebugger(); |
70 | 70 |
71 /** @type {!Map<string, string>} */ | 71 /** @type {!Map<string, string>} */ |
72 this._stringMap = new Map(); | 72 this._stringMap = new Map(); |
73 this._sourceMapManager.setEnabled(Common.moduleSetting('jsSourceMapsEnabled'
).get()); | 73 this._sourceMapManager.setEnabled(Common.moduleSetting('jsSourceMapsEnabled'
).get()); |
74 Common.moduleSetting('jsSourceMapsEnabled') | 74 Common.moduleSetting('jsSourceMapsEnabled') |
75 .addChangeListener(event => this._sourceMapManager.setEnabled(/** @type
{boolean} */ (event.data))); | 75 .addChangeListener(event => this._sourceMapManager.setEnabled(/** @type
{boolean} */ (event.data))); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 */ | 113 */ |
114 enableDebugger(callback) { | 114 enableDebugger(callback) { |
115 if (this._debuggerEnabled) { | 115 if (this._debuggerEnabled) { |
116 if (callback) | 116 if (callback) |
117 callback(); | 117 callback(); |
118 return; | 118 return; |
119 } | 119 } |
120 this._agent.enable(callback); | 120 this._agent.enable(callback); |
121 this._debuggerEnabled = true; | 121 this._debuggerEnabled = true; |
122 this._pauseOnExceptionStateChanged(); | 122 this._pauseOnExceptionStateChanged(); |
123 this.asyncStackTracesStateChanged(); | 123 this._asyncStackTracesStateChanged(); |
124 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled, t
his); | 124 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled, t
his); |
125 } | 125 } |
126 | 126 |
127 /** | 127 /** |
128 * @param {function()=} callback | 128 * @param {function()=} callback |
129 */ | 129 */ |
130 disableDebugger(callback) { | 130 disableDebugger(callback) { |
131 if (!this._debuggerEnabled) { | 131 if (!this._debuggerEnabled) { |
132 if (callback) | 132 if (callback) |
133 callback(); | 133 callback(); |
134 return; | 134 return; |
135 } | 135 } |
136 | 136 |
137 this._agent.disable(callback); | 137 this._agent.disable(callback); |
138 this._debuggerEnabled = false; | 138 this._debuggerEnabled = false; |
139 this._isPausing = false; | 139 this._isPausing = false; |
140 this.asyncStackTracesStateChanged(); | 140 this._asyncStackTracesStateChanged(); |
141 this.globalObjectCleared(); | 141 this.globalObjectCleared(); |
142 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasDisabled); | 142 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasDisabled); |
143 } | 143 } |
144 | 144 |
145 /** | 145 /** |
146 * @param {boolean} skip | 146 * @param {boolean} skip |
147 */ | 147 */ |
148 _skipAllPauses(skip) { | 148 _skipAllPauses(skip) { |
149 if (this._skipAllPausesTimeout) { | 149 if (this._skipAllPausesTimeout) { |
150 clearTimeout(this._skipAllPausesTimeout); | 150 clearTimeout(this._skipAllPausesTimeout); |
(...skipping 18 matching lines...) Expand all Loading... |
169 if (!Common.moduleSetting('pauseOnExceptionEnabled').get()) | 169 if (!Common.moduleSetting('pauseOnExceptionEnabled').get()) |
170 state = SDK.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions; | 170 state = SDK.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions; |
171 else if (Common.moduleSetting('pauseOnCaughtException').get()) | 171 else if (Common.moduleSetting('pauseOnCaughtException').get()) |
172 state = SDK.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions; | 172 state = SDK.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions; |
173 else | 173 else |
174 state = SDK.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions
; | 174 state = SDK.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions
; |
175 | 175 |
176 this._agent.setPauseOnExceptions(state); | 176 this._agent.setPauseOnExceptions(state); |
177 } | 177 } |
178 | 178 |
179 asyncStackTracesStateChanged() { | 179 _asyncStackTracesStateChanged() { |
180 const maxAsyncStackChainDepth = 8; | 180 const maxAsyncStackChainDepth = 32; |
181 var enabled = Common.moduleSetting('enableAsyncStackTraces').get() && this._
debuggerEnabled; | 181 var enabled = !Common.moduleSetting('disableAsyncStackTraces').get() && this
._debuggerEnabled; |
182 this._agent.setAsyncCallStackDepth(enabled ? maxAsyncStackChainDepth : 0); | 182 this._agent.setAsyncCallStackDepth(enabled ? maxAsyncStackChainDepth : 0); |
183 } | 183 } |
184 | 184 |
185 stepInto() { | 185 stepInto() { |
186 this._agent.stepInto(); | 186 this._agent.stepInto(); |
187 } | 187 } |
188 | 188 |
189 stepOver() { | 189 stepOver() { |
190 this._agent.stepOver(); | 190 this._agent.stepOver(); |
191 } | 191 } |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 } | 857 } |
858 } | 858 } |
859 | 859 |
860 /** | 860 /** |
861 * @override | 861 * @override |
862 */ | 862 */ |
863 dispose() { | 863 dispose() { |
864 this._sourceMapManager.dispose(); | 864 this._sourceMapManager.dispose(); |
865 Common.moduleSetting('pauseOnExceptionEnabled').removeChangeListener(this._p
auseOnExceptionStateChanged, this); | 865 Common.moduleSetting('pauseOnExceptionEnabled').removeChangeListener(this._p
auseOnExceptionStateChanged, this); |
866 Common.moduleSetting('pauseOnCaughtException').removeChangeListener(this._pa
useOnExceptionStateChanged, this); | 866 Common.moduleSetting('pauseOnCaughtException').removeChangeListener(this._pa
useOnExceptionStateChanged, this); |
867 Common.moduleSetting('enableAsyncStackTraces').removeChangeListener(this.asy
ncStackTracesStateChanged, this); | 867 Common.moduleSetting('disableAsyncStackTraces').removeChangeListener(this._a
syncStackTracesStateChanged, this); |
868 } | 868 } |
869 | 869 |
870 /** | 870 /** |
871 * @override | 871 * @override |
872 * @return {!Promise} | 872 * @return {!Promise} |
873 */ | 873 */ |
874 suspendModel() { | 874 suspendModel() { |
875 return new Promise(promiseBody.bind(this)); | 875 return new Promise(promiseBody.bind(this)); |
876 | 876 |
877 /** | 877 /** |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 stack.callFrames.shift(); | 1480 stack.callFrames.shift(); |
1481 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) | 1481 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) |
1482 previous.parent = stack.parent; | 1482 previous.parent = stack.parent; |
1483 else | 1483 else |
1484 previous = stack; | 1484 previous = stack; |
1485 stack = stack.parent; | 1485 stack = stack.parent; |
1486 } | 1486 } |
1487 return asyncStackTrace; | 1487 return asyncStackTrace; |
1488 } | 1488 } |
1489 }; | 1489 }; |
OLD | NEW |