Title: [250076] trunk/Source/WebInspectorUI
Revision
250076
Author
joep...@webkit.org
Date
2019-09-18 18:45:35 -0700 (Wed, 18 Sep 2019)

Log Message

Web Inspector: console assertion when pressing up/down in empty console log view
https://bugs.webkit.org/show_bug.cgi?id=201948

Reviewed by Devin Rousso.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype._upArrowWasPressed):
(WI.LogContentView.prototype._downArrowWasPressed):
Ensure that a message exists before calling `_updateMessagesSelection`, which
would assert if given a bad message. Additionally, only perform preventDefault
when selecting a message. This allows us to fall back to a system beep if
this key event does nothing.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (250075 => 250076)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-09-19 01:30:30 UTC (rev 250075)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-09-19 01:45:35 UTC (rev 250076)
@@ -1,3 +1,18 @@
+2019-09-18  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: console assertion when pressing up/down in empty console log view
+        https://bugs.webkit.org/show_bug.cgi?id=201948
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype._upArrowWasPressed):
+        (WI.LogContentView.prototype._downArrowWasPressed):
+        Ensure that a message exists before calling `_updateMessagesSelection`, which
+        would assert if given a bad message. Additionally, only perform preventDefault
+        when selecting a message. This allows us to fall back to a system beep if
+        this key event does nothing.
+
 2019-09-17  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: HTML Formatter - better handling for HTML specific tag cases (<p>/<li>)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (250075 => 250076)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2019-09-19 01:30:30 UTC (rev 250075)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2019-09-19 01:45:35 UTC (rev 250076)
@@ -985,14 +985,16 @@
 
         var lastMessage = this._selectedMessages.lastValue;
         var previousMessage = this._previousMessage(lastMessage);
-        if (previousMessage)
+        if (previousMessage) {
             this._updateMessagesSelection(previousMessage, false, event.shiftKey, true);
-        else if (!event.shiftKey) {
+            event.preventDefault();
+        } else if (!event.shiftKey) {
             this._clearMessagesSelection();
-            this._updateMessagesSelection(messages[0], false, false, true);
+            if (messages.length) {
+                this._updateMessagesSelection(messages[0], false, false, true);
+                event.preventDefault();
+            }
         }
-
-        event.preventDefault();
     }
 
     _downArrowWasPressed(event)
@@ -1007,14 +1009,16 @@
 
         var lastMessage = this._selectedMessages.lastValue;
         var nextMessage = this._nextMessage(lastMessage);
-        if (nextMessage)
+        if (nextMessage) {
             this._updateMessagesSelection(nextMessage, false, event.shiftKey, true);
-        else if (!event.shiftKey) {
+            event.preventDefault();
+        } else if (!event.shiftKey) {
             this._clearMessagesSelection();
-            this._updateMessagesSelection(messages.lastValue, false, false, true);
+            if (messages.length) {
+                this._updateMessagesSelection(messages.lastValue, false, false, true);
+                event.preventDefault();
+            }
         }
-
-        event.preventDefault();
     }
 
     _leftArrowWasPressed(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to