mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1541094. Mark PostHandleEvent as MOZ_CAN_RUN_SCRIPT. r=smaug
The change to the EventTargetChainItem constructor is because we're changing mTarget to be const (to avoid taking extra stack refs to the EventTarget), so have to set it in the constructor instead of setting it after creating the object. Differential Revision: https://phabricator.services.mozilla.com/D25813 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
0cdebe20d7
commit
e5e9a70cac
@ -1868,6 +1868,7 @@ class Element : public FragmentOrElement {
|
||||
/**
|
||||
* Handle default actions for link event if the event isn't consumed yet.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEventForLinks(EventChainPostVisitor& aVisitor);
|
||||
|
||||
/**
|
||||
|
@ -948,6 +948,7 @@ class nsINode : public mozilla::dom::EventTarget {
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
/**
|
||||
|
@ -128,11 +128,9 @@ static bool IsEventTargetChrome(EventTarget* aEventTarget,
|
||||
|
||||
// EventTargetChainItem represents a single item in the event target chain.
|
||||
class EventTargetChainItem {
|
||||
private:
|
||||
explicit EventTargetChainItem(EventTarget* aTarget);
|
||||
|
||||
public:
|
||||
EventTargetChainItem() : mItemFlags(0) {
|
||||
explicit EventTargetChainItem(EventTarget* aTarget)
|
||||
: mTarget(aTarget), mItemFlags(0) {
|
||||
MOZ_COUNT_CTOR(EventTargetChainItem);
|
||||
}
|
||||
|
||||
@ -144,8 +142,7 @@ class EventTargetChainItem {
|
||||
// The last item which can handle the event must be aChild.
|
||||
MOZ_ASSERT(GetLastCanHandleEventTarget(aChain) == aChild);
|
||||
MOZ_ASSERT(!aTarget || aTarget == aTarget->GetTargetForEventTargetChain());
|
||||
EventTargetChainItem* etci = aChain.AppendElement();
|
||||
etci->mTarget = aTarget;
|
||||
EventTargetChainItem* etci = aChain.AppendElement(aTarget);
|
||||
return etci;
|
||||
}
|
||||
|
||||
@ -304,6 +301,7 @@ class EventTargetChainItem {
|
||||
* and system event group and calls also PostHandleEvent for each
|
||||
* item in the chain.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
static void HandleEventTargetChain(nsTArray<EventTargetChainItem>& aChain,
|
||||
EventChainPostVisitor& aVisitor,
|
||||
EventDispatchingCallback* aCallback,
|
||||
@ -359,10 +357,10 @@ class EventTargetChainItem {
|
||||
/**
|
||||
* Copies mItemFlags and mItemData to aVisitor and calls PostHandleEvent.
|
||||
*/
|
||||
void PostHandleEvent(EventChainPostVisitor& aVisitor);
|
||||
MOZ_CAN_RUN_SCRIPT void PostHandleEvent(EventChainPostVisitor& aVisitor);
|
||||
|
||||
private:
|
||||
nsCOMPtr<EventTarget> mTarget;
|
||||
const nsCOMPtr<EventTarget> mTarget;
|
||||
nsCOMPtr<EventTarget> mRetargetedRelatedTarget;
|
||||
Maybe<nsTArray<RefPtr<EventTarget>>> mRetargetedTouchTargets;
|
||||
Maybe<nsTArray<RefPtr<dom::Touch>>> mInitialTargetTouches;
|
||||
|
@ -332,6 +332,9 @@ class EventDispatcher {
|
||||
* eVoidEvent.
|
||||
* @note Use this method when dispatching a WidgetEvent.
|
||||
*/
|
||||
// This should obviously be MOZ_CAN_RUN_SCRIPT, but that's a bit of
|
||||
// a project. See bug 1539884.
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
static nsresult Dispatch(nsISupports* aTarget, nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent, dom::Event* aDOMEvent = nullptr,
|
||||
nsEventStatus* aEventStatus = nullptr,
|
||||
|
@ -248,6 +248,7 @@ class EventTarget : public nsISupports, public nsWrapperCache {
|
||||
* @see EventDispatcher.h for documentation about aVisitor.
|
||||
* @note Only EventDispatcher should call this method.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) = 0;
|
||||
|
||||
protected:
|
||||
|
@ -51,7 +51,8 @@ class HTMLAnchorElement final : public nsGenericHTMLElement, public Link {
|
||||
int32_t* aTabIndex) override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
virtual bool IsLink(nsIURI** aURI) const override;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) override;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
||||
|
@ -37,7 +37,8 @@ class HTMLAreaElement final : public nsGenericHTMLElement, public Link {
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
virtual bool IsLink(nsIURI** aURI) const override;
|
||||
virtual void GetLinkTarget(nsAString& aTarget) override;
|
||||
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
|
||||
|
@ -39,7 +39,8 @@ class HTMLLinkElement final : public nsGenericHTMLElement,
|
||||
|
||||
// EventTarget
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
// nsINode
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
@ -196,7 +196,8 @@ class HTMLSelectElement final : public nsGenericHTMLFormElementWithState,
|
||||
|
||||
// nsIContent
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
|
@ -267,6 +267,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
||||
bool CheckHandleEventForAnchorsPreconditions(
|
||||
mozilla::EventChainVisitor& aVisitor);
|
||||
void GetEventTargetParentForAnchors(mozilla::EventChainPreVisitor& aVisitor);
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEventForAnchors(mozilla::EventChainPostVisitor& aVisitor);
|
||||
bool IsHTMLLink(nsIURI** aURI) const;
|
||||
|
||||
|
@ -65,8 +65,8 @@ class nsMathMLElement final : public nsMathMLElementBase,
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(
|
||||
mozilla::EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override;
|
||||
nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const override;
|
||||
virtual mozilla::EventStates IntrinsicState() const override;
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
||||
|
@ -42,7 +42,8 @@ class SVGAElement final : public SVGAElementBase, public Link {
|
||||
|
||||
// nsINode interface methods
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
// nsIContent
|
||||
|
Loading…
Reference in New Issue
Block a user