From 964184af2416ee70852f08d4d707a7dd6936b64e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 23 Dec 2021 16:27:24 +0000 Subject: [PATCH] Bug 1539884 - Part 31: Mark nsTreeBodyFrame::FireScrollEvent as CAN_RUN_SCRIPT r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D134414 --- layout/xul/tree/nsTreeBodyFrame.cpp | 8 +++++--- layout/xul/tree/nsTreeBodyFrame.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 2de345a08c4b..eb70b5289acd 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -4178,8 +4178,8 @@ void nsTreeBodyFrame::ScrollCallback(nsITimer* aTimer, void* aClosure) { } } -NS_IMETHODIMP -nsTreeBodyFrame::ScrollEvent::Run() { +// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230, bug 1535398) +MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsTreeBodyFrame::ScrollEvent::Run() { if (mInner) { mInner->FireScrollEvent(); } @@ -4191,7 +4191,9 @@ void nsTreeBodyFrame::FireScrollEvent() { WidgetGUIEvent event(true, eScroll, nullptr); // scroll events fired at elements don't bubble event.mFlags.mBubbles = false; - EventDispatcher::Dispatch(GetContent(), PresContext(), &event); + RefPtr content = GetContent(); + RefPtr presContext = PresContext(); + EventDispatcher::Dispatch(content, presContext, &event); } void nsTreeBodyFrame::PostScrollEvent() { diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index da68417c2ea7..4823d4223d67 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -443,7 +443,7 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame, }; void PostScrollEvent(); - void FireScrollEvent(); + MOZ_CAN_RUN_SCRIPT void FireScrollEvent(); /** * Clear the pointer to this frame for all nsTreeImageListeners that were