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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope
Details.type())), | 96 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope
Details.type())), |
97 object: scopeObject, | 97 object: scopeObject, |
98 name: scopeDetails.name() || "" | 98 name: scopeDetails.name() || "" |
99 }); | 99 }); |
100 } | 100 } |
101 return result; | 101 return result; |
102 } | 102 } |
103 | 103 |
104 /** | 104 /** |
105 * @param {!ExecutionState} execState | 105 * @param {!ExecutionState} execState |
106 * @param {!BreakpointInfo} info | |
107 * @return {string|undefined} | |
108 */ | |
109 DebuggerScript.setBreakpoint = function(execState, info) | |
110 { | |
111 var breakId = Debug.setScriptBreakPointById(info.sourceID, info.lineNumber,
info.columnNumber, info.condition, undefined, Debug.BreakPositionAlignment.State
ment); | |
112 var locations = Debug.findBreakPointActualLocations(breakId); | |
113 if (!locations.length) | |
114 return undefined; | |
115 info.lineNumber = locations[0].line; | |
116 info.columnNumber = locations[0].column; | |
117 return breakId.toString(); | |
118 } | |
119 | |
120 /** | |
121 * @param {!ExecutionState} execState | |
122 * @param {!{breakpointId: number}} info | |
123 */ | |
124 DebuggerScript.removeBreakpoint = function(execState, info) | |
125 { | |
126 Debug.findBreakPoint(info.breakpointId, true); | |
127 } | |
128 | |
129 /** | |
130 * @param {!ExecutionState} execState | |
131 * @param {number} limit | 106 * @param {number} limit |
132 * @return {!Array<!JavaScriptCallFrame>} | 107 * @return {!Array<!JavaScriptCallFrame>} |
133 */ | 108 */ |
134 DebuggerScript.currentCallFrames = function(execState, limit) | 109 DebuggerScript.currentCallFrames = function(execState, limit) |
135 { | 110 { |
136 var frames = []; | 111 var frames = []; |
137 for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i) | 112 for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i) |
138 frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i))
); | 113 frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i))
); |
139 return frames; | 114 return frames; |
140 } | 115 } |
(...skipping 30 matching lines...) Expand all Loading... |
171 var details = /** @type {!LiveEditErrorDetails} */(e.details); | 146 var details = /** @type {!LiveEditErrorDetails} */(e.details); |
172 if (details.type === "liveedit_compile_error") { | 147 if (details.type === "liveedit_compile_error") { |
173 var startPosition = details.position.start; | 148 var startPosition = details.position.start; |
174 return [1, String(e), String(details.syntaxErrorMessage), Number
(startPosition.line), Number(startPosition.column)]; | 149 return [1, String(e), String(details.syntaxErrorMessage), Number
(startPosition.line), Number(startPosition.column)]; |
175 } | 150 } |
176 } | 151 } |
177 throw e; | 152 throw e; |
178 } | 153 } |
179 } | 154 } |
180 | 155 |
181 /** | |
182 * @param {!ExecutionState} execState | |
183 */ | |
184 DebuggerScript.clearBreakpoints = function(execState) | |
185 { | |
186 Debug.clearAllBreakPoints(); | |
187 } | |
188 | |
189 /** | |
190 * @param {!Array<!BreakPoint>|undefined} breakpoints | |
191 */ | |
192 DebuggerScript.getBreakpointNumbers = function(breakpoints) | |
193 { | |
194 var numbers = []; | |
195 if (!breakpoints) | |
196 return numbers; | |
197 | |
198 for (var i = 0; i < breakpoints.length; i++) { | |
199 var breakpoint = breakpoints[i]; | |
200 var scriptBreakPoint = breakpoint.script_break_point(); | |
201 numbers.push(scriptBreakPoint ? scriptBreakPoint.number() : breakpoint.n
umber()); | |
202 } | |
203 return numbers; | |
204 } | |
205 | |
206 // NOTE: This function is performance critical, as it can be run on every | 156 // NOTE: This function is performance critical, as it can be run on every |
207 // statement that generates an async event (like addEventListener) to support | 157 // statement that generates an async event (like addEventListener) to support |
208 // asynchronous call stacks. Thus, when possible, initialize the data lazily. | 158 // asynchronous call stacks. Thus, when possible, initialize the data lazily. |
209 /** | 159 /** |
210 * @param {!FrameMirror} frameMirror | 160 * @param {!FrameMirror} frameMirror |
211 * @return {!JavaScriptCallFrame} | 161 * @return {!JavaScriptCallFrame} |
212 */ | 162 */ |
213 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror) | 163 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror) |
214 { | 164 { |
215 // Stuff that can not be initialized lazily (i.e. valid while paused with a
valid break_id). | 165 // Stuff that can not be initialized lazily (i.e. valid while paused with a
valid break_id). |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 case ScopeType.Global: | 439 case ScopeType.Global: |
490 case ScopeType.With: | 440 case ScopeType.With: |
491 result = scopeObject; | 441 result = scopeObject; |
492 break; | 442 break; |
493 } | 443 } |
494 return result; | 444 return result; |
495 } | 445 } |
496 | 446 |
497 return DebuggerScript; | 447 return DebuggerScript; |
498 })(); | 448 })(); |
OLD | NEW |