OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); | 118 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); |
119 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.debuggerModel, WebInspector.breakpointManager, this.showUIS ourceCode.bind(this)); | 119 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.debuggerModel, WebInspector.breakpointManager, this.showUIS ourceCode.bind(this)); |
120 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); | 120 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); |
121 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); | 121 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); |
122 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); | 122 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); |
123 | 123 |
124 if (Capabilities.isMainFrontend) | 124 if (Capabilities.isMainFrontend) |
125 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(); | 125 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(); |
126 | 126 |
127 this._extensionSidebarPanes = []; | 127 this._extensionSidebarPanes = []; |
128 /** @type {!Set.<!WebInspector.Target>} */ | |
129 this._waitingToPauseInTarget = new Set(); | |
128 | 130 |
129 this._installDebuggerSidebarController(); | 131 this._installDebuggerSidebarController(); |
130 | 132 |
131 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); | 133 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); |
132 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); | 134 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); |
133 this._dockSideChanged(); | 135 this._dockSideChanged(); |
134 | 136 |
135 this._updateDebuggerButtons(); | 137 this._updateDebuggerButtons(); |
136 this._pauseOnExceptionEnabledChanged(); | 138 this._pauseOnExceptionEnabledChanged(); |
137 if (WebInspector.debuggerModel.isPaused()) | 139 if (WebInspector.debuggerModel.isPaused()) |
138 this._showDebuggerPausedDetails(WebInspector.debuggerModel.debuggerPause dDetails()); | 140 this._showDebuggerPausedDetails(WebInspector.debuggerModel.debuggerPause dDetails()); |
139 | 141 |
140 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionEnabledChanged, this); | 142 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionEnabledChanged, this); |
141 WebInspector.targetManager.observeTargets(this); | 143 WebInspector.targetManager.observeTargets(this); |
144 WebInspector.executionContextSelector.addTargetChangeListener(this._currentT argetChanged, this); | |
142 } | 145 } |
143 | 146 |
144 WebInspector.SourcesPanel.minToolbarWidth = 215; | 147 WebInspector.SourcesPanel.minToolbarWidth = 215; |
145 | 148 |
146 WebInspector.SourcesPanel.prototype = { | 149 WebInspector.SourcesPanel.prototype = { |
147 /** | 150 /** |
148 * @param {!WebInspector.Target} target | 151 * @param {!WebInspector.Target} target |
149 */ | 152 */ |
150 targetAdded: function(target) { | 153 targetAdded: function(target) |
154 { | |
151 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasEnabled, this._debuggerWasEnabled, this); | 155 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasEnabled, this._debuggerWasEnabled, this); |
152 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasDisabled, this._debuggerWasDisabled, this); | 156 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerWasDisabled, this._debuggerReset, this); |
153 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerPaused, this._debuggerPaused, this); | 157 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerPaused, this._debuggerPaused, this); |
154 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerResumed, this._debuggerResumed, this); | 158 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. DebuggerResumed, this._debuggerResumed, this); |
155 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. CallFrameSelected, this._callFrameSelected, this); | 159 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. CallFrameSelected, this._callFrameSelected, this); |
156 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSelec tedCallFrame, this); | 160 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSelec tedCallFrame, this); |
157 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 161 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); |
158 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this); | 162 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this); |
159 }, | 163 }, |
160 | 164 |
161 /** | 165 /** |
162 * @param {!WebInspector.Target} target | 166 * @param {!WebInspector.Target} target |
163 */ | 167 */ |
164 targetRemoved: function(target) { | 168 targetRemoved: function(target) |
169 { | |
165 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasEnabled, this._debuggerWasEnabled, this); | 170 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasEnabled, this._debuggerWasEnabled, this); |
166 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasDisabled, this._debuggerWasDisabled, this); | 171 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerWasDisabled, this._debuggerReset, this); |
167 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerPaused, this._debuggerPaused, this); | 172 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerPaused, this._debuggerPaused, this); |
168 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerResumed, this._debuggerResumed, this); | 173 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.DebuggerResumed, this._debuggerResumed, this); |
169 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.CallFrameSelected, this._callFrameSelected, this); | 174 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.CallFrameSelected, this._callFrameSelected, this); |
170 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSe lectedCallFrame, this); | 175 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSe lectedCallFrame, this); |
171 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 176 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); |
172 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this); | 177 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this); |
173 | |
174 }, | 178 }, |
175 | 179 |
176 /** | 180 /** |
181 * @param {?WebInspector.Target} target | |
182 */ | |
183 _currentTargetChanged: function(target) | |
184 { | |
185 if (!target) | |
186 return; | |
187 | |
188 if (target.debuggerModel.isPaused()) { | |
189 this._showDebuggerPausedDetails(target.debuggerModel.debuggerPausedD etails()); | |
190 var callFrame = target.debuggerModel.selectedCallFrame(); | |
191 if (callFrame) | |
192 this._selectCallFrame(callFrame); | |
193 } else { | |
194 this._paused = false; | |
195 this._clearInterface(); | |
196 this._toggleDebuggerSidebarButton.setEnabled(true); | |
197 } | |
198 }, | |
199 | |
200 /** | |
177 * @return {!Element} | 201 * @return {!Element} |
178 */ | 202 */ |
179 defaultFocusedElement: function() | 203 defaultFocusedElement: function() |
180 { | 204 { |
181 return this._sourcesView.defaultFocusedElement() || this._navigator.view .defaultFocusedElement(); | 205 return this._sourcesView.defaultFocusedElement() || this._navigator.view .defaultFocusedElement(); |
182 }, | 206 }, |
183 | 207 |
184 get paused() | 208 /** |
209 * @return {boolean} | |
210 */ | |
211 paused: function() | |
185 { | 212 { |
186 return this._paused; | 213 return this._paused; |
187 }, | 214 }, |
188 | 215 |
189 /** | 216 /** |
190 * @return {!WebInspector.SourcesPanel.DrawerEditor} | 217 * @return {!WebInspector.SourcesPanel.DrawerEditor} |
191 */ | 218 */ |
192 _drawerEditor: function() | 219 _drawerEditor: function() |
193 { | 220 { |
194 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec tor.DrawerEditor); | 221 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec tor.DrawerEditor); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 { | 255 { |
229 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); | 256 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); |
230 }, | 257 }, |
231 | 258 |
232 /** | 259 /** |
233 * @param {!WebInspector.Event} event | 260 * @param {!WebInspector.Event} event |
234 */ | 261 */ |
235 _debuggerPaused: function(event) | 262 _debuggerPaused: function(event) |
236 { | 263 { |
237 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data); | 264 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data); |
238 WebInspector.inspectorView.setCurrentPanel(this); | 265 this._waitingToPauseInTarget.remove(details.target()); |
239 this._showDebuggerPausedDetails(details); | 266 |
267 if (!this._paused) | |
268 WebInspector.inspectorView.setCurrentPanel(this); | |
269 | |
270 if (WebInspector.executionContextSelector.currentTarget() === details.ta rget()) | |
271 this._showDebuggerPausedDetails(details); | |
272 else if (!this._paused) | |
273 WebInspector.executionContextSelector.setCurrentTarget(details.targe t()); | |
240 }, | 274 }, |
241 | 275 |
242 /** | 276 /** |
243 * @param {?WebInspector.DebuggerPausedDetails} details | 277 * @param {?WebInspector.DebuggerPausedDetails} details |
244 */ | 278 */ |
245 _showDebuggerPausedDetails: function(details) | 279 _showDebuggerPausedDetails: function(details) |
246 { | 280 { |
247 this._paused = true; | 281 this._paused = true; |
248 this._waitingToPause = false; | |
249 | |
250 this._updateDebuggerButtons(); | 282 this._updateDebuggerButtons(); |
251 | 283 |
252 this.sidebarPanes.callstack.update(details); | 284 this.sidebarPanes.callstack.update(details); |
253 | 285 |
254 /** | 286 /** |
255 * @param {!Element} element | 287 * @param {!Element} element |
256 * @this {WebInspector.SourcesPanel} | 288 * @this {WebInspector.SourcesPanel} |
257 */ | 289 */ |
258 function didCreateBreakpointHitStatusMessage(element) | 290 function didCreateBreakpointHitStatusMessage(element) |
259 { | 291 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 else | 330 else |
299 console.warn("ScriptsPanel paused, but callFrames.length is zero ."); // TODO remove this once we understand this case better | 331 console.warn("ScriptsPanel paused, but callFrames.length is zero ."); // TODO remove this once we understand this case better |
300 } | 332 } |
301 | 333 |
302 this._splitView.showBoth(true); | 334 this._splitView.showBoth(true); |
303 this._toggleDebuggerSidebarButton.setEnabled(false); | 335 this._toggleDebuggerSidebarButton.setEnabled(false); |
304 window.focus(); | 336 window.focus(); |
305 InspectorFrontendHost.bringToFront(); | 337 InspectorFrontendHost.bringToFront(); |
306 }, | 338 }, |
307 | 339 |
308 _debuggerResumed: function() | 340 /** |
341 * @param {!WebInspector.Event} event | |
342 */ | |
343 _debuggerResumed: function(event) | |
309 { | 344 { |
345 var target = /** @type {!WebInspector.Target} */ (event.data); | |
346 this._waitingToPauseInTarget.remove(target); | |
vsevik
2014/06/18 13:51:47
Let's move it on DebuggerModel
sergeyv
2014/06/19 12:42:04
Done.
| |
347 if (WebInspector.executionContextSelector.currentTarget() !== target) | |
348 return | |
310 this._paused = false; | 349 this._paused = false; |
311 this._waitingToPause = false; | |
312 | |
313 this._clearInterface(); | 350 this._clearInterface(); |
314 this._toggleDebuggerSidebarButton.setEnabled(true); | 351 this._toggleDebuggerSidebarButton.setEnabled(true); |
315 }, | 352 }, |
316 | 353 |
317 _debuggerWasEnabled: function() | 354 _debuggerWasEnabled: function() |
318 { | 355 { |
319 this._updateDebuggerButtons(); | 356 this._updateDebuggerButtons(); |
320 }, | 357 }, |
321 | 358 |
322 _debuggerWasDisabled: function() | 359 /** |
360 * @param {!WebInspector.Event} event | |
361 */ | |
362 _debuggerReset: function(event) | |
323 { | 363 { |
324 this._debuggerReset(); | 364 this._debuggerResumed(event); |
325 }, | |
326 | |
327 _debuggerReset: function() | |
328 { | |
329 this._debuggerResumed(); | |
330 this.sidebarPanes.watchExpressions.reset(); | |
331 delete this._skipExecutionLineRevealing; | 365 delete this._skipExecutionLineRevealing; |
332 }, | 366 }, |
333 | 367 |
334 /** | 368 /** |
335 * @return {!WebInspector.View} | 369 * @return {!WebInspector.View} |
336 */ | 370 */ |
337 get visibleView() | 371 get visibleView() |
338 { | 372 { |
339 return this._sourcesView.visibleView(); | 373 return this._sourcesView.visibleView(); |
340 }, | 374 }, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 _executionLineChanged: function(uiLocation) | 424 _executionLineChanged: function(uiLocation) |
391 { | 425 { |
392 this._sourcesView.clearCurrentExecutionLine(); | 426 this._sourcesView.clearCurrentExecutionLine(); |
393 this._sourcesView.setExecutionLine(uiLocation); | 427 this._sourcesView.setExecutionLine(uiLocation); |
394 if (this._skipExecutionLineRevealing) | 428 if (this._skipExecutionLineRevealing) |
395 return; | 429 return; |
396 this._skipExecutionLineRevealing = true; | 430 this._skipExecutionLineRevealing = true; |
397 this._sourcesView.showSourceLocation(uiLocation.uiSourceCode, uiLocation .lineNumber, 0, undefined, true); | 431 this._sourcesView.showSourceLocation(uiLocation.uiSourceCode, uiLocation .lineNumber, 0, undefined, true); |
398 }, | 432 }, |
399 | 433 |
434 /** | |
435 * @param {!WebInspector.Event} event | |
436 */ | |
400 _callFrameSelected: function(event) | 437 _callFrameSelected: function(event) |
401 { | 438 { |
402 var callFrame = event.data; | 439 var callFrame = /** @type {?WebInspector.DebuggerModel.CallFrame} */ (ev ent.data); |
403 | 440 |
404 if (!callFrame) | 441 if (!callFrame || callFrame.target() !== WebInspector.executionContextSe lector.currentTarget()) |
405 return; | 442 return; |
406 | 443 |
444 this._selectCallFrame(callFrame); | |
445 }, | |
446 | |
447 /** | |
448 * @param {!WebInspector.DebuggerModel.CallFrame} callFrame | |
449 */ | |
450 _selectCallFrame: function(callFrame) | |
451 { | |
407 this.sidebarPanes.scopechain.update(callFrame); | 452 this.sidebarPanes.scopechain.update(callFrame); |
408 this.sidebarPanes.watchExpressions.refreshExpressions(); | 453 this.sidebarPanes.watchExpressions.refreshExpressions(); |
409 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | 454 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); |
410 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | 455 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); |
411 }, | 456 }, |
412 | 457 |
413 /** | 458 /** |
414 * @param {!WebInspector.Event} event | 459 * @param {!WebInspector.Event} event |
415 */ | 460 */ |
416 _sourceSelected: function(event) | 461 _sourceSelected: function(event) |
(...skipping 14 matching lines...) Expand all Loading... | |
431 _pauseOnExceptionEnabledChanged: function() | 476 _pauseOnExceptionEnabledChanged: function() |
432 { | 477 { |
433 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); | 478 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); |
434 this._pauseOnExceptionButton.toggled = enabled; | 479 this._pauseOnExceptionButton.toggled = enabled; |
435 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do n't pause on exceptions." : "Pause on exceptions."); | 480 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do n't pause on exceptions." : "Pause on exceptions."); |
436 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 481 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
437 }, | 482 }, |
438 | 483 |
439 _updateDebuggerButtons: function() | 484 _updateDebuggerButtons: function() |
440 { | 485 { |
486 var currentTarget = WebInspector.executionContextSelector.currentTarget( ); | |
487 if (!currentTarget) | |
488 return; | |
489 | |
441 if (this._paused) { | 490 if (this._paused) { |
442 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re sume script execution (%s).")) | 491 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re sume script execution (%s).")) |
443 this._pauseButton.state = true; | 492 this._pauseButton.state = true; |
444 this._pauseButton.setLongClickOptionsEnabled((function() { return [ this._longResumeButton ] }).bind(this)); | 493 this._pauseButton.setLongClickOptionsEnabled((function() { return [ this._longResumeButton ] }).bind(this)); |
445 | 494 |
446 this._pauseButton.setEnabled(true); | 495 this._pauseButton.setEnabled(true); |
447 this._stepOverButton.setEnabled(true); | 496 this._stepOverButton.setEnabled(true); |
448 this._stepIntoButton.setEnabled(true); | 497 this._stepIntoButton.setEnabled(true); |
449 this._stepOutButton.setEnabled(true); | 498 this._stepOutButton.setEnabled(true); |
450 } else { | 499 } else { |
451 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa use script execution (%s).")) | 500 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa use script execution (%s).")) |
452 this._pauseButton.state = false; | 501 this._pauseButton.state = false; |
453 this._pauseButton.setLongClickOptionsEnabled(null); | 502 this._pauseButton.setLongClickOptionsEnabled(null); |
454 | 503 |
455 this._pauseButton.setEnabled(!this._waitingToPause); | 504 this._pauseButton.setEnabled(!this._waitingToPauseInTarget.contains( currentTarget)); |
456 this._stepOverButton.setEnabled(false); | 505 this._stepOverButton.setEnabled(false); |
457 this._stepIntoButton.setEnabled(false); | 506 this._stepIntoButton.setEnabled(false); |
458 this._stepOutButton.setEnabled(false); | 507 this._stepOutButton.setEnabled(false); |
459 } | 508 } |
460 }, | 509 }, |
461 | 510 |
462 _clearInterface: function() | 511 _clearInterface: function() |
463 { | 512 { |
464 this.sidebarPanes.callstack.update(null); | 513 this.sidebarPanes.callstack.update(null); |
465 this.sidebarPanes.scopechain.update(null); | 514 this.sidebarPanes.scopechain.update(null); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 { | 569 { |
521 var isSnippet = uiSourceCode && uiSourceCode.project().type() === WebIns pector.projectTypes.Snippets; | 570 var isSnippet = uiSourceCode && uiSourceCode.project().type() === WebIns pector.projectTypes.Snippets; |
522 this._runSnippetButton.element.classList.toggle("hidden", !isSnippet); | 571 this._runSnippetButton.element.classList.toggle("hidden", !isSnippet); |
523 }, | 572 }, |
524 | 573 |
525 /** | 574 /** |
526 * @return {boolean} | 575 * @return {boolean} |
527 */ | 576 */ |
528 togglePause: function() | 577 togglePause: function() |
529 { | 578 { |
579 var target = WebInspector.executionContextSelector.currentTarget(); | |
580 if (!target) | |
581 return true; | |
582 | |
530 if (this._paused) { | 583 if (this._paused) { |
531 delete this._skipExecutionLineRevealing; | 584 delete this._skipExecutionLineRevealing; |
532 this._paused = false; | 585 this._paused = false; |
533 this._waitingToPause = false; | 586 this._waitingToPauseInTarget.remove(target); |
534 WebInspector.debuggerModel.resume(); | 587 target.debuggerModel.resume(); |
535 } else { | 588 } else { |
536 this._waitingToPause = true; | 589 this._waitingToPauseInTarget.add(target); |
537 // Make sure pauses didn't stick skipped. | 590 // Make sure pauses didn't stick skipped. |
538 WebInspector.debuggerModel.skipAllPauses(false); | 591 target.debuggerModel.skipAllPauses(false); |
539 DebuggerAgent.pause(); | 592 target.debuggerAgent().pause(); |
540 } | 593 } |
541 | 594 |
542 this._clearInterface(); | 595 this._clearInterface(); |
543 return true; | 596 return true; |
544 }, | 597 }, |
545 | 598 |
546 /** | 599 /** |
600 * @param {!function(!WebInspector.DebuggerModel)} continuation | |
547 * @return {boolean} | 601 * @return {boolean} |
548 */ | 602 */ |
549 _longResume: function() | 603 _stepButtonHandler: function(continuation) |
vsevik
2014/06/18 13:51:47
prepareToResume
sergeyv
2014/06/19 12:42:03
Done.
| |
550 { | |
551 if (!this._paused) | |
552 return true; | |
553 | |
554 this._paused = false; | |
555 this._waitingToPause = false; | |
556 WebInspector.debuggerModel.skipAllPausesUntilReloadOrTimeout(500); | |
557 WebInspector.debuggerModel.resume(); | |
558 | |
559 this._clearInterface(); | |
560 return true; | |
561 }, | |
562 | |
563 /** | |
564 * @return {boolean} | |
565 */ | |
566 _stepOverClicked: function() | |
567 { | 604 { |
568 if (!this._paused) | 605 if (!this._paused) |
569 return true; | 606 return true; |
570 | 607 |
571 delete this._skipExecutionLineRevealing; | 608 delete this._skipExecutionLineRevealing; |
572 this._paused = false; | 609 this._paused = false; |
573 | 610 |
574 this._clearInterface(); | 611 this._clearInterface(); |
612 var target = WebInspector.executionContextSelector.currentTarget(); | |
613 if (target) | |
614 continuation.call(this, target.debuggerModel); | |
575 | 615 |
576 WebInspector.debuggerModel.stepOver(); | |
577 return true; | 616 return true; |
578 }, | 617 }, |
579 | 618 |
580 /** | 619 /** |
581 * @return {boolean} | 620 * @param {!WebInspector.DebuggerModel} debuggerModel |
582 */ | 621 */ |
583 _stepIntoClicked: function() | 622 _longResume: function(debuggerModel) |
584 { | 623 { |
585 if (!this._paused) | 624 this._waitingToPauseInTarget.remove(debuggerModel.target()); |
586 return true; | 625 debuggerModel.skipAllPausesUntilReloadOrTimeout(500); |
587 | 626 debuggerModel.resume(); |
588 delete this._skipExecutionLineRevealing; | |
589 this._paused = false; | |
590 | |
591 this._clearInterface(); | |
592 | |
593 WebInspector.debuggerModel.stepInto(); | |
594 return true; | |
595 }, | 627 }, |
596 | 628 |
597 /** | 629 /** |
598 * @return {boolean} | 630 * @param {!WebInspector.DebuggerModel} debuggerModel |
599 */ | 631 */ |
600 _stepOutClicked: function() | 632 _stepOver: function(debuggerModel) |
601 { | 633 { |
602 if (!this._paused) | 634 debuggerModel.stepOver(); |
603 return true; | |
604 | |
605 delete this._skipExecutionLineRevealing; | |
606 this._paused = false; | |
607 | |
608 this._clearInterface(); | |
609 | |
610 WebInspector.debuggerModel.stepOut(); | |
611 return true; | |
612 }, | 635 }, |
613 | 636 |
614 /** | 637 /** |
638 * @param {!WebInspector.DebuggerModel} debuggerModel | |
639 */ | |
640 _stepInto: function(debuggerModel) | |
641 { | |
642 debuggerModel.stepInto(); | |
643 }, | |
644 | |
645 /** | |
646 * @param {!WebInspector.DebuggerModel} debuggerModel | |
647 */ | |
648 _stepOut: function(debuggerModel) | |
649 { | |
650 debuggerModel.stepOut(); | |
651 }, | |
652 | |
653 /** | |
615 * @param {!WebInspector.Event} event | 654 * @param {!WebInspector.Event} event |
616 */ | 655 */ |
617 _callFrameSelectedInSidebar: function(event) | 656 _callFrameSelectedInSidebar: function(event) |
618 { | 657 { |
619 var callFrame = /** @type {!WebInspector.DebuggerModel.CallFrame} */ (ev ent.data); | 658 var callFrame = /** @type {!WebInspector.DebuggerModel.CallFrame} */ (ev ent.data); |
620 delete this._skipExecutionLineRevealing; | 659 delete this._skipExecutionLineRevealing; |
621 WebInspector.debuggerModel.setSelectedCallFrame(callFrame); | 660 callFrame.target().debuggerModel.setSelectedCallFrame(callFrame); |
622 }, | 661 }, |
623 | 662 |
624 _callFrameRestartedInSidebar: function() | 663 _callFrameRestartedInSidebar: function() |
625 { | 664 { |
626 delete this._skipExecutionLineRevealing; | 665 delete this._skipExecutionLineRevealing; |
627 }, | 666 }, |
628 | 667 |
629 /** | 668 /** |
630 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 669 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
631 */ | 670 */ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 this._runSnippetButton.element.classList.add("hidden"); | 712 this._runSnippetButton.element.classList.add("hidden"); |
674 | 713 |
675 // Continue. | 714 // Continue. |
676 handler = function() { return WebInspector.actionRegistry.execute("debug ger.toggle-pause"); }; | 715 handler = function() { return WebInspector.actionRegistry.execute("debug ger.toggle-pause"); }; |
677 this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-paus e", "", handler, []); | 716 this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-paus e", "", handler, []); |
678 debugToolbar.appendChild(this._pauseButton.element); | 717 debugToolbar.appendChild(this._pauseButton.element); |
679 | 718 |
680 // Long resume. | 719 // Long resume. |
681 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms "); | 720 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms "); |
682 this._longResumeButton = new WebInspector.StatusBarButton(title, "script s-long-resume"); | 721 this._longResumeButton = new WebInspector.StatusBarButton(title, "script s-long-resume"); |
683 this._longResumeButton.addEventListener("click", this._longResume.bind(t his), this); | 722 this._longResumeButton.addEventListener("click", this._stepButtonHandler .bind(this, this._longResume), this); |
684 | 723 |
685 // Step over. | 724 // Step over. |
686 title = WebInspector.UIString("Step over next function call (%s)."); | 725 title = WebInspector.UIString("Step over next function call (%s)."); |
687 handler = this._stepOverClicked.bind(this); | 726 handler = this._stepButtonHandler.bind(this, this._stepOver); |
688 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St epOver); | 727 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St epOver); |
689 debugToolbar.appendChild(this._stepOverButton.element); | 728 debugToolbar.appendChild(this._stepOverButton.element); |
690 | 729 |
691 // Step into. | 730 // Step into. |
692 title = WebInspector.UIString("Step into next function call (%s)."); | 731 title = WebInspector.UIString("Step into next function call (%s)."); |
693 handler = this._stepIntoClicked.bind(this); | 732 handler = this._stepButtonHandler.bind(this, this._stepInto); |
694 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St epInto); | 733 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St epInto); |
695 debugToolbar.appendChild(this._stepIntoButton.element); | 734 debugToolbar.appendChild(this._stepIntoButton.element); |
696 | 735 |
697 // Step out. | 736 // Step out. |
698 title = WebInspector.UIString("Step out of current function (%s)."); | 737 title = WebInspector.UIString("Step out of current function (%s)."); |
699 handler = this._stepOutClicked.bind(this); | 738 handler = this._stepButtonHandler.bind(this, this._stepOut); |
700 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step Out); | 739 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step Out); |
701 debugToolbar.appendChild(this._stepOutButton.element); | 740 debugToolbar.appendChild(this._stepOutButton.element); |
702 | 741 |
703 // Toggle Breakpoints | 742 // Toggle Breakpoints |
704 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 743 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
705 this._toggleBreakpointsButton.toggled = false; | 744 this._toggleBreakpointsButton.toggled = false; |
706 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); | 745 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); |
707 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | 746 debugToolbar.appendChild(this._toggleBreakpointsButton.element); |
708 | 747 |
709 // Pause on Exception | 748 // Pause on Exception |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
990 } | 1029 } |
991 target.consoleModel.showErrorMessage(message); | 1030 target.consoleModel.showErrorMessage(message); |
992 } | 1031 } |
993 }, | 1032 }, |
994 | 1033 |
995 /** | 1034 /** |
996 * @param {!WebInspector.RemoteObject} remoteObject | 1035 * @param {!WebInspector.RemoteObject} remoteObject |
997 */ | 1036 */ |
998 _showFunctionDefinition: function(remoteObject) | 1037 _showFunctionDefinition: function(remoteObject) |
999 { | 1038 { |
1039 var target = remoteObject.target(); | |
1040 | |
1000 /** | 1041 /** |
1001 * @param {?Protocol.Error} error | 1042 * @param {?Protocol.Error} error |
1002 * @param {!DebuggerAgent.FunctionDetails} response | 1043 * @param {!DebuggerAgent.FunctionDetails} response |
1003 * @this {WebInspector.SourcesPanel} | 1044 * @this {WebInspector.SourcesPanel} |
1004 */ | 1045 */ |
1005 function didGetFunctionDetails(error, response) | 1046 function didGetFunctionDetails(error, response) |
1006 { | 1047 { |
1007 if (error) { | 1048 if (error) { |
1008 console.error(error); | 1049 console.error(error); |
1009 return; | 1050 return; |
1010 } | 1051 } |
1011 | 1052 |
1012 var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation( response.location); | 1053 var uiLocation = target.debuggerModel.rawLocationToUILocation(respon se.location); |
1013 if (!uiLocation) | 1054 if (!uiLocation) |
1014 return; | 1055 return; |
1015 | 1056 |
1016 this.showUILocation(uiLocation, true); | 1057 this.showUILocation(uiLocation, true); |
1017 } | 1058 } |
1018 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetFunctionDe tails.bind(this)); | 1059 target.debuggerAgent().getFunctionDetails(remoteObject.objectId, didGetF unctionDetails.bind(this)); |
1019 }, | 1060 }, |
1020 | 1061 |
1021 showGoToSourceDialog: function() | 1062 showGoToSourceDialog: function() |
1022 { | 1063 { |
1023 this._sourcesView.showOpenResourceDialog(); | 1064 this._sourcesView.showOpenResourceDialog(); |
1024 }, | 1065 }, |
1025 | 1066 |
1026 _dockSideChanged: function() | 1067 _dockSideChanged: function() |
1027 { | 1068 { |
1028 var vertically = WebInspector.dockController.isVertical() && WebInspecto r.settings.splitVerticallyWhenDockedToRight.get(); | 1069 var vertically = WebInspector.dockController.isVertical() && WebInspecto r.settings.splitVerticallyWhenDockedToRight.get(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype = { | 1452 WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype = { |
1412 /** | 1453 /** |
1413 * @return {boolean} | 1454 * @return {boolean} |
1414 */ | 1455 */ |
1415 handleAction: function() | 1456 handleAction: function() |
1416 { | 1457 { |
1417 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.sh owPanel("sources")).togglePause(); | 1458 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.sh owPanel("sources")).togglePause(); |
1418 return true; | 1459 return true; |
1419 } | 1460 } |
1420 } | 1461 } |
OLD | NEW |