mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1829570 - part 3: Update an overload of AsyncEventDispatcher::RunDOMEventWhenSafe
to make it work with a caller which does not specify ChromeOnlyDispatch
r=smaug
The constructor of `AsyncEventDispatcher` used in `XULFrameElement` can be merged with the first constructor to make `aOnlyChromeDispatch` an optional argument. Therefore, we can make the overload which is added by the previous patch can be work with `XULFrameElement`. Differential Revision: https://phabricator.services.mozilla.com/D176489
This commit is contained in:
parent
e16a783838
commit
0e970f4c95
@ -113,11 +113,11 @@ void AsyncEventDispatcher::RunDOMEventWhenSafe() {
|
||||
|
||||
// static
|
||||
void AsyncEventDispatcher::RunDOMEventWhenSafe(
|
||||
nsINode& aTarget, const nsAString& aEventType, CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch,
|
||||
EventTarget& aTarget, const nsAString& aEventType, CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch /* = ChromeOnlyDispatch::eNo */,
|
||||
Composed aComposed /* = Composed::eDefault */) {
|
||||
if (nsContentUtils::IsSafeToRunScript()) {
|
||||
OwningNonNull<nsINode> target = aTarget;
|
||||
OwningNonNull<EventTarget> target = aTarget;
|
||||
DispatchEventOnTarget(target, aEventType, aCanBubble, aOnlyChromeDispatch,
|
||||
aComposed);
|
||||
return;
|
||||
|
@ -35,10 +35,11 @@ class AsyncEventDispatcher : public CancelableRunnable {
|
||||
* the event is dispatched to it, otherwise the dispatch path starts
|
||||
* at the first chrome ancestor of that target.
|
||||
*/
|
||||
AsyncEventDispatcher(nsINode* aTarget, const nsAString& aEventType,
|
||||
CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch,
|
||||
Composed aComposed = Composed::eDefault)
|
||||
AsyncEventDispatcher(
|
||||
dom::EventTarget* aTarget, const nsAString& aEventType,
|
||||
CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch = ChromeOnlyDispatch::eNo,
|
||||
Composed aComposed = Composed::eDefault)
|
||||
: CancelableRunnable("AsyncEventDispatcher"),
|
||||
mTarget(aTarget),
|
||||
mEventType(aEventType),
|
||||
@ -65,14 +66,6 @@ class AsyncEventDispatcher : public CancelableRunnable {
|
||||
MOZ_ASSERT(mEventMessage != eUnidentifiedEvent);
|
||||
}
|
||||
|
||||
AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType,
|
||||
CanBubble aCanBubble)
|
||||
: CancelableRunnable("AsyncEventDispatcher"),
|
||||
mTarget(aTarget),
|
||||
mEventType(aEventType),
|
||||
mEventMessage(eUnidentifiedEvent),
|
||||
mCanBubble(aCanBubble) {}
|
||||
|
||||
AsyncEventDispatcher(dom::EventTarget* aTarget,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
CanBubble aCanBubble)
|
||||
@ -119,8 +112,9 @@ class AsyncEventDispatcher : public CancelableRunnable {
|
||||
* asynchronous dispatching).
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY static void RunDOMEventWhenSafe(
|
||||
nsINode& aTarget, const nsAString& aEventType, CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch,
|
||||
dom::EventTarget& aTarget, const nsAString& aEventType,
|
||||
CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch = ChromeOnlyDispatch::eNo,
|
||||
Composed aComposed = Composed::eDefault);
|
||||
|
||||
/**
|
||||
|
@ -106,9 +106,8 @@ void XULFrameElement::LoadSrc() {
|
||||
return;
|
||||
}
|
||||
|
||||
(new AsyncEventDispatcher(this, u"XULFrameLoaderCreated"_ns,
|
||||
CanBubble::eYes))
|
||||
->RunDOMEventWhenSafe();
|
||||
AsyncEventDispatcher::RunDOMEventWhenSafe(
|
||||
*this, u"XULFrameLoaderCreated"_ns, CanBubble::eYes);
|
||||
}
|
||||
|
||||
mFrameLoader->LoadFrame(false);
|
||||
|
@ -53,15 +53,13 @@ class XULFrameElement final : public nsXULElement, public nsFrameLoaderOwner {
|
||||
mozilla::ErrorResult& rv);
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent) override;
|
||||
virtual void DestroyContent() override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent) override;
|
||||
void DestroyContent() override;
|
||||
|
||||
virtual void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
NS_IMPL_FROMNODE_HELPER(XULFrameElement,
|
||||
IsAnyOfXULElements(nsGkAtoms::iframe,
|
||||
|
Loading…
Reference in New Issue
Block a user