Bug 1743439 - Part 5: Mark callers in dom/events and dom/html as MOZ_CAN_RUN_SCRIPT_BOUNDARY r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D133364
This commit is contained in:
Kagami Sascha Rosylight 2021-12-09 19:56:09 +00:00
parent 459cd4e879
commit d4de9cf54d
4 changed files with 18 additions and 9 deletions

View File

@ -64,8 +64,10 @@ class DOMEventTargetHelper : public dom::EventTarget,
bool ComputeDefaultWantsUntrusted(ErrorResult& aRv) override;
using EventTarget::DispatchEvent;
bool DispatchEvent(dom::Event& aEvent, dom::CallerType aCallerType,
ErrorResult& aRv) override;
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool DispatchEvent(dom::Event& aEvent,
dom::CallerType aCallerType,
ErrorResult& aRv) override;
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;

View File

@ -166,20 +166,25 @@ class EventTarget : public nsISupports, public nsWrapperCache {
/**
* The most general DispatchEvent method. This is the one the bindings call.
*/
virtual bool DispatchEvent(Event& aEvent, CallerType aCallerType,
ErrorResult& aRv) = 0;
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual bool DispatchEvent(Event& aEvent,
CallerType aCallerType,
ErrorResult& aRv) = 0;
/**
* A version of DispatchEvent you can use if you really don't care whether it
* succeeds or not and whether default is prevented or not.
*/
void DispatchEvent(Event& aEvent);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void DispatchEvent(Event& aEvent);
/**
* A version of DispatchEvent you can use if you really don't care whether
* default is prevented or not.
*/
void DispatchEvent(Event& aEvent, ErrorResult& aRv);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY void DispatchEvent(Event& aEvent,
ErrorResult& aRv);
nsIGlobalObject* GetParentObject() const { return GetOwnerGlobal(); }

View File

@ -1036,8 +1036,9 @@ nsresult HTMLFormElement::ConstructEntryList(FormData* aFormData) {
FormDataEvent::Constructor(this, u"formdata"_ns, init);
event->SetTrusted(true);
EventDispatcher::DispatchDOMEvent(ToSupports(this), nullptr, event, nullptr,
nullptr);
// TODO: Bug 1506441
EventDispatcher::DispatchDOMEvent(MOZ_KnownLive(ToSupports(this)), nullptr,
event, nullptr, nullptr);
return NS_OK;
}

View File

@ -257,7 +257,8 @@ class HTMLFormElement final : public nsGenericHTMLElement,
*
* @param aFormData the form data object
*/
nsresult ConstructEntryList(FormData* aFormData);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult ConstructEntryList(FormData* aFormData);
/**
* Whether the submission of this form has been ever prevented because of