diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 48cbfd83108e..21a49e321361 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4989,8 +4989,11 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext, AutoWeakFrame weakThis = this; if (NS_SUCCEEDED(result) && parentContent) { - frameselection->HandleTableSelection(parentContent, contentOffset, target, - mouseEvent); + result = frameselection->HandleTableSelection(parentContent, contentOffset, + target, mouseEvent); + if (NS_WARN_IF(NS_FAILED(result))) { + return result; + } } else { nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mouseEvent, this); frameselection->HandleDrag(this, pt); diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index aefdaf4f127e..ec84d6c3bc46 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -1395,8 +1395,11 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, // Start selecting in the cell we were in before nsINode* parent = ParentOffset(mTableSelection.mCellParent, &offset); if (parent) { - HandleTableSelection(parent, offset, TableSelectionMode::Cell, - &event); + const nsresult result = HandleTableSelection( + parent, offset, TableSelectionMode::Cell, &event); + if (NS_WARN_IF(NS_FAILED(result))) { + return result; + } } // Find the parent of this new cell and extend selection to it @@ -1408,8 +1411,11 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, if (parent) { mTableSelection.mCellParent = cellparent; // Continue selection into next cell - HandleTableSelection(parent, offset, TableSelectionMode::Cell, - &event); + const nsresult result = HandleTableSelection( + parent, offset, TableSelectionMode::Cell, &event); + if (NS_WARN_IF(NS_FAILED(result))) { + return result; + } } } else { // XXXX Problem: Shift+click in browser is appending text selection to diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h index 01dfd4f7f816..351d03b595d8 100644 --- a/layout/generic/nsFrameSelection.h +++ b/layout/generic/nsFrameSelection.h @@ -284,7 +284,7 @@ class nsFrameSelection final { * and what keys are pressed */ // TODO: replace with `MOZ_CAN_RUN_SCRIPT`. - MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult + [[nodiscard]] MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult HandleTableSelection(nsINode* aParentContent, int32_t aContentOffset, mozilla::TableSelectionMode aTarget, mozilla::WidgetMouseEvent* aMouseEvent); @@ -817,7 +817,7 @@ class nsFrameSelection final { // (according to GetFirstCellNodeInRange). nsRange* GetNextCellRange(const mozilla::dom::Selection& aNormalSelection); - MOZ_CAN_RUN_SCRIPT nsresult + [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult HandleSelection(nsINode* aParentContent, int32_t aContentOffset, mozilla::TableSelectionMode aTarget, mozilla::WidgetMouseEvent* aMouseEvent, bool aDragState,