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 | |
129 this._installDebuggerSidebarController(); | 128 this._installDebuggerSidebarController(); |
130 | 129 |
131 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); | 130 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); |
132 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | 131 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); |
133 this._dockSideChanged(); | 132 this._dockSideChanged(); |
134 | 133 |
135 this._updateDebuggerButtons(); | 134 this._updateDebuggerButtons(); |
136 this._pauseOnExceptionEnabledChanged(); | 135 this._pauseOnExceptionEnabledChanged(); |
137 if (WebInspector.debuggerModel.isPaused()) | |
138 this._showDebuggerPausedDetails(WebInspector.debuggerModel.debuggerPause
dDetails()); | |
139 | |
140 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO
nExceptionEnabledChanged, this); | 136 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO
nExceptionEnabledChanged, this); |
141 WebInspector.targetManager.observeTargets(this); | 137 WebInspector.targetManager.observeTargets(this); |
| 138 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); |
| 139 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu
rrentTargetChanged, this); |
142 } | 140 } |
143 | 141 |
144 WebInspector.SourcesPanel.minToolbarWidth = 215; | 142 WebInspector.SourcesPanel.minToolbarWidth = 215; |
145 | 143 |
146 WebInspector.SourcesPanel.prototype = { | 144 WebInspector.SourcesPanel.prototype = { |
147 /** | 145 /** |
148 * @param {!WebInspector.Target} target | 146 * @param {!WebInspector.Target} target |
149 */ | 147 */ |
150 targetAdded: function(target) { | 148 targetAdded: function(target) |
| 149 { |
151 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerWasEnabled, this._debuggerWasEnabled, this); | 150 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerWasEnabled, this._debuggerWasEnabled, this); |
152 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerWasDisabled, this._debuggerWasDisabled, this); | 151 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerWasDisabled, this._debuggerReset, this); |
153 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerPaused, this._debuggerPaused, this); | 152 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerPaused, this._debuggerPaused, this); |
154 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerResumed, this._debuggerResumed, this); | 153 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerResumed, this._debuggerResumed, this); |
155 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
CallFrameSelected, this._callFrameSelected, this); | 154 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
CallFrameSelected, this._callFrameSelected, this); |
156 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSelec
tedCallFrame, this); | 155 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSelec
tedCallFrame, this); |
157 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 156 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); |
158 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
GlobalObjectCleared, this._debuggerReset, this); | 157 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
GlobalObjectCleared, this._debuggerReset, this); |
159 }, | 158 }, |
160 | 159 |
161 /** | 160 /** |
162 * @param {!WebInspector.Target} target | 161 * @param {!WebInspector.Target} target |
163 */ | 162 */ |
164 targetRemoved: function(target) { | 163 targetRemoved: function(target) |
| 164 { |
165 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerWasEnabled, this._debuggerWasEnabled, this); | 165 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerWasEnabled, this._debuggerWasEnabled, this); |
166 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerWasDisabled, this._debuggerWasDisabled, this); | 166 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerWasDisabled, this._debuggerReset, this); |
167 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerPaused, this._debuggerPaused, this); | 167 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerPaused, this._debuggerPaused, this); |
168 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerResumed, this._debuggerResumed, this); | 168 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerResumed, this._debuggerResumed, this); |
169 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.CallFrameSelected, this._callFrameSelected, this); | 169 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.CallFrameSelected, this._callFrameSelected, this); |
170 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSe
lectedCallFrame, this); | 170 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.ConsoleCommandEvaluatedInSelectedCallFrame, this._consoleCommandEvaluatedInSe
lectedCallFrame, this); |
171 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); | 171 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this); |
172 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.GlobalObjectCleared, this._debuggerReset, this); | 172 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.GlobalObjectCleared, this._debuggerReset, this); |
173 | |
174 }, | 173 }, |
175 | 174 |
176 /** | 175 /** |
| 176 * @param {?WebInspector.Target} target |
| 177 */ |
| 178 _setTarget: function(target) |
| 179 { |
| 180 if (!target) |
| 181 return; |
| 182 |
| 183 if (target.debuggerModel.isPaused()) { |
| 184 this._showDebuggerPausedDetails(/** @type {!WebInspector.DebuggerPau
sedDetails} */ (target.debuggerModel.debuggerPausedDetails())); |
| 185 var callFrame = target.debuggerModel.selectedCallFrame(); |
| 186 if (callFrame) |
| 187 this._selectCallFrame(callFrame); |
| 188 } else { |
| 189 this._paused = false; |
| 190 this._clearInterface(); |
| 191 this._toggleDebuggerSidebarButton.setEnabled(true); |
| 192 } |
| 193 }, |
| 194 |
| 195 /** |
| 196 * @param {!WebInspector.Event} event |
| 197 */ |
| 198 _onCurrentTargetChanged: function(event) |
| 199 { |
| 200 var target = /** @type {?WebInspector.Target} */ (event.data); |
| 201 this._setTarget(target); |
| 202 }, |
| 203 |
| 204 /** |
177 * @return {!Element} | 205 * @return {!Element} |
178 */ | 206 */ |
179 defaultFocusedElement: function() | 207 defaultFocusedElement: function() |
180 { | 208 { |
181 return this._sourcesView.defaultFocusedElement() || this._navigator.view
.defaultFocusedElement(); | 209 return this._sourcesView.defaultFocusedElement() || this._navigator.view
.defaultFocusedElement(); |
182 }, | 210 }, |
183 | 211 |
184 get paused() | 212 /** |
| 213 * @return {boolean} |
| 214 */ |
| 215 paused: function() |
185 { | 216 { |
186 return this._paused; | 217 return this._paused; |
187 }, | 218 }, |
188 | 219 |
189 /** | 220 /** |
190 * @return {!WebInspector.SourcesPanel.DrawerEditor} | 221 * @return {!WebInspector.SourcesPanel.DrawerEditor} |
191 */ | 222 */ |
192 _drawerEditor: function() | 223 _drawerEditor: function() |
193 { | 224 { |
194 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec
tor.DrawerEditor); | 225 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec
tor.DrawerEditor); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 { | 259 { |
229 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC
allFrame()); | 260 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC
allFrame()); |
230 }, | 261 }, |
231 | 262 |
232 /** | 263 /** |
233 * @param {!WebInspector.Event} event | 264 * @param {!WebInspector.Event} event |
234 */ | 265 */ |
235 _debuggerPaused: function(event) | 266 _debuggerPaused: function(event) |
236 { | 267 { |
237 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event.
data); | 268 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event.
data); |
238 WebInspector.inspectorView.setCurrentPanel(this); | 269 if (!this._paused) |
239 this._showDebuggerPausedDetails(details); | 270 WebInspector.inspectorView.setCurrentPanel(this); |
| 271 |
| 272 if (WebInspector.context.flavor(WebInspector.Target) === details.target(
)) |
| 273 this._showDebuggerPausedDetails(details); |
| 274 else if (!this._paused) |
| 275 WebInspector.context.setFlavor(WebInspector.Target, details.target()
); |
240 }, | 276 }, |
241 | 277 |
242 /** | 278 /** |
243 * @param {?WebInspector.DebuggerPausedDetails} details | 279 * @param {!WebInspector.DebuggerPausedDetails} details |
244 */ | 280 */ |
245 _showDebuggerPausedDetails: function(details) | 281 _showDebuggerPausedDetails: function(details) |
246 { | 282 { |
247 this._paused = true; | 283 this._paused = true; |
248 this._waitingToPause = false; | |
249 | |
250 this._updateDebuggerButtons(); | 284 this._updateDebuggerButtons(); |
251 | 285 |
252 this.sidebarPanes.callstack.update(details); | 286 this.sidebarPanes.callstack.update(details); |
253 | 287 |
254 /** | 288 /** |
255 * @param {!Element} element | 289 * @param {!Element} element |
256 * @this {WebInspector.SourcesPanel} | 290 * @this {WebInspector.SourcesPanel} |
257 */ | 291 */ |
258 function didCreateBreakpointHitStatusMessage(element) | 292 function didCreateBreakpointHitStatusMessage(element) |
259 { | 293 { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 else | 333 else |
300 console.warn("ScriptsPanel paused, but callFrames.length is zero
."); // TODO remove this once we understand this case better | 334 console.warn("ScriptsPanel paused, but callFrames.length is zero
."); // TODO remove this once we understand this case better |
301 } | 335 } |
302 | 336 |
303 this._splitView.showBoth(true); | 337 this._splitView.showBoth(true); |
304 this._toggleDebuggerSidebarButton.setEnabled(false); | 338 this._toggleDebuggerSidebarButton.setEnabled(false); |
305 window.focus(); | 339 window.focus(); |
306 InspectorFrontendHost.bringToFront(); | 340 InspectorFrontendHost.bringToFront(); |
307 }, | 341 }, |
308 | 342 |
309 _debuggerResumed: function() | 343 /** |
| 344 * @param {!WebInspector.Event} event |
| 345 */ |
| 346 _debuggerResumed: function(event) |
310 { | 347 { |
| 348 var target = /** @type {!WebInspector.Target} */ (event.target.target()
); |
| 349 if (WebInspector.context.flavor(WebInspector.Target) !== target) |
| 350 return; |
311 this._paused = false; | 351 this._paused = false; |
312 this._waitingToPause = false; | |
313 | |
314 this._clearInterface(); | 352 this._clearInterface(); |
315 this._toggleDebuggerSidebarButton.setEnabled(true); | 353 this._toggleDebuggerSidebarButton.setEnabled(true); |
316 }, | 354 }, |
317 | 355 |
318 _debuggerWasEnabled: function() | 356 /** |
| 357 * @param {!WebInspector.Event} event |
| 358 */ |
| 359 _debuggerWasEnabled: function(event) |
319 { | 360 { |
| 361 var target = /** @type {!WebInspector.Target} */ (event.target.target()
); |
| 362 if (WebInspector.context.flavor(WebInspector.Target) !== target) |
| 363 return; |
| 364 |
320 this._updateDebuggerButtons(); | 365 this._updateDebuggerButtons(); |
321 }, | 366 }, |
322 | 367 |
323 _debuggerWasDisabled: function() | 368 /** |
| 369 * @param {!WebInspector.Event} event |
| 370 */ |
| 371 _debuggerReset: function(event) |
324 { | 372 { |
325 this._debuggerReset(); | 373 this._debuggerResumed(event); |
326 }, | |
327 | |
328 _debuggerReset: function() | |
329 { | |
330 this._debuggerResumed(); | |
331 this.sidebarPanes.watchExpressions.reset(); | |
332 delete this._skipExecutionLineRevealing; | 374 delete this._skipExecutionLineRevealing; |
333 }, | 375 }, |
334 | 376 |
335 /** | 377 /** |
336 * @return {!WebInspector.View} | 378 * @return {!WebInspector.View} |
337 */ | 379 */ |
338 get visibleView() | 380 get visibleView() |
339 { | 381 { |
340 return this._sourcesView.visibleView(); | 382 return this._sourcesView.visibleView(); |
341 }, | 383 }, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 _executionLineChanged: function(uiLocation) | 433 _executionLineChanged: function(uiLocation) |
392 { | 434 { |
393 this._sourcesView.clearCurrentExecutionLine(); | 435 this._sourcesView.clearCurrentExecutionLine(); |
394 this._sourcesView.setExecutionLine(uiLocation); | 436 this._sourcesView.setExecutionLine(uiLocation); |
395 if (this._skipExecutionLineRevealing) | 437 if (this._skipExecutionLineRevealing) |
396 return; | 438 return; |
397 this._skipExecutionLineRevealing = true; | 439 this._skipExecutionLineRevealing = true; |
398 this._sourcesView.showSourceLocation(uiLocation.uiSourceCode, uiLocation
.lineNumber, 0, undefined, true); | 440 this._sourcesView.showSourceLocation(uiLocation.uiSourceCode, uiLocation
.lineNumber, 0, undefined, true); |
399 }, | 441 }, |
400 | 442 |
| 443 /** |
| 444 * @param {!WebInspector.Event} event |
| 445 */ |
401 _callFrameSelected: function(event) | 446 _callFrameSelected: function(event) |
402 { | 447 { |
403 var callFrame = event.data; | 448 var callFrame = /** @type {?WebInspector.DebuggerModel.CallFrame} */ (ev
ent.data); |
404 | 449 |
405 if (!callFrame) | 450 if (!callFrame || callFrame.target() !== WebInspector.context.flavor(Web
Inspector.Target)) |
406 return; | 451 return; |
407 | 452 |
| 453 this._selectCallFrame(callFrame); |
| 454 }, |
| 455 |
| 456 /** |
| 457 * @param {!WebInspector.DebuggerModel.CallFrame} callFrame |
| 458 */ |
| 459 _selectCallFrame: function(callFrame) |
| 460 { |
408 this.sidebarPanes.scopechain.update(callFrame); | 461 this.sidebarPanes.scopechain.update(callFrame); |
409 this.sidebarPanes.watchExpressions.refreshExpressions(); | 462 this.sidebarPanes.watchExpressions.refreshExpressions(); |
410 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | 463 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); |
411 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | 464 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); |
412 }, | 465 }, |
413 | 466 |
414 /** | 467 /** |
415 * @param {!WebInspector.Event} event | 468 * @param {!WebInspector.Event} event |
416 */ | 469 */ |
417 _sourceSelected: function(event) | 470 _sourceSelected: function(event) |
(...skipping 14 matching lines...) Expand all Loading... |
432 _pauseOnExceptionEnabledChanged: function() | 485 _pauseOnExceptionEnabledChanged: function() |
433 { | 486 { |
434 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); | 487 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); |
435 this._pauseOnExceptionButton.toggled = enabled; | 488 this._pauseOnExceptionButton.toggled = enabled; |
436 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do
n't pause on exceptions." : "Pause on exceptions."); | 489 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do
n't pause on exceptions." : "Pause on exceptions."); |
437 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 490 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
438 }, | 491 }, |
439 | 492 |
440 _updateDebuggerButtons: function() | 493 _updateDebuggerButtons: function() |
441 { | 494 { |
| 495 var currentTarget = WebInspector.context.flavor(WebInspector.Target); |
| 496 if (!currentTarget) |
| 497 return; |
| 498 |
442 if (this._paused) { | 499 if (this._paused) { |
443 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) | 500 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) |
444 this._pauseButton.state = true; | 501 this._pauseButton.state = true; |
445 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); | 502 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); |
446 | 503 |
447 this._pauseButton.setEnabled(true); | 504 this._pauseButton.setEnabled(true); |
448 this._stepOverButton.setEnabled(true); | 505 this._stepOverButton.setEnabled(true); |
449 this._stepIntoButton.setEnabled(true); | 506 this._stepIntoButton.setEnabled(true); |
450 this._stepOutButton.setEnabled(true); | 507 this._stepOutButton.setEnabled(true); |
451 } else { | 508 } else { |
452 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa
use script execution (%s).")) | 509 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa
use script execution (%s).")) |
453 this._pauseButton.state = false; | 510 this._pauseButton.state = false; |
454 this._pauseButton.setLongClickOptionsEnabled(null); | 511 this._pauseButton.setLongClickOptionsEnabled(null); |
455 | 512 |
456 this._pauseButton.setEnabled(!this._waitingToPause); | 513 this._pauseButton.setEnabled(!currentTarget.debuggerModel.isPausing(
)); |
457 this._stepOverButton.setEnabled(false); | 514 this._stepOverButton.setEnabled(false); |
458 this._stepIntoButton.setEnabled(false); | 515 this._stepIntoButton.setEnabled(false); |
459 this._stepOutButton.setEnabled(false); | 516 this._stepOutButton.setEnabled(false); |
460 } | 517 } |
461 }, | 518 }, |
462 | 519 |
463 _clearInterface: function() | 520 _clearInterface: function() |
464 { | 521 { |
465 this.sidebarPanes.callstack.update(null); | 522 this.sidebarPanes.callstack.update(null); |
466 this.sidebarPanes.scopechain.update(null); | 523 this.sidebarPanes.scopechain.update(null); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 { | 578 { |
522 var isSnippet = uiSourceCode && uiSourceCode.project().type() === WebIns
pector.projectTypes.Snippets; | 579 var isSnippet = uiSourceCode && uiSourceCode.project().type() === WebIns
pector.projectTypes.Snippets; |
523 this._runSnippetButton.element.classList.toggle("hidden", !isSnippet); | 580 this._runSnippetButton.element.classList.toggle("hidden", !isSnippet); |
524 }, | 581 }, |
525 | 582 |
526 /** | 583 /** |
527 * @return {boolean} | 584 * @return {boolean} |
528 */ | 585 */ |
529 togglePause: function() | 586 togglePause: function() |
530 { | 587 { |
| 588 var target = WebInspector.context.flavor(WebInspector.Target); |
| 589 if (!target) |
| 590 return true; |
| 591 |
531 if (this._paused) { | 592 if (this._paused) { |
532 delete this._skipExecutionLineRevealing; | 593 delete this._skipExecutionLineRevealing; |
533 this._paused = false; | 594 this._paused = false; |
534 this._waitingToPause = false; | 595 target.debuggerModel.resume(); |
535 WebInspector.debuggerModel.resume(); | |
536 } else { | 596 } else { |
537 this._waitingToPause = true; | |
538 // Make sure pauses didn't stick skipped. | 597 // Make sure pauses didn't stick skipped. |
539 WebInspector.debuggerModel.skipAllPauses(false); | 598 target.debuggerModel.pause(); |
540 DebuggerAgent.pause(); | |
541 } | 599 } |
542 | 600 |
543 this._clearInterface(); | 601 this._clearInterface(); |
544 return true; | 602 return true; |
545 }, | 603 }, |
546 | 604 |
547 /** | 605 /** |
| 606 * @return {?WebInspector.DebuggerModel} |
| 607 */ |
| 608 _prepareToResume: function() |
| 609 { |
| 610 if (!this._paused) |
| 611 return null; |
| 612 |
| 613 delete this._skipExecutionLineRevealing; |
| 614 this._paused = false; |
| 615 |
| 616 this._clearInterface(); |
| 617 var target = WebInspector.context.flavor(WebInspector.Target); |
| 618 return target ? target.debuggerModel : null; |
| 619 }, |
| 620 |
| 621 /** |
548 * @return {boolean} | 622 * @return {boolean} |
549 */ | 623 */ |
550 _longResume: function() | 624 _longResume: function() |
551 { | 625 { |
552 if (!this._paused) | 626 var debuggerModel = this._prepareToResume(); |
| 627 if (!debuggerModel) |
553 return true; | 628 return true; |
554 | 629 |
555 this._paused = false; | 630 debuggerModel.skipAllPausesUntilReloadOrTimeout(500); |
556 this._waitingToPause = false; | 631 debuggerModel.resume(); |
557 WebInspector.debuggerModel.skipAllPausesUntilReloadOrTimeout(500); | |
558 WebInspector.debuggerModel.resume(); | |
559 | |
560 this._clearInterface(); | |
561 return true; | 632 return true; |
562 }, | 633 }, |
563 | 634 |
564 /** | 635 /** |
565 * @return {boolean} | 636 * @return {boolean} |
566 */ | 637 */ |
567 _stepOverClicked: function() | 638 _stepOverClicked: function() |
568 { | 639 { |
569 if (!this._paused) | 640 var debuggerModel = this._prepareToResume(); |
| 641 if (!debuggerModel) |
570 return true; | 642 return true; |
571 | 643 |
572 delete this._skipExecutionLineRevealing; | 644 debuggerModel.stepOver(); |
573 this._paused = false; | |
574 | |
575 this._clearInterface(); | |
576 | |
577 WebInspector.debuggerModel.stepOver(); | |
578 return true; | 645 return true; |
579 }, | 646 }, |
580 | 647 |
581 /** | 648 /** |
582 * @return {boolean} | 649 * @return {boolean} |
583 */ | 650 */ |
584 _stepIntoClicked: function() | 651 _stepIntoClicked: function() |
585 { | 652 { |
586 if (!this._paused) | 653 var debuggerModel = this._prepareToResume(); |
| 654 if (!debuggerModel) |
587 return true; | 655 return true; |
588 | 656 |
589 delete this._skipExecutionLineRevealing; | 657 debuggerModel.stepInto(); |
590 this._paused = false; | |
591 | |
592 this._clearInterface(); | |
593 | |
594 WebInspector.debuggerModel.stepInto(); | |
595 return true; | 658 return true; |
596 }, | 659 }, |
597 | 660 |
598 /** | 661 /** |
599 * @return {boolean} | 662 * @return {boolean} |
600 */ | 663 */ |
601 _stepOutClicked: function() | 664 _stepOutClicked: function() |
602 { | 665 { |
603 if (!this._paused) | 666 var debuggerModel = this._prepareToResume(); |
| 667 if (!debuggerModel) |
604 return true; | 668 return true; |
605 | 669 |
606 delete this._skipExecutionLineRevealing; | 670 debuggerModel.stepOut(); |
607 this._paused = false; | |
608 | |
609 this._clearInterface(); | |
610 | |
611 WebInspector.debuggerModel.stepOut(); | |
612 return true; | 671 return true; |
613 }, | 672 }, |
614 | 673 |
615 /** | 674 /** |
616 * @param {!WebInspector.Event} event | 675 * @param {!WebInspector.Event} event |
617 */ | 676 */ |
618 _callFrameSelectedInSidebar: function(event) | 677 _callFrameSelectedInSidebar: function(event) |
619 { | 678 { |
620 var callFrame = /** @type {!WebInspector.DebuggerModel.CallFrame} */ (ev
ent.data); | 679 var callFrame = /** @type {!WebInspector.DebuggerModel.CallFrame} */ (ev
ent.data); |
621 delete this._skipExecutionLineRevealing; | 680 delete this._skipExecutionLineRevealing; |
622 WebInspector.debuggerModel.setSelectedCallFrame(callFrame); | 681 callFrame.target().debuggerModel.setSelectedCallFrame(callFrame); |
623 }, | 682 }, |
624 | 683 |
625 _callFrameRestartedInSidebar: function() | 684 _callFrameRestartedInSidebar: function() |
626 { | 685 { |
627 delete this._skipExecutionLineRevealing; | 686 delete this._skipExecutionLineRevealing; |
628 }, | 687 }, |
629 | 688 |
630 /** | 689 /** |
631 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 690 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
632 */ | 691 */ |
633 continueToLocation: function(rawLocation) | 692 continueToLocation: function(rawLocation) |
634 { | 693 { |
635 if (!this._paused) | 694 if (!this._prepareToResume()) |
636 return; | 695 return; |
637 | 696 |
638 delete this._skipExecutionLineRevealing; | |
639 this._paused = false; | |
640 this._clearInterface(); | |
641 rawLocation.continueToLocation(); | 697 rawLocation.continueToLocation(); |
642 }, | 698 }, |
643 | 699 |
644 _toggleBreakpointsClicked: function(event) | 700 _toggleBreakpointsClicked: function(event) |
645 { | 701 { |
646 WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerMo
del.breakpointsActive()); | 702 WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerMo
del.breakpointsActive()); |
647 }, | 703 }, |
648 | 704 |
649 _breakpointsActiveStateChanged: function(event) | 705 _breakpointsActiveStateChanged: function(event) |
650 { | 706 { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 } | 1047 } |
992 target.consoleModel.showErrorMessage(message); | 1048 target.consoleModel.showErrorMessage(message); |
993 } | 1049 } |
994 }, | 1050 }, |
995 | 1051 |
996 /** | 1052 /** |
997 * @param {!WebInspector.RemoteObject} remoteObject | 1053 * @param {!WebInspector.RemoteObject} remoteObject |
998 */ | 1054 */ |
999 _showFunctionDefinition: function(remoteObject) | 1055 _showFunctionDefinition: function(remoteObject) |
1000 { | 1056 { |
| 1057 var target = remoteObject.target(); |
| 1058 |
1001 /** | 1059 /** |
1002 * @param {?Protocol.Error} error | 1060 * @param {?Protocol.Error} error |
1003 * @param {!DebuggerAgent.FunctionDetails} response | 1061 * @param {!DebuggerAgent.FunctionDetails} response |
1004 * @this {WebInspector.SourcesPanel} | 1062 * @this {WebInspector.SourcesPanel} |
1005 */ | 1063 */ |
1006 function didGetFunctionDetails(error, response) | 1064 function didGetFunctionDetails(error, response) |
1007 { | 1065 { |
1008 if (error) { | 1066 if (error) { |
1009 console.error(error); | 1067 console.error(error); |
1010 return; | 1068 return; |
1011 } | 1069 } |
1012 | 1070 |
1013 var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(
response.location); | 1071 var uiLocation = target.debuggerModel.rawLocationToUILocation(respon
se.location); |
1014 if (!uiLocation) | 1072 if (!uiLocation) |
1015 return; | 1073 return; |
1016 | 1074 |
1017 this.showUILocation(uiLocation, true); | 1075 this.showUILocation(uiLocation, true); |
1018 } | 1076 } |
1019 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetFunctionDe
tails.bind(this)); | 1077 target.debuggerAgent().getFunctionDetails(remoteObject.objectId, didGetF
unctionDetails.bind(this)); |
1020 }, | 1078 }, |
1021 | 1079 |
1022 showGoToSourceDialog: function() | 1080 showGoToSourceDialog: function() |
1023 { | 1081 { |
1024 this._sourcesView.showOpenResourceDialog(); | 1082 this._sourcesView.showOpenResourceDialog(); |
1025 }, | 1083 }, |
1026 | 1084 |
1027 _dockSideChanged: function() | 1085 _dockSideChanged: function() |
1028 { | 1086 { |
1029 var vertically = WebInspector.dockController.isVertical() && WebInspecto
r.settings.splitVerticallyWhenDockedToRight.get(); | 1087 var vertically = WebInspector.dockController.isVertical() && WebInspecto
r.settings.splitVerticallyWhenDockedToRight.get(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype = { | 1470 WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype = { |
1413 /** | 1471 /** |
1414 * @return {boolean} | 1472 * @return {boolean} |
1415 */ | 1473 */ |
1416 handleAction: function() | 1474 handleAction: function() |
1417 { | 1475 { |
1418 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.sh
owPanel("sources")).togglePause(); | 1476 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.sh
owPanel("sources")).togglePause(); |
1419 return true; | 1477 return true; |
1420 } | 1478 } |
1421 } | 1479 } |
OLD | NEW |