From 03a9abe5902fa2d619a2a3f03bb6cd7913b6e493 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 3 Feb 2021 21:52:02 +0000 Subject: [PATCH] Bug 1671768 - Part 1: Use MOZ_CAN_RUN_SCRIPT for Selection::StyledRanges::MaybeFocusCommonEditingHost r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D103777 --- dom/base/Selection.cpp | 3 ++- dom/base/Selection.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/base/Selection.cpp b/dom/base/Selection.cpp index bc5367bdd0a4..061f9566a6b8 100644 --- a/dom/base/Selection.cpp +++ b/dom/base/Selection.cpp @@ -3130,7 +3130,8 @@ nsresult Selection::NotifySelectionListeners() { // browsers don't do it either. if (mSelectionType == SelectionType::eNormal && calledByJSRestorer.SavedValue()) { - mStyledRanges.MaybeFocusCommonEditingHost(GetPresShell()); + RefPtr presShell = GetPresShell(); + mStyledRanges.MaybeFocusCommonEditingHost(presShell); } RefPtr frameSelection = mFrameSelection; diff --git a/dom/base/Selection.h b/dom/base/Selection.h index 243d6a4c466e..2a2182e2ad4c 100644 --- a/dom/base/Selection.h +++ b/dom/base/Selection.h @@ -860,7 +860,7 @@ class Selection final : public nsSupportsWeakReference, */ Element* GetCommonEditingHost() const; - MOZ_CAN_RUN_SCRIPT_BOUNDARY void MaybeFocusCommonEditingHost( + MOZ_CAN_RUN_SCRIPT void MaybeFocusCommonEditingHost( PresShell* aPresShell) const; static nsresult SubtractRange(StyledRange& aRange, nsRange& aSubtract,