| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 */ | 399 */ |
| 400 _sourceRenamed: function(event) | 400 _sourceRenamed: function(event) |
| 401 { | 401 { |
| 402 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 402 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); |
| 403 this._sourcesView.sourceRenamed(uiSourceCode); | 403 this._sourcesView.sourceRenamed(uiSourceCode); |
| 404 }, | 404 }, |
| 405 | 405 |
| 406 _pauseOnExceptionEnabledChanged: function() | 406 _pauseOnExceptionEnabledChanged: function() |
| 407 { | 407 { |
| 408 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); | 408 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); |
| 409 this._pauseOnExceptionButton.toggled = enabled; | 409 this._pauseOnExceptionButton.setToggled(enabled); |
| 410 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do
n't pause on exceptions." : "Pause on exceptions."); | 410 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D
on't pause on exceptions." : "Pause on exceptions.")); |
| 411 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 411 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
| 412 }, | 412 }, |
| 413 | 413 |
| 414 _updateDebuggerButtons: function() | 414 _updateDebuggerButtons: function() |
| 415 { | 415 { |
| 416 var currentTarget = WebInspector.context.flavor(WebInspector.Target); | 416 var currentTarget = WebInspector.context.flavor(WebInspector.Target); |
| 417 if (!currentTarget) | 417 if (!currentTarget) |
| 418 return; | 418 return; |
| 419 | 419 |
| 420 if (this._paused) { | 420 if (this._paused) { |
| 421 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) | 421 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Re
sume script execution (%s).")) |
| 422 this._pauseButton.state = true; | 422 this._pauseButton.setToggled(true); |
| 423 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); | 423 this._pauseButton.setLongClickOptionsEnabled((function() { return [
this._longResumeButton ] }).bind(this)); |
| 424 | 424 |
| 425 this._pauseButton.setEnabled(true); | 425 this._pauseButton.setEnabled(true); |
| 426 this._stepOverButton.setEnabled(true); | 426 this._stepOverButton.setEnabled(true); |
| 427 this._stepIntoButton.setEnabled(true); | 427 this._stepIntoButton.setEnabled(true); |
| 428 this._stepOutButton.setEnabled(true); | 428 this._stepOutButton.setEnabled(true); |
| 429 } else { | 429 } else { |
| 430 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa
use script execution (%s).")) | 430 this._updateButtonTitle(this._pauseButton, WebInspector.UIString("Pa
use script execution (%s).")) |
| 431 this._pauseButton.state = false; | 431 this._pauseButton.setToggled(false); |
| 432 this._pauseButton.setLongClickOptionsEnabled(null); | 432 this._pauseButton.setLongClickOptionsEnabled(null); |
| 433 | 433 |
| 434 this._pauseButton.setEnabled(!currentTarget.debuggerModel.isPausing(
)); | 434 this._pauseButton.setEnabled(!currentTarget.debuggerModel.isPausing(
)); |
| 435 this._stepOverButton.setEnabled(false); | 435 this._stepOverButton.setEnabled(false); |
| 436 this._stepIntoButton.setEnabled(false); | 436 this._stepIntoButton.setEnabled(false); |
| 437 this._stepOutButton.setEnabled(false); | 437 this._stepOutButton.setEnabled(false); |
| 438 } | 438 } |
| 439 }, | 439 }, |
| 440 | 440 |
| 441 _clearInterface: function() | 441 _clearInterface: function() |
| 442 { | 442 { |
| 443 this.sidebarPanes.callstack.update(null); | 443 this.sidebarPanes.callstack.update(null); |
| 444 this.sidebarPanes.scopechain.update(null); | 444 this.sidebarPanes.scopechain.update(null); |
| 445 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | 445 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); |
| 446 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); | 446 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); |
| 447 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); | 447 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); |
| 448 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); | 448 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); |
| 449 | 449 |
| 450 this._sourcesView.clearCurrentExecutionLine(); | 450 this._sourcesView.clearCurrentExecutionLine(); |
| 451 this._updateDebuggerButtons(); | 451 this._updateDebuggerButtons(); |
| 452 }, | 452 }, |
| 453 | 453 |
| 454 _togglePauseOnExceptions: function() | 454 _togglePauseOnExceptions: function() |
| 455 { | 455 { |
| 456 WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptio
nButton.toggled); | 456 WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptio
nButton.toggled()); |
| 457 }, | 457 }, |
| 458 | 458 |
| 459 /** | 459 /** |
| 460 * @return {boolean} | 460 * @return {boolean} |
| 461 */ | 461 */ |
| 462 _runSnippet: function() | 462 _runSnippet: function() |
| 463 { | 463 { |
| 464 var uiSourceCode = this._sourcesView.currentUISourceCode(); | 464 var uiSourceCode = this._sourcesView.currentUISourceCode(); |
| 465 if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets
) | 465 if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets
) |
| 466 return false; | 466 return false; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 }, | 611 }, |
| 612 | 612 |
| 613 _toggleBreakpointsClicked: function(event) | 613 _toggleBreakpointsClicked: function(event) |
| 614 { | 614 { |
| 615 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp
ointManager.breakpointsActive()); | 615 WebInspector.breakpointManager.setBreakpointsActive(!WebInspector.breakp
ointManager.breakpointsActive()); |
| 616 }, | 616 }, |
| 617 | 617 |
| 618 _breakpointsActiveStateChanged: function(event) | 618 _breakpointsActiveStateChanged: function(event) |
| 619 { | 619 { |
| 620 var active = event.data; | 620 var active = event.data; |
| 621 this._toggleBreakpointsButton.toggled = !active; | 621 this._toggleBreakpointsButton.setToggled(!active); |
| 622 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint
s-list-deactivated", !active); | 622 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint
s-list-deactivated", !active); |
| 623 this._sourcesView.toggleBreakpointsActiveState(active); | 623 this._sourcesView.toggleBreakpointsActiveState(active); |
| 624 if (active) | 624 if (active) |
| 625 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv
ate breakpoints."); | 625 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Deacti
vate breakpoints.")); |
| 626 else | 626 else |
| 627 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat
e breakpoints."); | 627 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Activa
te breakpoints.")); |
| 628 }, | 628 }, |
| 629 | 629 |
| 630 _createDebugToolbar: function() | 630 _createDebugToolbar: function() |
| 631 { | 631 { |
| 632 var debugToolbar = createElementWithClass("div", "scripts-debug-toolbar"
); | 632 var debugToolbar = createElementWithClass("div", "scripts-debug-toolbar"
); |
| 633 | 633 |
| 634 var title, handler; | 634 var title, handler; |
| 635 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C
trlOrMeta; | 635 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C
trlOrMeta; |
| 636 | 636 |
| 637 // Run snippet. | 637 // Run snippet. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 663 debugToolbar.appendChild(this._stepIntoButton.element); | 663 debugToolbar.appendChild(this._stepIntoButton.element); |
| 664 | 664 |
| 665 // Step out. | 665 // Step out. |
| 666 title = WebInspector.UIString("Step out of current function (%s)."); | 666 title = WebInspector.UIString("Step out of current function (%s)."); |
| 667 handler = this._stepOutClicked.bind(this); | 667 handler = this._stepOutClicked.bind(this); |
| 668 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); | 668 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); |
| 669 debugToolbar.appendChild(this._stepOutButton.element); | 669 debugToolbar.appendChild(this._stepOutButton.element); |
| 670 | 670 |
| 671 // Toggle Breakpoints | 671 // Toggle Breakpoints |
| 672 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 672 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
| 673 this._toggleBreakpointsButton.toggled = false; | 673 this._toggleBreakpointsButton.setToggled(false); |
| 674 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | 674 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); |
| 675 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | 675 debugToolbar.appendChild(this._toggleBreakpointsButton.element); |
| 676 | 676 |
| 677 // Pause on Exception | 677 // Pause on Exception |
| 678 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item"); | 678 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item"); |
| 679 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); | 679 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); |
| 680 debugToolbar.appendChild(this._pauseOnExceptionButton.element); | 680 debugToolbar.appendChild(this._pauseOnExceptionButton.element); |
| 681 | 681 |
| 682 return debugToolbar; | 682 return debugToolbar; |
| 683 }, | 683 }, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 694 }, | 694 }, |
| 695 | 695 |
| 696 /** | 696 /** |
| 697 * @param {!WebInspector.StatusBarButton} button | 697 * @param {!WebInspector.StatusBarButton} button |
| 698 * @param {string} buttonTitle | 698 * @param {string} buttonTitle |
| 699 */ | 699 */ |
| 700 _updateButtonTitle: function(button, buttonTitle) | 700 _updateButtonTitle: function(button, buttonTitle) |
| 701 { | 701 { |
| 702 var hasShortcuts = button.shortcuts && button.shortcuts.length; | 702 var hasShortcuts = button.shortcuts && button.shortcuts.length; |
| 703 if (hasShortcuts) | 703 if (hasShortcuts) |
| 704 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); | 704 button.setTitle(String.vsprintf(buttonTitle, [button.shortcuts[0].na
me])); |
| 705 else | 705 else |
| 706 button.title = buttonTitle; | 706 button.setTitle(buttonTitle); |
| 707 }, | 707 }, |
| 708 | 708 |
| 709 /** | 709 /** |
| 710 * @param {string} buttonId | 710 * @param {string} buttonId |
| 711 * @param {string} buttonTitle | 711 * @param {string} buttonTitle |
| 712 * @param {function(!Event=)} handler | 712 * @param {function(!Event=)} handler |
| 713 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts | 713 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts |
| 714 * @return {!WebInspector.StatusBarButton} | 714 * @return {!WebInspector.StatusBarButton} |
| 715 */ | 715 */ |
| 716 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) | 716 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 | 1413 |
| 1414 WebInspector.SourcesPanelFactory.prototype = { | 1414 WebInspector.SourcesPanelFactory.prototype = { |
| 1415 /** | 1415 /** |
| 1416 * @return {!WebInspector.Panel} | 1416 * @return {!WebInspector.Panel} |
| 1417 */ | 1417 */ |
| 1418 createPanel: function() | 1418 createPanel: function() |
| 1419 { | 1419 { |
| 1420 return WebInspector.SourcesPanel.instance(); | 1420 return WebInspector.SourcesPanel.instance(); |
| 1421 } | 1421 } |
| 1422 } | 1422 } |
| OLD | NEW |