зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1743439 - Part 1: Mark callers in dom/animation and dom/base as MOZ_CAN_RUN_SCRIPT_BOUNDARY r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D133360
This commit is contained in:
Родитель
9adbf59c05
Коммит
d428dbd282
|
@ -156,19 +156,20 @@ struct AnimationEventInfo {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Dispatch(nsPresContext* aPresContext) {
|
||||
MOZ_CAN_RUN_SCRIPT void Dispatch(nsPresContext* aPresContext) {
|
||||
RefPtr<dom::EventTarget> target = mTarget;
|
||||
if (mEvent.is<RefPtr<dom::AnimationPlaybackEvent>>()) {
|
||||
EventDispatcher::DispatchDOMEvent(
|
||||
mTarget, nullptr /* WidgetEvent */,
|
||||
mEvent.as<RefPtr<dom::AnimationPlaybackEvent>>(), aPresContext,
|
||||
nullptr /* nsEventStatus */);
|
||||
auto playbackEvent = mEvent.as<RefPtr<dom::AnimationPlaybackEvent>>();
|
||||
EventDispatcher::DispatchDOMEvent(target, nullptr /* WidgetEvent */,
|
||||
playbackEvent, aPresContext,
|
||||
nullptr /* nsEventStatus */);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mEvent.is<InternalTransitionEvent>() ||
|
||||
mEvent.is<InternalAnimationEvent>());
|
||||
|
||||
EventDispatcher::Dispatch(mTarget, aPresContext, AsWidgetEvent());
|
||||
EventDispatcher::Dispatch(target, aPresContext, AsWidgetEvent());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1564,9 +1564,10 @@ class Document : public nsINode,
|
|||
|
||||
void DispatchContentLoadedEvents();
|
||||
|
||||
void DispatchPageTransition(EventTarget* aDispatchTarget,
|
||||
const nsAString& aType, bool aInFrameSwap,
|
||||
bool aPersisted, bool aOnlySystemGroup);
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY void DispatchPageTransition(
|
||||
EventTarget* aDispatchTarget, const nsAString& aType, bool aInFrameSwap,
|
||||
bool aPersisted, bool aOnlySystemGroup);
|
||||
|
||||
// Call this before the document does something that will unbind all content.
|
||||
// That will stop us from doing a lot of work as each element is removed.
|
||||
|
|
|
@ -3325,18 +3325,18 @@ class nsContentUtils {
|
|||
JS::MutableHandle<JS::Value> vp,
|
||||
bool aAllowWrapping);
|
||||
|
||||
static nsresult DispatchEvent(Document* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName, CanBubble,
|
||||
Cancelable, Composed, Trusted,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY static nsresult DispatchEvent(
|
||||
Document* aDoc, nsISupports* aTarget, const nsAString& aEventName,
|
||||
CanBubble, Cancelable, Composed, Trusted, bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
|
||||
static nsresult DispatchEvent(Document* aDoc, nsISupports* aTarget,
|
||||
mozilla::WidgetEvent& aWidgetEvent,
|
||||
EventMessage aEventMessage, CanBubble,
|
||||
Cancelable, Trusted,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY static nsresult DispatchEvent(
|
||||
Document* aDoc, nsISupports* aTarget, mozilla::WidgetEvent& aWidgetEvent,
|
||||
EventMessage aEventMessage, CanBubble, Cancelable, Trusted,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
|
||||
static void InitializeModifierStrings();
|
||||
|
||||
|
|
|
@ -3858,7 +3858,9 @@ void nsFrameLoader::MaybeNotifyCrashed(BrowsingContext* aBrowsingContext,
|
|||
RefPtr<FrameCrashedEvent> event = FrameCrashedEvent::Constructor(
|
||||
mOwnerContent->OwnerDoc(), eventName, init);
|
||||
event->SetTrusted(true);
|
||||
EventDispatcher::DispatchDOMEvent(mOwnerContent, nullptr, event, nullptr,
|
||||
|
||||
RefPtr<Element> ownerContent = mOwnerContent;
|
||||
EventDispatcher::DispatchDOMEvent(ownerContent, nullptr, event, nullptr,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -407,9 +407,11 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
|||
void ConfigRemoteProcess(const nsACString& aRemoteType,
|
||||
mozilla::dom::ContentParent* aContentParent);
|
||||
|
||||
void MaybeNotifyCrashed(mozilla::dom::BrowsingContext* aBrowsingContext,
|
||||
mozilla::dom::ContentParentId aChildID,
|
||||
mozilla::ipc::MessageChannel* aChannel);
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY void MaybeNotifyCrashed(
|
||||
mozilla::dom::BrowsingContext* aBrowsingContext,
|
||||
mozilla::dom::ContentParentId aChildID,
|
||||
mozilla::ipc::MessageChannel* aChannel);
|
||||
|
||||
void FireErrorEvent();
|
||||
|
||||
|
|
|
@ -4228,8 +4228,9 @@ bool nsGlobalWindowInner::DispatchEvent(Event& aEvent, CallerType aCallerType,
|
|||
RefPtr<nsPresContext> presContext = mDoc->GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
// TODO: Bug 1506441
|
||||
nsresult rv = EventDispatcher::DispatchDOMEvent(
|
||||
ToSupports(this), nullptr, &aEvent, presContext, &status);
|
||||
MOZ_KnownLive(ToSupports(this)), nullptr, &aEvent, presContext, &status);
|
||||
bool retval = !aEvent.DefaultPrevented(aCallerType);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
|
|
|
@ -306,9 +306,10 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
|
|||
EventTarget* GetTargetForDOMEvent() override;
|
||||
|
||||
using mozilla::dom::EventTarget::DispatchEvent;
|
||||
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool DispatchEvent(
|
||||
mozilla::dom::Event& aEvent, mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
|
||||
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
|
||||
|
|
|
@ -1076,9 +1076,10 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
||||
|
||||
using mozilla::dom::EventTarget::DispatchEvent;
|
||||
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool DispatchEvent(
|
||||
mozilla::dom::Event& aEvent, mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
|
||||
|
|
|
@ -26,9 +26,10 @@ struct ErrorEventInit;
|
|||
// notifies it of an error via nsIScriptGlobalObject::HandleScriptError.
|
||||
// Returns true if HandleDOMEvent was actually called, in which case
|
||||
// aStatus will be filled in with the status.
|
||||
bool NS_HandleScriptError(nsIScriptGlobalObject* aScriptGlobal,
|
||||
const mozilla::dom::ErrorEventInit& aErrorEvent,
|
||||
nsEventStatus* aStatus);
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool NS_HandleScriptError(
|
||||
nsIScriptGlobalObject* aScriptGlobal,
|
||||
const mozilla::dom::ErrorEventInit& aErrorEvent, nsEventStatus* aStatus);
|
||||
|
||||
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
|
||||
#define NS_ISCRIPTGLOBALOBJECT_IID \
|
||||
|
|
|
@ -377,9 +377,10 @@ class ScriptErrorEvent : public Runnable {
|
|||
mError(aRootingCx, aError),
|
||||
mErrorStack(aRootingCx, aErrorStack) {}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230, bug 1535398)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD Run() override {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsPIDOMWindowInner* win = mWindow;
|
||||
nsCOMPtr<nsPIDOMWindowInner> win = mWindow;
|
||||
MOZ_ASSERT(win);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// First, notify the DOM that we have a script error, but only if
|
||||
|
|
|
@ -28,9 +28,10 @@ class nsWindowRoot final : public nsPIWindowRoot {
|
|||
|
||||
bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final;
|
||||
|
||||
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool DispatchEvent(
|
||||
mozilla::dom::Event& aEvent, mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
|
||||
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче