Title: [287776] trunk/Source/WebInspectorUI
Revision
287776
Author
pan...@apple.com
Date
2022-01-07 12:20:58 -0800 (Fri, 07 Jan 2022)

Log Message

Uncaught Exception: Cannot step over because debugger is not paused
https://bugs.webkit.org/show_bug.cgi?id=234575

Reviewed by Devin Rousso.

Previously keyboard shortcuts for advancing the debugger did not check to make sure that the debugger was
actually paused before attempting to step. This led to an uncaught exception in engineering builds. We now
enable and disable these keyboard shortcuts based on the whether or not the debugger is currently paused.

* UserInterface/Base/Main.js:

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (287775 => 287776)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-01-07 19:57:05 UTC (rev 287775)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-01-07 20:20:58 UTC (rev 287776)
@@ -1,3 +1,16 @@
+2022-01-07  Patrick Angle  <pan...@apple.com>
+
+        Uncaught Exception: Cannot step over because debugger is not paused
+        https://bugs.webkit.org/show_bug.cgi?id=234575
+
+        Reviewed by Devin Rousso.
+
+        Previously keyboard shortcuts for advancing the debugger did not check to make sure that the debugger was
+        actually paused before attempting to step. This led to an uncaught exception in engineering builds. We now
+        enable and disable these keyboard shortcuts based on the whether or not the debugger is currently paused.
+
+        * UserInterface/Base/Main.js:
+
 2022-01-07  Alex Christensen  <achristen...@webkit.org>
 
         Unreviewed, reverting r287698.

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (287775 => 287776)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2022-01-07 19:57:05 UTC (rev 287775)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2022-01-07 20:20:58 UTC (rev 287776)
@@ -132,6 +132,7 @@
 
     // Register for events.
     WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, WI._debuggerDidPause, WI);
+    WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, WI._debuggerDidResume, WI);
     WI.domManager.addEventListener(WI.DOMManager.Event.InspectModeStateChanged, WI._inspectModeStateChanged, WI);
     WI.domManager.addEventListener(WI.DOMManager.Event.DOMNodeWasInspected, WI._domNodeWasInspected, WI);
     WI.domStorageManager.addEventListener(WI.DOMStorageManager.Event.DOMStorageObjectWasInspected, WI._domStorageWasInspected, WI);
@@ -342,6 +343,8 @@
         WI.stepNextAlternateKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.SingleQuote, WI.debuggerStepNext);
     }
 
+    WI._updateDebuggerKeyboardShortcuts();
+
     WI.settingsKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Comma, WI._handleSettingsKeyboardShortcut);
 
     WI._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", WI._togglePreviousDockConfiguration);
@@ -1669,10 +1672,34 @@
 WI._debuggerDidPause = function(event)
 {
     WI.showSourcesTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value});
+    WI._updateDebuggerKeyboardShortcuts();
 
     InspectorFrontendHost.bringToFront();
 };
 
+WI._debuggerDidResume = function(event)
+{
+    WI._updateDebuggerKeyboardShortcuts();
+};
+
+WI._updateDebuggerKeyboardShortcuts = function()
+{
+    let paused = WI.debuggerManager.paused;
+
+    WI.stepOverKeyboardShortcut.disabled = !paused;
+    WI.stepIntoKeyboardShortcut.disabled = !paused;
+    WI.stepOutKeyboardShortcut.disabled = !paused;
+    WI.stepOverAlternateKeyboardShortcut.disabled = !paused;
+    WI.stepIntoAlternateKeyboardShortcut.disabled = !paused;
+    WI.stepOutAlternateKeyboardShortcut.disabled = !paused;
+
+    // COMPATIBILITY (iOS 13.4): Debugger.stepNext did not exist.
+    if (InspectorBackend.hasCommand("Debugger.stepNext")) {
+        WI.stepNextKeyboardShortcut.disabled = !paused;
+        WI.stepNextAlternateKeyboardShortcut.disabled = !paused;
+    }
+};
+
 WI._frameWasAdded = function(event)
 {
     if (!WI._frameIdentifierToShowSourceCodeWhenAvailable)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to