- Revision
- 249291
- Author
- [email protected]
- Date
- 2019-08-29 13:50:24 -0700 (Thu, 29 Aug 2019)
Log Message
Web Inspector: REGRESSION (r248873): Debugger: pressing delete on a breakpoint will also delete any resource/element parent immediately before it in the list
https://bugs.webkit.org/show_bug.cgi?id=200939
Reviewed by Joseph Pecoraro.
* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement):
(WI.DebuggerSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
(WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement.checkIfSelectionAdjustmentNeeded): Deleted.
* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel):
(WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
(WI.SourcesNavigationSidebarPanel.this._breakpointsTreeOutline.ondelete.checkIfSelectionAdjustmentNeeded): Deleted.
When the `WI.TreeOutline`'s own `ondelete` is called, that means we must be handling a
delete that was _not_ handled by a `WI.TreeElement`. This means that the `selectedTreeElement`
has to be a resource/script, the `window` object, or one of the non-deletable breakpoints.
In the case of a non-deletable breakpoint, since they're never removed from their parent
`WI.TreeOutline`, we just shift the selection to the next selectable `WI.TreeElement`.
Otherwise, wait for the `WI.TreeOutline.Event.ElementRemoved` event to be fired, and adjust
the selection then based on whether the new `selectedTreeElement` is one of the "top" items,
namely the "All Exceptions", "Uncaught Exceptions", and "Assertion Failures" breakpoints.
* UserInterface/Views/BreakpointTreeElement.js:
(WI.BreakpointTreeElement.prototype.ondelete):
* UserInterface/Views/DOMBreakpointTreeElement.js:
(WI.DOMBreakpointTreeElement.prototype.ondelete):
* UserInterface/Views/DOMNodeTreeElement.js:
(WI.DOMNodeTreeElement.prototype.ondelete):
* UserInterface/Views/EventBreakpointTreeElement.js:
(WI.EventBreakpointTreeElement.prototype.ondelete):
* UserInterface/Views/URLBreakpointTreeElement.js:
(WI.URLBreakpointTreeElement.prototype.ondelete):
Add `return true;` to let the parent `WI.TreeOutline` know that the delete event was handled.
This prevents the parent `WI.TreeOutline`'s own `ondelete` from being called, which would
cause a double-delete as there would be a different `selectedTreeElement`.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (249290 => 249291)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-08-29 20:50:24 UTC (rev 249291)
@@ -1,3 +1,43 @@
+2019-08-29 Devin Rousso <[email protected]>
+
+ Web Inspector: REGRESSION (r248873): Debugger: pressing delete on a breakpoint will also delete any resource/element parent immediately before it in the list
+ https://bugs.webkit.org/show_bug.cgi?id=200939
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement):
+ (WI.DebuggerSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
+ (WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement.checkIfSelectionAdjustmentNeeded): Deleted.
+ * UserInterface/Views/SourcesNavigationSidebarPanel.js:
+ (WI.SourcesNavigationSidebarPanel):
+ (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved):
+ (WI.SourcesNavigationSidebarPanel.this._breakpointsTreeOutline.ondelete.checkIfSelectionAdjustmentNeeded): Deleted.
+ When the `WI.TreeOutline`'s own `ondelete` is called, that means we must be handling a
+ delete that was _not_ handled by a `WI.TreeElement`. This means that the `selectedTreeElement`
+ has to be a resource/script, the `window` object, or one of the non-deletable breakpoints.
+
+ In the case of a non-deletable breakpoint, since they're never removed from their parent
+ `WI.TreeOutline`, we just shift the selection to the next selectable `WI.TreeElement`.
+
+ Otherwise, wait for the `WI.TreeOutline.Event.ElementRemoved` event to be fired, and adjust
+ the selection then based on whether the new `selectedTreeElement` is one of the "top" items,
+ namely the "All Exceptions", "Uncaught Exceptions", and "Assertion Failures" breakpoints.
+
+ * UserInterface/Views/BreakpointTreeElement.js:
+ (WI.BreakpointTreeElement.prototype.ondelete):
+ * UserInterface/Views/DOMBreakpointTreeElement.js:
+ (WI.DOMBreakpointTreeElement.prototype.ondelete):
+ * UserInterface/Views/DOMNodeTreeElement.js:
+ (WI.DOMNodeTreeElement.prototype.ondelete):
+ * UserInterface/Views/EventBreakpointTreeElement.js:
+ (WI.EventBreakpointTreeElement.prototype.ondelete):
+ * UserInterface/Views/URLBreakpointTreeElement.js:
+ (WI.URLBreakpointTreeElement.prototype.ondelete):
+ Add `return true;` to let the parent `WI.TreeOutline` know that the delete event was handled.
+ This prevents the parent `WI.TreeOutline`'s own `ondelete` from being called, which would
+ cause a double-delete as there would be a different `selectedTreeElement`.
+
2019-08-29 Keith Rollin <[email protected]>
Remove support for macOS < 10.13 (part 3)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -77,20 +77,21 @@
ondelete()
{
- if (!WI.debuggerManager.isBreakpointRemovable(this._breakpoint)) {
- if (this._breakpoint.disabled)
- InspectorFrontendHost.beep();
- else
- this._breakpoint.disabled = true;
- return;
- }
-
// We set this flag so that TreeOutlines that will remove this
// BreakpointTreeElement will know whether it was deleted from
// within the TreeOutline or from outside it (e.g. TextEditor).
this.__deletedViaDeleteKeyboardShortcut = true;
- WI.debuggerManager.removeBreakpoint(this._breakpoint);
+ if (WI.debuggerManager.isBreakpointRemovable(this._breakpoint)) {
+ WI.debuggerManager.removeBreakpoint(this._breakpoint);
+ return true;
+ }
+
+ if (this._breakpoint.disabled)
+ InspectorFrontendHost.beep();
+ else
+ this._breakpoint.disabled = true;
+ return false;
}
onenter()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -106,6 +106,8 @@
this.__deletedViaDeleteKeyboardShortcut = true;
WI.domDebuggerManager.removeDOMBreakpoint(this.representedObject);
+
+ return true;
}
onenter()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -47,6 +47,8 @@
WI.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);
WI.domManager.removeEventListenerBreakpointsForNode(this.representedObject);
+
+ return true;
}
populateContextMenu(contextMenu, event)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -995,40 +995,22 @@
{
console.assert(selectedTreeElement.selected);
- let treeElementToSelect = null;
- function checkIfSelectionAdjustmentNeeded(treeElement) {
- if (!treeElement)
- return;
-
- let representedObjects = [
- WI.debuggerManager.allExceptionsBreakpoint,
- WI.debuggerManager.uncaughtExceptionsBreakpoint,
- WI.debuggerManager.assertionFailuresBreakpoint,
- ];
- if (representedObjects.includes(treeElement.representedObject))
- treeElementToSelect = selectedTreeElement.nextSibling;
- }
- checkIfSelectionAdjustmentNeeded(selectedTreeElement);
-
- if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
- checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
-
+ if (!WI.debuggerManager.isBreakpointRemovable(selectedTreeElement.representedObject)) {
+ let treeElementToSelect = selectedTreeElement.nextSelectableSibling;
+ if (treeElementToSelect) {
+ const omitFocus = true;
+ const selectedByUser = true;
+ treeElementToSelect.select(omitFocus, selectedByUser);
+ }
+ } else if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
let breakpoints = this._breakpointsBeneathTreeElement(selectedTreeElement);
this._removeAllBreakpoints(breakpoints);
} else if (selectedTreeElement.representedObject === DebuggerSidebarPanel.__windowEventTargetRepresentedObject) {
- checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
-
let eventBreakpointsOnWindow = WI.domManager.eventListenerBreakpoints.filter((eventBreakpoint) => eventBreakpoint.eventListener.onWindow);
for (let eventBreakpoint of eventBreakpointsOnWindow)
WI.domManager.removeBreakpointForEventListener(eventBreakpoint.eventListener);
}
- if (treeElementToSelect) {
- const omitFocus = true;
- const selectedByUser = true;
- treeElementToSelect.select(omitFocus, selectedByUser);
- }
-
return true;
}
@@ -1595,6 +1577,21 @@
}
if (setting)
setting.value = !!treeElement.parent;
+
+ if (event.type === WI.TreeOutline.Event.ElementRemoved) {
+ let selectedTreeElement = this._breakpointsContentTreeOutline.selectedTreeElement;
+ console.assert(selectedTreeElement);
+ if (selectedTreeElement.representedObject === WI.debuggerManager.assertionFailuresBreakpoint || !WI.debuggerManager.isBreakpointRemovable(selectedTreeElement.representedObject)) {
+ const skipUnrevealed = true;
+ const dontPopulate = true;
+ let treeElementToSelect = selectedTreeElement.traverseNextTreeElement(skipUnrevealed, dontPopulate);
+ if (treeElementToSelect) {
+ const omitFocus = true;
+ const selectedByUser = true;
+ treeElementToSelect.select(omitFocus, selectedByUser);
+ }
+ }
+ }
}
_populateCreateBreakpointContextMenu(contextMenu)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointTreeElement.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointTreeElement.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointTreeElement.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -92,6 +92,8 @@
WI.domManager.removeBreakpointForEventListener(this.representedObject.eventListener);
else
WI.domDebuggerManager.removeEventBreakpoint(this.representedObject);
+
+ return true;
}
onenter()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -141,40 +141,22 @@
this._breakpointsTreeOutline._ondelete_ = (selectedTreeElement) => {
console.assert(selectedTreeElement.selected);
- let treeElementToSelect = null;
- function checkIfSelectionAdjustmentNeeded(treeElement) {
- if (!treeElement)
- return;
-
- let representedObjects = [
- WI.debuggerManager.allExceptionsBreakpoint,
- WI.debuggerManager.uncaughtExceptionsBreakpoint,
- WI.debuggerManager.assertionFailuresBreakpoint,
- ];
- if (representedObjects.includes(treeElement.representedObject))
- treeElementToSelect = selectedTreeElement.nextSibling;
- }
- checkIfSelectionAdjustmentNeeded(selectedTreeElement);
-
- if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
- checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
-
+ if (!WI.debuggerManager.isBreakpointRemovable(selectedTreeElement.representedObject)) {
+ let treeElementToSelect = selectedTreeElement.nextSelectableSibling;
+ if (treeElementToSelect) {
+ const omitFocus = true;
+ const selectedByUser = true;
+ treeElementToSelect.select(omitFocus, selectedByUser);
+ }
+ } else if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
let breakpoints = this._breakpointsBeneathTreeElement(selectedTreeElement);
this._removeAllBreakpoints(breakpoints);
} else if (selectedTreeElement.representedObject === SourcesNavigationSidebarPanel.__windowEventTargetRepresentedObject) {
- checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
-
let eventBreakpointsOnWindow = WI.domManager.eventListenerBreakpoints.filter((eventBreakpoint) => eventBreakpoint.eventListener.onWindow);
for (let eventBreakpoint of eventBreakpointsOnWindow)
WI.domManager.removeBreakpointForEventListener(eventBreakpoint.eventListener);
}
- if (treeElementToSelect) {
- const omitFocus = true;
- const selectedByUser = true;
- treeElementToSelect.select(omitFocus, selectedByUser);
- }
-
return true;
};
this._breakpointsTreeOutline.populateContextMenu = (contextMenu, event, treeElement) => {
@@ -1631,6 +1613,21 @@
if (setting)
setting.value = !!treeElement.parent;
+
+ if (event.type === WI.TreeOutline.Event.ElementRemoved) {
+ let selectedTreeElement = this._breakpointsTreeOutline.selectedTreeElement;
+ console.assert(selectedTreeElement);
+ if (selectedTreeElement.representedObject === WI.debuggerManager.assertionFailuresBreakpoint || !WI.debuggerManager.isBreakpointRemovable(selectedTreeElement.representedObject)) {
+ const skipUnrevealed = true;
+ const dontPopulate = true;
+ let treeElementToSelect = selectedTreeElement.traverseNextTreeElement(skipUnrevealed, dontPopulate);
+ if (treeElementToSelect) {
+ const omitFocus = true;
+ const selectedByUser = true;
+ treeElementToSelect.select(omitFocus, selectedByUser);
+ }
+ }
+ }
}
_populateCreateBreakpointContextMenu(contextMenu)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js (249290 => 249291)
--- trunk/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js 2019-08-29 20:48:02 UTC (rev 249290)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js 2019-08-29 20:50:24 UTC (rev 249291)
@@ -94,6 +94,8 @@
this.__deletedViaDeleteKeyboardShortcut = true;
WI.domDebuggerManager.removeURLBreakpoint(this.representedObject);
+
+ return true;
}
onenter()