mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
Bug 1470930: Use enums for passing arguments for event dispatch. r=smaug
MozReview-Commit-ID: DsNuF7GAflJ
This commit is contained in:
parent
a36447ed0d
commit
c7d35aa526
@ -1518,8 +1518,9 @@ EventSourceImpl::DispatchAllMessageEvents()
|
||||
RefPtr<MessageEvent> event = new MessageEvent(mEventSource, nullptr,
|
||||
nullptr);
|
||||
|
||||
event->InitMessageEvent(nullptr, message->mEventName, false, false, jsData,
|
||||
mOrigin, message->mLastEventID, nullptr,
|
||||
event->InitMessageEvent(nullptr, message->mEventName, CanBubble::eNo,
|
||||
Cancelable::eNo, jsData, mOrigin,
|
||||
message->mLastEventID, nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
event->SetTrusted(true);
|
||||
|
||||
|
@ -160,7 +160,7 @@ PostMessageEvent::Run()
|
||||
}
|
||||
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
|
||||
false /*non-bubbling */, false /*cancelable */,
|
||||
CanBubble::eNo, Cancelable::eNo,
|
||||
messageData, mCallerOrigin,
|
||||
EmptyString(), source, ports);
|
||||
|
||||
|
@ -1038,7 +1038,8 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex, bool aNoStartSelect)
|
||||
if (dispatchEvent) {
|
||||
nsContentUtils::DispatchTrustedEvent(GetParentObject(), target,
|
||||
NS_LITERAL_STRING("selectstart"),
|
||||
true, true, &defaultAction);
|
||||
CanBubble::eYes, Cancelable::eYes,
|
||||
&defaultAction);
|
||||
|
||||
if (!defaultAction) {
|
||||
return NS_OK;
|
||||
|
@ -156,7 +156,7 @@ SelectionChangeListener::NotifySelectionChanged(nsIDocument* aDoc,
|
||||
|
||||
if (target) {
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(target, eSelectionChange, false);
|
||||
new AsyncEventDispatcher(target, eSelectionChange, CanBubble::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ SelectionChangeListener::NotifySelectionChanged(nsIDocument* aDoc,
|
||||
|
||||
if (aDoc) {
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(aDoc, eSelectionChange, false);
|
||||
new AsyncEventDispatcher(aDoc, eSelectionChange, CanBubble::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
@ -1663,7 +1663,7 @@ nsContentSink::NotifyDocElementCreated(nsIDocument* aDoc)
|
||||
|
||||
nsContentUtils::DispatchChromeEvent(aDoc, aDoc,
|
||||
NS_LITERAL_STRING("DOMDocElementInserted"),
|
||||
true, false);
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -4423,8 +4423,10 @@ nsContentUtils::GetEventMessageAndAtomForListener(const nsAString& aName,
|
||||
static
|
||||
nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
bool aTrusted, Event** aEvent,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
Trusted aTrusted,
|
||||
Event** aEvent,
|
||||
EventTarget** aTargetOut)
|
||||
{
|
||||
nsCOMPtr<EventTarget> target(do_QueryInterface(aTarget));
|
||||
@ -4438,7 +4440,7 @@ nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
}
|
||||
|
||||
event->InitEvent(aEventName, aCanBubble, aCancelable);
|
||||
event->SetTrusted(aTrusted);
|
||||
event->SetTrusted(aTrusted == Trusted::eYes);
|
||||
|
||||
event->SetTarget(target);
|
||||
|
||||
@ -4451,31 +4453,35 @@ nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
nsresult
|
||||
nsContentUtils::DispatchTrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction)
|
||||
{
|
||||
return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
|
||||
true, aDefaultAction);
|
||||
Trusted::eYes, aDefaultAction);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsContentUtils::DispatchUntrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction)
|
||||
{
|
||||
return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
|
||||
false, aDefaultAction);
|
||||
Trusted::eNo, aDefaultAction);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
bool aTrusted, bool* aDefaultAction,
|
||||
bool aOnlyChromeDispatch)
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
Trusted aTrusted,
|
||||
bool* aDefaultAction,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch)
|
||||
{
|
||||
RefPtr<Event> event;
|
||||
nsCOMPtr<EventTarget> target;
|
||||
@ -4483,7 +4489,8 @@ nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
aCancelable, aTrusted, getter_AddRefs(event),
|
||||
getter_AddRefs(target));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = aOnlyChromeDispatch;
|
||||
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch =
|
||||
aOnlyChromeDispatch == ChromeOnlyDispatch::eYes;
|
||||
|
||||
ErrorResult err;
|
||||
bool doDefault = target->DispatchEvent(*event, CallerType::System, err);
|
||||
@ -4498,11 +4505,14 @@ nsresult
|
||||
nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
WidgetEvent& aEvent,
|
||||
EventMessage aEventMessage,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
bool aTrusted, bool *aDefaultAction,
|
||||
bool aOnlyChromeDispatch)
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
Trusted aTrusted,
|
||||
bool* aDefaultAction,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch)
|
||||
{
|
||||
MOZ_ASSERT_IF(aOnlyChromeDispatch, aTrusted);
|
||||
MOZ_ASSERT_IF(aOnlyChromeDispatch == ChromeOnlyDispatch::eYes,
|
||||
aTrusted == Trusted::eYes);
|
||||
|
||||
nsCOMPtr<EventTarget> target(do_QueryInterface(aTarget));
|
||||
|
||||
@ -4512,9 +4522,10 @@ nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
aEvent.SetDefaultComposed();
|
||||
aEvent.SetDefaultComposedInNativeAnonymousContent();
|
||||
|
||||
aEvent.mFlags.mBubbles = aCanBubble;
|
||||
aEvent.mFlags.mCancelable = aCancelable;
|
||||
aEvent.mFlags.mOnlyChromeDispatch = aOnlyChromeDispatch;
|
||||
aEvent.mFlags.mBubbles = aCanBubble == CanBubble::eYes;
|
||||
aEvent.mFlags.mCancelable = aCancelable == Cancelable::eYes;
|
||||
aEvent.mFlags.mOnlyChromeDispatch =
|
||||
aOnlyChromeDispatch == ChromeOnlyDispatch::eYes;
|
||||
|
||||
aEvent.mTarget = target;
|
||||
|
||||
@ -4531,14 +4542,16 @@ nsresult
|
||||
nsContentUtils::DispatchChromeEvent(nsIDocument *aDoc,
|
||||
nsISupports *aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction)
|
||||
{
|
||||
|
||||
RefPtr<Event> event;
|
||||
nsCOMPtr<EventTarget> target;
|
||||
nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
|
||||
aCancelable, true, getter_AddRefs(event),
|
||||
aCancelable, Trusted::eYes,
|
||||
getter_AddRefs(event),
|
||||
getter_AddRefs(target));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -4572,18 +4585,19 @@ nsContentUtils::DispatchFocusChromeEvent(nsPIDOMWindowOuter* aWindow)
|
||||
|
||||
return DispatchChromeEvent(doc, aWindow,
|
||||
NS_LITERAL_STRING("DOMWindowFocus"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentUtils::DispatchEventOnlyToChrome(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction)
|
||||
{
|
||||
return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
|
||||
true, aDefaultAction, true);
|
||||
Trusted::eYes, aDefaultAction, ChromeOnlyDispatch::eYes);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -200,7 +200,12 @@ class nsContentUtils
|
||||
{
|
||||
friend class nsAutoScriptBlockerSuppressNodeRemoved;
|
||||
typedef mozilla::dom::Element Element;
|
||||
typedef mozilla::Cancelable Cancelable;
|
||||
typedef mozilla::CanBubble CanBubble;
|
||||
typedef mozilla::ChromeOnlyDispatch ChromeOnlyDispatch;
|
||||
typedef mozilla::EventMessage EventMessage;
|
||||
typedef mozilla::TimeDuration TimeDuration;
|
||||
typedef mozilla::Trusted Trusted;
|
||||
|
||||
public:
|
||||
static nsresult Init();
|
||||
@ -1349,9 +1354,9 @@ public:
|
||||
static nsresult DispatchTrustedEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr);
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
bool* aDefaultAction = nullptr);
|
||||
|
||||
/**
|
||||
* This method creates and dispatches a trusted event using an event message.
|
||||
@ -1365,18 +1370,19 @@ public:
|
||||
* see EventTarget::DispatchEvent.
|
||||
*/
|
||||
template <class WidgetEventType>
|
||||
static nsresult DispatchTrustedEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr,
|
||||
bool aOnlyChromeDispatch = false)
|
||||
static nsresult DispatchTrustedEvent(
|
||||
nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
EventMessage aEventMessage,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch = ChromeOnlyDispatch::eNo)
|
||||
{
|
||||
WidgetEventType event(true, aEventMessage);
|
||||
MOZ_ASSERT(GetEventClassIDFromMessage(aEventMessage) == event.mClass);
|
||||
return DispatchEvent(aDoc, aTarget, event, aEventMessage,
|
||||
aCanBubble, aCancelable, true,
|
||||
aCanBubble, aCancelable, Trusted::eYes,
|
||||
aDefaultAction, aOnlyChromeDispatch);
|
||||
}
|
||||
|
||||
@ -1396,9 +1402,9 @@ public:
|
||||
static nsresult DispatchUntrustedEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr);
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
bool* aDefaultAction = nullptr);
|
||||
|
||||
|
||||
/**
|
||||
@ -1413,18 +1419,19 @@ public:
|
||||
* see EventTarget::DispatchEvent.
|
||||
*/
|
||||
template <class WidgetEventType>
|
||||
static nsresult DispatchUntrustedEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr,
|
||||
bool aOnlyChromeDispatch = false)
|
||||
static nsresult DispatchUntrustedEvent(
|
||||
nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
EventMessage aEventMessage,
|
||||
CanBubble aCanBubble,
|
||||
Cancelable aCancelable,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch = ChromeOnlyDispatch::eNo)
|
||||
{
|
||||
WidgetEventType event(false, aEventMessage);
|
||||
MOZ_ASSERT(GetEventClassIDFromMessage(aEventMessage) == event.mClass);
|
||||
return DispatchEvent(aDoc, aTarget, event, aEventMessage,
|
||||
aCanBubble, aCancelable, false,
|
||||
aCanBubble, aCancelable, Trusted::eNo,
|
||||
aDefaultAction, aOnlyChromeDispatch);
|
||||
}
|
||||
|
||||
@ -1449,9 +1456,9 @@ public:
|
||||
static nsresult DispatchChromeEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr);
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
bool* aDefaultAction = nullptr);
|
||||
|
||||
/**
|
||||
* Helper function for dispatching a "DOMWindowFocus" event to
|
||||
@ -1482,9 +1489,9 @@ public:
|
||||
static nsresult DispatchEventOnlyToChrome(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr);
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
bool* aDefaultAction = nullptr);
|
||||
|
||||
/**
|
||||
* Determines if an event attribute name (such as onclick) is valid for
|
||||
@ -1503,13 +1510,13 @@ public:
|
||||
*
|
||||
* @param aName the event name to look up
|
||||
*/
|
||||
static mozilla::EventMessage GetEventMessage(nsAtom* aName);
|
||||
static EventMessage GetEventMessage(nsAtom* aName);
|
||||
|
||||
/**
|
||||
* Returns the EventMessage and nsAtom to be used for event listener
|
||||
* registration.
|
||||
*/
|
||||
static mozilla::EventMessage
|
||||
static EventMessage
|
||||
GetEventMessageAndAtomForListener(const nsAString& aName, nsAtom** aOnName);
|
||||
|
||||
/**
|
||||
@ -1531,8 +1538,8 @@ public:
|
||||
* @param aEventClassID only return event id for aEventClassID
|
||||
*/
|
||||
static nsAtom* GetEventMessageAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
mozilla::EventMessage* aEventMessage);
|
||||
mozilla::EventClassID aEventClassID,
|
||||
EventMessage* aEventMessage);
|
||||
|
||||
/**
|
||||
* Used only during traversal of the XPCOM graph by the cycle
|
||||
@ -3278,21 +3285,21 @@ private:
|
||||
static nsresult DispatchEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool aTrusted,
|
||||
bool *aDefaultAction = nullptr,
|
||||
bool aOnlyChromeDispatch = false);
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
Trusted,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
|
||||
static nsresult DispatchEvent(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
mozilla::WidgetEvent& aWidgetEvent,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool aTrusted,
|
||||
bool *aDefaultAction = nullptr,
|
||||
bool aOnlyChromeDispatch = false);
|
||||
EventMessage aEventMessage,
|
||||
CanBubble,
|
||||
Cancelable,
|
||||
Trusted,
|
||||
bool* aDefaultAction = nullptr,
|
||||
ChromeOnlyDispatch = ChromeOnlyDispatch::eNo);
|
||||
|
||||
static void InitializeModifierStrings();
|
||||
|
||||
@ -3306,7 +3313,7 @@ private:
|
||||
const nsString* aClasses);
|
||||
|
||||
static mozilla::EventClassID
|
||||
GetEventClassIDFromMessage(mozilla::EventMessage aEventMessage);
|
||||
GetEventClassIDFromMessage(EventMessage aEventMessage);
|
||||
|
||||
// Fills in aInfo with the tokens from the supplied autocomplete attribute.
|
||||
static AutocompleteAttrState InternalSerializeAutocompleteAttribute(const nsAttrValue* aAttrVal,
|
||||
|
@ -340,9 +340,9 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
|
||||
|
||||
RefPtr<MessageEvent> event = new MessageEvent(this, nullptr, nullptr);
|
||||
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), false, false,
|
||||
jsData, mOrigin, EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), CanBubble::eNo,
|
||||
Cancelable::eNo, jsData, mOrigin, EmptyString(),
|
||||
nullptr, Sequence<OwningNonNull<MessagePort>>());
|
||||
event->SetTrusted(true);
|
||||
|
||||
LOG(("%p(%p): %s - Dispatching\n",this,(void*)mDataChannel,__FUNCTION__));
|
||||
@ -382,7 +382,7 @@ nsDOMDataChannel::OnSimpleEvent(nsISupports* aContext, const nsAString& aName)
|
||||
|
||||
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
|
||||
|
||||
event->InitEvent(aName, false, false);
|
||||
event->InitEvent(aName, CanBubble::eNo, Cancelable::eNo);
|
||||
event->SetTrusted(true);
|
||||
|
||||
ErrorResult err;
|
||||
|
@ -4137,13 +4137,13 @@ nsIDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
|
||||
init.mStylesheet = aSheet; \
|
||||
init.memberName = argName; \
|
||||
\
|
||||
RefPtr<className> event = \
|
||||
RefPtr<className> event = \
|
||||
className::Constructor(this, NS_LITERAL_STRING(type), init); \
|
||||
event->SetTrusted(true); \
|
||||
event->SetTarget(this); \
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher = \
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher = \
|
||||
new AsyncEventDispatcher(this, event); \
|
||||
asyncDispatcher->mOnlyChromeDispatch = true; \
|
||||
asyncDispatcher->mOnlyChromeDispatch = ChromeOnlyDispatch::eYes; \
|
||||
asyncDispatcher->PostDOMEvent(); \
|
||||
} while (0);
|
||||
|
||||
@ -4967,7 +4967,7 @@ nsIDocument::DispatchContentLoadedEvents()
|
||||
// document).
|
||||
nsContentUtils::DispatchTrustedEvent(this, this,
|
||||
NS_LITERAL_STRING("DOMContentLoaded"),
|
||||
true, false);
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
|
||||
if (MayStartLayout()) {
|
||||
MaybeResolveReadyForIdle();
|
||||
@ -5046,7 +5046,7 @@ nsIDocument::DispatchContentLoadedEvents()
|
||||
if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::manifest)) {
|
||||
nsContentUtils::DispatchChromeEvent(this, this,
|
||||
NS_LITERAL_STRING("MozApplicationManifest"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
nsPIDOMWindowInner* inner = GetInnerWindow();
|
||||
@ -6296,7 +6296,7 @@ nsIDocument::DoNotifyPossibleTitleChange()
|
||||
// Fire a DOM event for the title change.
|
||||
nsContentUtils::DispatchChromeEvent(this, static_cast<nsIDocument*>(this),
|
||||
NS_LITERAL_STRING("DOMTitleChanged"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
already_AddRefed<BoxObject>
|
||||
@ -8184,8 +8184,8 @@ nsDocument::UnblockOnload(bool aFireSync)
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"),
|
||||
false,
|
||||
false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
@ -8726,8 +8726,10 @@ nsIDocument::SetReadyStateInternal(ReadyState rs)
|
||||
RecordNavigationTiming(rs);
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("readystatechange"),
|
||||
false, false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("readystatechange"),
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
|
||||
@ -10282,8 +10284,7 @@ AskWindowToExitFullscreen(nsIDocument* aDoc)
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
aDoc, ToSupports(aDoc), NS_LITERAL_STRING("MozDOMFullscreen:Exit"),
|
||||
/* Bubbles */ true, /* Cancelable */ false,
|
||||
/* DefaultAction */ nullptr);
|
||||
CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr);
|
||||
} else {
|
||||
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
|
||||
win->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, false);
|
||||
@ -10392,7 +10393,7 @@ public:
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
lastDocument, ToSupports(lastDocument),
|
||||
NS_LITERAL_STRING("MozDOMFullscreen:Exited"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr);
|
||||
// Ensure the window exits fullscreen.
|
||||
if (nsPIDOMWindowOuter* win = mDocuments[0]->GetWindow()) {
|
||||
win->SetFullscreenInternal(FullscreenReason::ForForceExitFullscreen, false);
|
||||
@ -10609,8 +10610,8 @@ nsIDocument::DispatchFullscreenError(const char* aMessage)
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("fullscreenerror"),
|
||||
true,
|
||||
false);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), this,
|
||||
@ -11082,7 +11083,7 @@ nsIDocument::RequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
// our parent process go fullscreen first.
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
this, ToSupports(this), NS_LITERAL_STRING("MozDOMFullscreen:Request"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr);
|
||||
} else {
|
||||
// Make the window fullscreen.
|
||||
rootWin->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, true);
|
||||
@ -11190,7 +11191,7 @@ nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
||||
if (!previousFullscreenDoc) {
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
this, ToSupports(elem), NS_LITERAL_STRING("MozDOMFullscreen:Entered"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr);
|
||||
}
|
||||
|
||||
// The origin which is fullscreen gets changed. Trigger an event so
|
||||
@ -11238,8 +11239,8 @@ DispatchPointerLockChange(nsIDocument* aTarget)
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(aTarget,
|
||||
NS_LITERAL_STRING("pointerlockchange"),
|
||||
true,
|
||||
false);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
@ -11253,8 +11254,8 @@ DispatchPointerLockError(nsIDocument* aTarget, const char* aMessage)
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(aTarget,
|
||||
NS_LITERAL_STRING("pointerlockerror"),
|
||||
true,
|
||||
false);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), aTarget,
|
||||
@ -11410,7 +11411,7 @@ PointerLockRequest::Run()
|
||||
ChangePointerLockedElement(e, d, nullptr);
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
doc, ToSupports(e), NS_LITERAL_STRING("MozDOMPointerLock:Entered"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
CanBubble::eYes, Cancelable::eNo, /* DefaultAction */ nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -11516,7 +11517,8 @@ nsIDocument::UnlockPointer(nsIDocument* aDoc)
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(pointerLockedElement,
|
||||
NS_LITERAL_STRING("MozDOMPointerLock:Exited"),
|
||||
true, true);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
|
||||
@ -11528,8 +11530,8 @@ nsIDocument::UpdateVisibilityState()
|
||||
if (oldState != mVisibilityState) {
|
||||
nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
|
||||
NS_LITERAL_STRING("visibilitychange"),
|
||||
/* bubbles = */ true,
|
||||
/* cancelable = */ false);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
|
||||
}
|
||||
|
||||
|
@ -1189,7 +1189,9 @@ nsFocusManager::ActivateOrDeactivate(nsPIDOMWindowOuter* aWindow, bool aActive)
|
||||
aActive ?
|
||||
NS_LITERAL_STRING("activate") :
|
||||
NS_LITERAL_STRING("deactivate"),
|
||||
true, true, nullptr);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
// Look for any remote child frames, iterate over them and send the activation notification.
|
||||
|
@ -301,10 +301,11 @@ nsFrameLoader::FireErrorEvent()
|
||||
if (!mOwnerContent) {
|
||||
return;
|
||||
}
|
||||
RefPtr<AsyncEventDispatcher > loadBlockingAsyncDispatcher =
|
||||
RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||
new LoadBlockingAsyncEventDispatcher(mOwnerContent,
|
||||
NS_LITERAL_STRING("error"),
|
||||
false, false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -5220,8 +5220,8 @@ nsGlobalWindowInner::FireOfflineStatusEventIfChanged()
|
||||
nsContentUtils::DispatchTrustedEvent(mDoc,
|
||||
static_cast<EventTarget*>(this),
|
||||
name,
|
||||
false,
|
||||
false);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
class NotifyIdleObserverRunnable : public Runnable
|
||||
|
@ -2069,8 +2069,8 @@ nsGlobalWindowOuter::DispatchDOMWindowCreated()
|
||||
|
||||
// Fire DOMWindowCreated at chrome event listeners
|
||||
nsContentUtils::DispatchChromeEvent(mDoc, mDoc, NS_LITERAL_STRING("DOMWindowCreated"),
|
||||
true /* bubbles */,
|
||||
false /* not cancellable */);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
@ -3772,7 +3772,8 @@ nsGlobalWindowOuter::DispatchCustomEvent(const nsAString& aEventName)
|
||||
{
|
||||
bool defaultActionEnabled = true;
|
||||
nsContentUtils::DispatchTrustedEvent(mDoc, ToSupports(this), aEventName,
|
||||
true, true, &defaultActionEnabled);
|
||||
CanBubble::eYes, Cancelable::eYes,
|
||||
&defaultActionEnabled);
|
||||
|
||||
return defaultActionEnabled;
|
||||
}
|
||||
|
@ -1256,7 +1256,10 @@ nsImageLoadingContent::FireEvent(const nsAString& aEventType, bool aIsCancelable
|
||||
nsCOMPtr<nsINode> thisNode = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
|
||||
RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||
new LoadBlockingAsyncEventDispatcher(thisNode, aEventType, false, false);
|
||||
new LoadBlockingAsyncEventDispatcher(thisNode,
|
||||
aEventType,
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
|
||||
if (aIsCancelable) {
|
||||
|
@ -307,7 +307,8 @@ nsSimplePluginEvent::Run()
|
||||
LOG(("OBJLC [%p]: nsSimplePluginEvent firing event \"%s\"", mTarget.get(),
|
||||
NS_ConvertUTF16toUTF8(mEvent).get()));
|
||||
nsContentUtils::DispatchTrustedEvent(mDocument, mTarget,
|
||||
mEvent, true, true);
|
||||
mEvent, CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3784,7 +3785,8 @@ nsObjectLoadingContent::MaybeFireErrorEvent()
|
||||
RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||
new LoadBlockingAsyncEventDispatcher(thisContent,
|
||||
NS_LITERAL_STRING("error"),
|
||||
false, false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
@ -1778,8 +1778,8 @@ WebGLContext::UpdateContextLossStatus()
|
||||
// The context has been lost and we haven't yet triggered the
|
||||
// callback, so do that now.
|
||||
const auto kEventName = NS_LITERAL_STRING("webglcontextlost");
|
||||
const bool kCanBubble = true;
|
||||
const bool kIsCancelable = true;
|
||||
const auto kCanBubble = CanBubble::eYes;
|
||||
const auto kIsCancelable = Cancelable::eYes;
|
||||
bool useDefaultHandler;
|
||||
|
||||
if (mCanvasElement) {
|
||||
@ -1857,11 +1857,13 @@ WebGLContext::UpdateContextLossStatus()
|
||||
mCanvasElement->OwnerDoc(),
|
||||
static_cast<nsIContent*>(mCanvasElement),
|
||||
NS_LITERAL_STRING("webglcontextrestored"),
|
||||
true,
|
||||
true);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
} else {
|
||||
RefPtr<Event> event = new Event(mOffscreenCanvas, nullptr, nullptr);
|
||||
event->InitEvent(NS_LITERAL_STRING("webglcontextrestored"), true, true);
|
||||
event->InitEvent(NS_LITERAL_STRING("webglcontextrestored"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
event->SetTrusted(true);
|
||||
mOffscreenCanvas->DispatchEvent(*event);
|
||||
}
|
||||
|
@ -51,17 +51,16 @@ AsyncEventDispatcher::Run()
|
||||
mTarget->AsyncEventRunning(this);
|
||||
if (mEventMessage != eUnidentifiedEvent) {
|
||||
return nsContentUtils::DispatchTrustedEvent<WidgetEvent>
|
||||
(node->OwnerDoc(), mTarget, mEventMessage, mBubbles,
|
||||
false /* aCancelable */, nullptr /* aDefaultAction */,
|
||||
mOnlyChromeDispatch);
|
||||
(node->OwnerDoc(), mTarget, mEventMessage, mCanBubble,
|
||||
Cancelable::eNo, nullptr /* aDefaultAction */, mOnlyChromeDispatch);
|
||||
}
|
||||
RefPtr<Event> event = mEvent;
|
||||
if (!event) {
|
||||
event = NS_NewDOMEvent(mTarget, nullptr, nullptr);
|
||||
event->InitEvent(mEventType, mBubbles, false);
|
||||
event->InitEvent(mEventType, mCanBubble, Cancelable::eNo);
|
||||
event->SetTrusted(true);
|
||||
}
|
||||
if (mOnlyChromeDispatch) {
|
||||
if (mOnlyChromeDispatch == ChromeOnlyDispatch::eYes) {
|
||||
MOZ_ASSERT(event->IsTrusted());
|
||||
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_AsyncEventDispatcher_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -37,13 +38,13 @@ public:
|
||||
*/
|
||||
AsyncEventDispatcher(nsINode* aTarget,
|
||||
const nsAString& aEventType,
|
||||
bool aBubbles,
|
||||
bool aOnlyChromeDispatch)
|
||||
CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch)
|
||||
: CancelableRunnable("AsyncEventDispatcher")
|
||||
, mTarget(aTarget)
|
||||
, mEventType(aEventType)
|
||||
, mEventMessage(eUnidentifiedEvent)
|
||||
, mBubbles(aBubbles)
|
||||
, mCanBubble(aCanBubble)
|
||||
, mOnlyChromeDispatch(aOnlyChromeDispatch)
|
||||
{
|
||||
}
|
||||
@ -56,34 +57,36 @@ public:
|
||||
*/
|
||||
AsyncEventDispatcher(nsINode* aTarget,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
bool aBubbles, bool aOnlyChromeDispatch)
|
||||
CanBubble aCanBubble,
|
||||
ChromeOnlyDispatch aOnlyChromeDispatch)
|
||||
: CancelableRunnable("AsyncEventDispatcher")
|
||||
, mTarget(aTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mBubbles(aBubbles)
|
||||
, mCanBubble(aCanBubble)
|
||||
, mOnlyChromeDispatch(aOnlyChromeDispatch)
|
||||
{
|
||||
mEventType.SetIsVoid(true);
|
||||
MOZ_ASSERT(mEventMessage != eUnidentifiedEvent);
|
||||
}
|
||||
|
||||
AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType,
|
||||
bool aBubbles)
|
||||
AsyncEventDispatcher(dom::EventTarget* aTarget,
|
||||
const nsAString& aEventType,
|
||||
CanBubble aCanBubble)
|
||||
: CancelableRunnable("AsyncEventDispatcher")
|
||||
, mTarget(aTarget)
|
||||
, mEventType(aEventType)
|
||||
, mEventMessage(eUnidentifiedEvent)
|
||||
, mBubbles(aBubbles)
|
||||
, mCanBubble(aCanBubble)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncEventDispatcher(dom::EventTarget* aTarget,
|
||||
mozilla::EventMessage aEventMessage,
|
||||
bool aBubbles)
|
||||
CanBubble aCanBubble)
|
||||
: CancelableRunnable("AsyncEventDispatcher")
|
||||
, mTarget(aTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mBubbles(aBubbles)
|
||||
, mCanBubble(aCanBubble)
|
||||
{
|
||||
mEventType.SetIsVoid(true);
|
||||
MOZ_ASSERT(mEventMessage != eUnidentifiedEvent);
|
||||
@ -115,9 +118,9 @@ public:
|
||||
// If mEventMessage is set, mEventType will be void.
|
||||
// They can never both be set at the same time.
|
||||
nsString mEventType;
|
||||
mozilla::EventMessage mEventMessage;
|
||||
bool mBubbles = false;
|
||||
bool mOnlyChromeDispatch = false;
|
||||
EventMessage mEventMessage;
|
||||
CanBubble mCanBubble = CanBubble::eNo;
|
||||
ChromeOnlyDispatch mOnlyChromeDispatch = ChromeOnlyDispatch::eNo;
|
||||
bool mCanceled = false;
|
||||
bool mCheckStillInDoc = false;
|
||||
};
|
||||
@ -127,9 +130,12 @@ class LoadBlockingAsyncEventDispatcher final : public AsyncEventDispatcher
|
||||
public:
|
||||
LoadBlockingAsyncEventDispatcher(nsINode* aEventNode,
|
||||
const nsAString& aEventType,
|
||||
bool aBubbles, bool aDispatchChromeOnly)
|
||||
: AsyncEventDispatcher(aEventNode, aEventType,
|
||||
aBubbles, aDispatchChromeOnly)
|
||||
CanBubble aBubbles,
|
||||
ChromeOnlyDispatch aDispatchChromeOnly)
|
||||
: AsyncEventDispatcher(aEventNode,
|
||||
aEventType,
|
||||
aBubbles,
|
||||
aDispatchChromeOnly)
|
||||
, mBlockedDoc(aEventNode->OwnerDoc())
|
||||
{
|
||||
if (mBlockedDoc) {
|
||||
|
@ -493,8 +493,8 @@ Event::EnsureWebAccessibleRelatedTarget(EventTarget* aRelatedTarget)
|
||||
|
||||
void
|
||||
Event::InitEvent(const nsAString& aEventTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg)
|
||||
mozilla::CanBubble aCanBubbleArg,
|
||||
mozilla::Cancelable aCancelableArg)
|
||||
{
|
||||
// Make sure this event isn't already being dispatched.
|
||||
NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
|
||||
@ -508,8 +508,8 @@ Event::InitEvent(const nsAString& aEventTypeArg,
|
||||
|
||||
SetEventType(aEventTypeArg);
|
||||
|
||||
mEvent->mFlags.mBubbles = aCanBubbleArg;
|
||||
mEvent->mFlags.mCancelable = aCancelableArg;
|
||||
mEvent->mFlags.mBubbles = aCanBubbleArg == CanBubble::eYes;
|
||||
mEvent->mFlags.mCancelable = aCancelableArg == Cancelable::eYes;
|
||||
|
||||
mEvent->mFlags.mDefaultPrevented = false;
|
||||
mEvent->mFlags.mDefaultPreventedByContent = false;
|
||||
|
@ -148,8 +148,18 @@ public:
|
||||
}
|
||||
|
||||
void InitEvent(const nsAString& aEventTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg);
|
||||
bool aCanBubble,
|
||||
bool aCancelable)
|
||||
{
|
||||
InitEvent(aEventTypeArg,
|
||||
aCanBubble ? CanBubble::eYes : CanBubble::eNo,
|
||||
aCancelable ? Cancelable::eYes : Cancelable::eNo);
|
||||
}
|
||||
|
||||
void InitEvent(const nsAString& aEventTypeArg,
|
||||
mozilla::CanBubble,
|
||||
mozilla::Cancelable);
|
||||
|
||||
void SetTarget(EventTarget* aTarget);
|
||||
virtual void DuplicatePrivateData();
|
||||
bool IsDispatchStopped();
|
||||
|
@ -2291,7 +2291,7 @@ EventStateManager::DoScrollZoom(nsIFrame* aTargetFrame,
|
||||
}
|
||||
nsContentUtils::DispatchChromeEvent(mDocument, static_cast<nsIDocument*>(mDocument),
|
||||
NS_LITERAL_STRING("ZoomChangeUsingMouseWheel"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,8 @@ MessageEvent::Constructor(EventTarget* aEventTarget,
|
||||
|
||||
void
|
||||
MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
mozilla::CanBubble aCanBubble,
|
||||
mozilla::Cancelable aCancelable,
|
||||
JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin,
|
||||
const nsAString& aLastEventId,
|
||||
|
@ -58,8 +58,24 @@ public:
|
||||
const nsAString& aType,
|
||||
const MessageEventInit& aEventInit);
|
||||
|
||||
void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
|
||||
bool aCancelable, JS::Handle<JS::Value> aData,
|
||||
void InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin, const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePortOrServiceWorker>& aSource,
|
||||
const Sequence<OwningNonNull<MessagePort>>& aPorts)
|
||||
{
|
||||
InitMessageEvent(aCx, aType,
|
||||
aCanBubble ? CanBubble::eYes : CanBubble::eNo,
|
||||
aCancelable ? Cancelable::eYes : Cancelable::eNo,
|
||||
aData,
|
||||
aOrigin, aLastEventId,
|
||||
aSource, aPorts);
|
||||
}
|
||||
|
||||
void InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
mozilla::CanBubble, mozilla::Cancelable,
|
||||
JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin, const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePortOrServiceWorker>& aSource,
|
||||
const Sequence<OwningNonNull<MessagePort>>& aPorts);
|
||||
|
@ -318,7 +318,7 @@ WheelTransaction::OnFailToScrollTarget()
|
||||
sTargetFrame->GetContent()->OwnerDoc(),
|
||||
sTargetFrame->GetContent(),
|
||||
NS_LITERAL_STRING("MozMouseScrollFailed"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
// The target frame might be destroyed in the event handler, at that time,
|
||||
// we need to finish the current transaction
|
||||
@ -347,7 +347,7 @@ WheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
|
||||
frame->GetContent()->OwnerDoc(),
|
||||
frame->GetContent(),
|
||||
NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,9 @@ HTMLDetailsElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
// According to the html spec, a 'toggle' event is a simple event which
|
||||
// does not bubble.
|
||||
mToggleEventDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("toggle"), false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("toggle"),
|
||||
CanBubble::eNo);
|
||||
mToggleEventDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ HTMLDialogElement::Close(const mozilla::dom::Optional<nsAString>& aReturnValue)
|
||||
SetOpen(false, ignored);
|
||||
ignored.SuppressException();
|
||||
RefPtr<AsyncEventDispatcher> eventDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("close"), false);
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("close"), CanBubble::eNo);
|
||||
eventDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -1141,8 +1141,10 @@ HTMLFormElement::PostPasswordEvent()
|
||||
}
|
||||
|
||||
mFormPasswordEventDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("DOMFormHasPassword"),
|
||||
true, true);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("DOMFormHasPassword"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
mFormPasswordEventDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
@ -1871,7 +1873,8 @@ HTMLFormElement::CheckFormValidity(nsIMutableArray* aInvalidElements) const
|
||||
nsContentUtils::DispatchTrustedEvent(sortedControls[i]->OwnerDoc(),
|
||||
static_cast<nsIContent*>(sortedControls[i]),
|
||||
NS_LITERAL_STRING("invalid"),
|
||||
false, true, &defaultAction);
|
||||
CanBubble::eNo, Cancelable::eYes,
|
||||
&defaultAction);
|
||||
|
||||
// Add all unhandled invalid controls to aInvalidElements if the caller
|
||||
// requested them.
|
||||
|
@ -257,14 +257,16 @@ public:
|
||||
nsresult rv = NS_OK;
|
||||
rv = nsContentUtils::DispatchTrustedEvent(mInputElement->OwnerDoc(),
|
||||
static_cast<Element*>(mInputElement.get()),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "DispatchTrustedEvent failed");
|
||||
|
||||
rv = nsContentUtils::DispatchTrustedEvent(mInputElement->OwnerDoc(),
|
||||
static_cast<Element*>(mInputElement.get()),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -636,8 +638,9 @@ nsColorPickerShownCallback::UpdateInternal(const nsAString& aColor,
|
||||
mValueChanged = true;
|
||||
return nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
|
||||
static_cast<Element*>(mInput.get()),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -670,8 +673,9 @@ nsColorPickerShownCallback::Done(const nsAString& aColor)
|
||||
if (mValueChanged) {
|
||||
rv = nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
|
||||
static_cast<Element*>(mInput.get()),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -2254,7 +2258,8 @@ HTMLInputElement::OpenDateTimePicker(const DateTimeValue& aInitialValue)
|
||||
nsContentUtils::DispatchChromeEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("MozOpenDateTimePicker"),
|
||||
true, true);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2268,7 +2273,8 @@ HTMLInputElement::UpdateDateTimePicker(const DateTimeValue& aValue)
|
||||
nsContentUtils::DispatchChromeEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("MozUpdateDateTimePicker"),
|
||||
true, true);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2281,7 +2287,7 @@ HTMLInputElement::CloseDateTimePicker()
|
||||
nsContentUtils::DispatchChromeEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("MozCloseDateTimePicker"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2365,10 +2371,13 @@ HTMLInputElement::SetUserInput(const nsAString& aValue,
|
||||
nsTextEditorState::eSetValue_MoveCursorToEndIfValueChanged);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
// FIXME: We're inconsistent about whether "input" events are cancelable or
|
||||
// not.
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
true);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
|
||||
// If this element is not currently focused, it won't receive a change event for this
|
||||
// update through the normal channels. So fire a change event immediately, instead.
|
||||
@ -2695,8 +2704,9 @@ HTMLInputElement::FireChangeEventIfNeeded()
|
||||
mFocusedValue = value;
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
FileList*
|
||||
@ -3753,7 +3763,10 @@ HTMLInputElement::CancelRangeThumbDrag(bool aIsForUserEvent)
|
||||
frame->UpdateForValueChange();
|
||||
}
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("input"), true, false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
}
|
||||
@ -3779,8 +3792,9 @@ HTMLInputElement::SetValueOfRangeForUserEvent(Decimal aValue)
|
||||
if (GetValueAsDecimal() != oldValue) {
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3877,8 +3891,9 @@ HTMLInputElement::StepNumberControlForUserEvent(int32_t aDirection)
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<Element*>(this),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -4089,11 +4104,11 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
// Fire input event and then change event.
|
||||
nsContentUtils::DispatchTrustedEvent<InternalEditorInputEvent>
|
||||
(OwnerDoc(), static_cast<Element*>(this),
|
||||
eEditorInput, true, false);
|
||||
eEditorInput, CanBubble::eYes, Cancelable::eNo);
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent<WidgetEvent>
|
||||
(OwnerDoc(), static_cast<Element*>(this),
|
||||
eFormChange, true, false);
|
||||
eFormChange, CanBubble::eYes, Cancelable::eNo);
|
||||
#ifdef ACCESSIBILITY
|
||||
// Fire an event to notify accessibility
|
||||
if (mType == NS_FORM_INPUT_CHECKBOX) {
|
||||
@ -4646,8 +4661,8 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
AsyncEventDispatcher* dispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("DOMInputPasswordAdded"),
|
||||
true,
|
||||
true);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
dispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
@ -4835,8 +4850,8 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
|
||||
AsyncEventDispatcher* dispatcher =
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("DOMInputPasswordAdded"),
|
||||
true,
|
||||
true);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
dispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
@ -6005,7 +6020,8 @@ FireEventForAccessibility(HTMLInputElement* aTarget,
|
||||
{
|
||||
Element* element = static_cast<Element*>(aTarget);
|
||||
return nsContentUtils::DispatchTrustedEvent<WidgetEvent>
|
||||
(element->OwnerDoc(), element, aEventMessage, true, true);
|
||||
(element->OwnerDoc(), element, aEventMessage,
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -244,7 +244,10 @@ HTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
||||
return;
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, aEventName, true, true);
|
||||
new AsyncEventDispatcher(this,
|
||||
aEventName,
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
// Always run async in order to avoid running script when the content
|
||||
// sink isn't expecting it.
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
|
@ -364,7 +364,8 @@ public:
|
||||
LOG_EVENT(LogLevel::Debug,
|
||||
("%p Dispatching simple event source error", mElement.get()));
|
||||
return nsContentUtils::DispatchTrustedEvent(
|
||||
mElement->OwnerDoc(), mSource, NS_LITERAL_STRING("error"), false, false);
|
||||
mElement->OwnerDoc(), mSource, NS_LITERAL_STRING("error"),
|
||||
CanBubble::eNo, Cancelable::eNo);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1434,8 +1435,7 @@ public:
|
||||
mOwner->OwnerDoc(),
|
||||
static_cast<nsIContent*>(mOwner),
|
||||
NS_LITERAL_STRING("OpenMediaWithExternalApp"),
|
||||
true,
|
||||
true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
RefPtr<MediaError> mError;
|
||||
@ -6308,7 +6308,9 @@ HTMLMediaElement::DispatchEvent(const nsAString& aName)
|
||||
}
|
||||
|
||||
return nsContentUtils::DispatchTrustedEvent(
|
||||
OwnerDoc(), static_cast<nsIContent*>(this), aName, false, false);
|
||||
OwnerDoc(), static_cast<nsIContent*>(this), aName,
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
void
|
||||
@ -6956,12 +6958,13 @@ HTMLMediaElement::IsAllowedToPlay()
|
||||
{
|
||||
if (!AutoplayPolicy::IsMediaElementAllowedToPlay(WrapNotNull(this))) {
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
// FIXME: This should be chrome-only.
|
||||
nsContentUtils::DispatchTrustedEvent(
|
||||
OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("MozAutoplayMediaBlocked"),
|
||||
false,
|
||||
false);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo);
|
||||
#endif
|
||||
LOG(LogLevel::Debug,
|
||||
("%p %s AutoplayPolicy blocked autoplay.", this, __func__));
|
||||
|
@ -156,7 +156,10 @@ HTMLMetaElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
||||
return;
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, aEventName, true, true);
|
||||
new AsyncEventDispatcher(this,
|
||||
aEventName,
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
|
||||
|
@ -238,8 +238,9 @@ HTMLSlotElement::FireSlotChangeEvent()
|
||||
{
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("slotchange"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("slotchange"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
@ -552,8 +552,9 @@ HTMLTextAreaElement::FireChangeEventIfNeeded()
|
||||
mFocusedValue = value;
|
||||
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -454,7 +454,7 @@ HTMLTrackElement::DispatchTrustedEvent(const nsAString& aName)
|
||||
return;
|
||||
}
|
||||
nsContentUtils::DispatchTrustedEvent(doc, static_cast<nsIContent*>(this),
|
||||
aName, false, false);
|
||||
aName, CanBubble::eNo, Cancelable::eNo);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -143,7 +143,7 @@ ImageListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt, nsresult
|
||||
ImageDocument* imgDoc = static_cast<ImageDocument*>(mDocument.get());
|
||||
nsContentUtils::DispatchChromeEvent(imgDoc, static_cast<nsIDocument*>(imgDoc),
|
||||
NS_LITERAL_STRING("ImageContentLoaded"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
return MediaDocumentStreamListener::OnStopRequest(aRequest, aCtxt, aStatus);
|
||||
}
|
||||
|
||||
|
@ -107,9 +107,11 @@ nsIConstraintValidation::CheckValidity()
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(this);
|
||||
NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), content,
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(),
|
||||
content,
|
||||
NS_LITERAL_STRING("invalid"),
|
||||
false, true);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eYes);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -136,7 +138,9 @@ nsIConstraintValidation::ReportValidity()
|
||||
bool defaultAction = true;
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), content,
|
||||
NS_LITERAL_STRING("invalid"),
|
||||
false, true, &defaultAction);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eYes,
|
||||
&defaultAction);
|
||||
if (!defaultAction) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1724,7 +1724,10 @@ nsTextEditorState::SetSelectionRange(uint32_t aStart, uint32_t aEnd,
|
||||
// It sure would be nice if we had an existing Element* or so to work with.
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(mTextCtrlElement);
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(node, NS_LITERAL_STRING("select"), true, false);
|
||||
new AsyncEventDispatcher(node,
|
||||
NS_LITERAL_STRING("select"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -470,11 +470,13 @@ TabParent::ActorDestroy(ActorDestroyReason why)
|
||||
if (channel && !channel->DoBuildIDsMatch()) {
|
||||
nsContentUtils::DispatchTrustedEvent(
|
||||
frameElement->OwnerDoc(), frameElement,
|
||||
NS_LITERAL_STRING("oop-browser-buildid-mismatch"), true, true);
|
||||
NS_LITERAL_STRING("oop-browser-buildid-mismatch"),
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
} else {
|
||||
nsContentUtils::DispatchTrustedEvent(
|
||||
frameElement->OwnerDoc(), frameElement,
|
||||
NS_LITERAL_STRING("oop-browser-crashed"), true, true);
|
||||
NS_LITERAL_STRING("oop-browser-crashed"),
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ BackgroundVideoDecodingPermissionObserver::EnableEvent() const
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(doc,
|
||||
NS_LITERAL_STRING("UnselectedTabHover:Enable"),
|
||||
/* Bubbles */ true,
|
||||
/* OnlyChromeDispatch */ true);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
@ -129,8 +129,8 @@ BackgroundVideoDecodingPermissionObserver::DisableEvent() const
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(doc,
|
||||
NS_LITERAL_STRING("UnselectedTabHover:Disable"),
|
||||
/* Bubbles */ true,
|
||||
/* OnlyChromeDispatch */ true);
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,9 @@ void
|
||||
MediaTrackList::CreateAndDispatchChangeEvent()
|
||||
{
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("change"), false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ already_AddRefed<MediaEncryptedEvent>
|
||||
MediaEncryptedEvent::Constructor(EventTarget* aOwner)
|
||||
{
|
||||
RefPtr<MediaEncryptedEvent> e = new MediaEncryptedEvent(aOwner);
|
||||
e->InitEvent(NS_LITERAL_STRING("encrypted"), false, false);
|
||||
e->InitEvent(NS_LITERAL_STRING("encrypted"), CanBubble::eNo, Cancelable::eNo);
|
||||
e->SetTrusted(true);
|
||||
return e.forget();
|
||||
}
|
||||
@ -67,7 +67,7 @@ MediaEncryptedEvent::Constructor(EventTarget* aOwner,
|
||||
const nsTArray<uint8_t>& aInitData)
|
||||
{
|
||||
RefPtr<MediaEncryptedEvent> e = new MediaEncryptedEvent(aOwner);
|
||||
e->InitEvent(NS_LITERAL_STRING("encrypted"), false, false);
|
||||
e->InitEvent(NS_LITERAL_STRING("encrypted"), CanBubble::eNo, Cancelable::eNo);
|
||||
e->mInitDataType = aInitDataType;
|
||||
e->mRawInitData = aInitData;
|
||||
e->SetTrusted(true);
|
||||
|
@ -15,7 +15,7 @@ MediaKeyError::MediaKeyError(EventTarget* aOwner, uint32_t aSystemCode)
|
||||
: Event(aOwner, nullptr, nullptr)
|
||||
, mSystemCode(aSystemCode)
|
||||
{
|
||||
InitEvent(NS_LITERAL_STRING("error"), false, false);
|
||||
InitEvent(NS_LITERAL_STRING("error"), CanBubble::eNo, Cancelable::eNo);
|
||||
}
|
||||
|
||||
MediaKeyError::~MediaKeyError()
|
||||
|
@ -607,7 +607,9 @@ MediaKeySession::DispatchKeyStatusesChange()
|
||||
UpdateKeyStatusMap();
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("keystatuseschange"), false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("keystatuseschange"),
|
||||
CanBubble::eNo);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -841,7 +841,7 @@ public:
|
||||
return nsContentUtils::DispatchTrustedEvent(doc,
|
||||
static_cast<DOMEventTargetHelper*>(mAudioContext),
|
||||
NS_LITERAL_STRING("statechange"),
|
||||
false, false);
|
||||
CanBubble::eNo, Cancelable::eNo);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
uint32_t aNumberOfInputChannels,
|
||||
double aPlaybackTime)
|
||||
{
|
||||
InitEvent(NS_LITERAL_STRING("audioprocess"), false, false);
|
||||
InitEvent(NS_LITERAL_STRING("audioprocess"), CanBubble::eNo, Cancelable::eNo);
|
||||
mInputBuffer = aInputBuffer;
|
||||
mNumberOfInputChannels = aNumberOfInputChannels;
|
||||
mPlaybackTime = aPlaybackTime;
|
||||
|
@ -151,8 +151,7 @@ private:
|
||||
}
|
||||
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
|
||||
false /* non-bubbling */,
|
||||
false /* cancelable */, value, EmptyString(),
|
||||
CanBubble::eNo, Cancelable::eNo, value, EmptyString(),
|
||||
EmptyString(), nullptr, ports);
|
||||
event->SetTrusted(true);
|
||||
|
||||
|
@ -120,7 +120,7 @@ PermissionStatus::PermissionChanged()
|
||||
UpdateState();
|
||||
if (mState != oldState) {
|
||||
RefPtr<AsyncEventDispatcher> eventDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("change"), false);
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("change"), CanBubble::eNo);
|
||||
eventDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
{
|
||||
nsContentUtils::DispatchTrustedEvent(mContent->OwnerDoc(), mContent,
|
||||
mFinished ? NS_LITERAL_STRING("MozPaintWaitFinished") : NS_LITERAL_STRING("MozPaintWait"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2003,7 +2003,7 @@ void nsPluginInstanceOwner::PerformDelayedBlurs()
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(),
|
||||
windowRoot,
|
||||
NS_LITERAL_STRING("MozPerformDelayedBlur"),
|
||||
false, false, nullptr);
|
||||
CanBuble::No, Cancelable::eNo, nullptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -463,7 +463,9 @@ PresentationConnection::ProcessStateChanged(nsresult aReason)
|
||||
}
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("connect"), false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("connect"),
|
||||
CanBubble::eNo);
|
||||
return asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
case PresentationConnectionState::Closed: {
|
||||
@ -494,7 +496,9 @@ PresentationConnection::ProcessStateChanged(nsresult aReason)
|
||||
if (!nsContentUtils::ShouldResistFingerprinting()) {
|
||||
// Ensure onterminate event is fired.
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("terminate"), false);
|
||||
new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("terminate"),
|
||||
CanBubble::eNo);
|
||||
Unused << NS_WARN_IF(NS_FAILED(asyncDispatcher->PostDOMEvent()));
|
||||
}
|
||||
|
||||
@ -644,7 +648,7 @@ PresentationConnection::DispatchMessageEvent(JS::Handle<JS::Value> aData)
|
||||
|
||||
messageEvent->InitMessageEvent(nullptr,
|
||||
NS_LITERAL_STRING("message"),
|
||||
false, false, aData, origin,
|
||||
CanBubble::eNo, Cancelable::eNo, aData, origin,
|
||||
EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
messageEvent->SetTrusted(true);
|
||||
|
@ -48,8 +48,8 @@ ScriptElement::FireErrorEvent()
|
||||
return nsContentUtils::DispatchTrustedEvent(cont->OwnerDoc(),
|
||||
cont,
|
||||
NS_LITERAL_STRING("error"),
|
||||
false /* bubbles */,
|
||||
false /* cancelable */);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1960,7 +1960,7 @@ ScriptLoader::ProcessRequest(ScriptLoadRequest* aRequest)
|
||||
nsContentUtils::DispatchTrustedEvent(scriptElem->OwnerDoc(),
|
||||
scriptElem,
|
||||
NS_LITERAL_STRING("beforescriptexecute"),
|
||||
true, true, &runScript);
|
||||
CanBubble::eYes, Cancelable::eYes, &runScript);
|
||||
}
|
||||
|
||||
// Inner window could have gone away after firing beforescriptexecute
|
||||
@ -1982,7 +1982,7 @@ ScriptLoader::ProcessRequest(ScriptLoadRequest* aRequest)
|
||||
nsContentUtils::DispatchTrustedEvent(scriptElem->OwnerDoc(),
|
||||
scriptElem,
|
||||
NS_LITERAL_STRING("afterscriptexecute"),
|
||||
true, false);
|
||||
CanBubble::eYes, Cancelable::eNo);
|
||||
}
|
||||
|
||||
FireScriptEvaluated(rv, aRequest);
|
||||
|
@ -32,7 +32,10 @@ TestingDispatchEvent(nsIScriptElement* aScriptElement,
|
||||
}
|
||||
|
||||
RefPtr<AsyncEventDispatcher> dispatcher =
|
||||
new AsyncEventDispatcher(target, aEventType, true, false);
|
||||
new AsyncEventDispatcher(target,
|
||||
aEventType,
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
return dispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
|
@ -2024,8 +2024,9 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
|
||||
|
||||
RefPtr<MessageEvent> event = new MessageEvent(this, nullptr, nullptr);
|
||||
|
||||
event->InitMessageEvent(nullptr, MESSAGE_EVENT_STRING, false, false,
|
||||
jsData, mImpl->mUTF16Origin, EmptyString(), nullptr,
|
||||
event->InitMessageEvent(nullptr, MESSAGE_EVENT_STRING, CanBubble::eNo,
|
||||
Cancelable::eNo, jsData, mImpl->mUTF16Origin,
|
||||
EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
event->SetTrusted(true);
|
||||
|
||||
|
@ -89,8 +89,8 @@ MessageEventRunnable::DispatchDOMEvent(JSContext* aCx,
|
||||
RefPtr<MessageEvent> event = new MessageEvent(aTarget, nullptr, nullptr);
|
||||
event->InitMessageEvent(nullptr,
|
||||
NS_LITERAL_STRING("message"),
|
||||
false /* non-bubbling */,
|
||||
false /* cancelable */,
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo,
|
||||
messageData,
|
||||
EmptyString(),
|
||||
EmptyString(),
|
||||
|
@ -2370,7 +2370,9 @@ RuntimeService::CreateSharedWorkerFromLoadInfo(JSContext* aCx,
|
||||
// We're done here. Just queue up our error event and return our
|
||||
// dead-on-arrival SharedWorker.
|
||||
RefPtr<AsyncEventDispatcher> errorEvent =
|
||||
new AsyncEventDispatcher(sharedWorker, NS_LITERAL_STRING("error"), false);
|
||||
new AsyncEventDispatcher(sharedWorker,
|
||||
NS_LITERAL_STRING("error"),
|
||||
CanBubble::eNo);
|
||||
errorEvent->PostDOMEvent();
|
||||
sharedWorker.forget(aSharedWorker);
|
||||
return NS_OK;
|
||||
|
@ -58,8 +58,8 @@ private:
|
||||
nullptr);
|
||||
event->InitMessageEvent(nullptr,
|
||||
NS_LITERAL_STRING("message"),
|
||||
false, // canBubble
|
||||
true, // cancelable
|
||||
CanBubble::eNo,
|
||||
Cancelable::eYes,
|
||||
data,
|
||||
EmptyString(),
|
||||
EmptyString(),
|
||||
|
@ -2649,8 +2649,8 @@ XULDocument::DoneWalking()
|
||||
this,
|
||||
static_cast<nsIDocument*>(this),
|
||||
NS_LITERAL_STRING("MozBeforeInitialXULLayout"),
|
||||
true,
|
||||
false);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
|
||||
// Before starting layout, check whether we're a toplevel chrome
|
||||
// window. If we are, setup some state so that we don't have to restyle
|
||||
|
@ -911,8 +911,8 @@ nsXULElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
|
||||
nsContentUtils::DispatchTrustedEvent(doc,
|
||||
static_cast<nsIContent*>(this),
|
||||
NS_LITERAL_STRING("select"),
|
||||
false,
|
||||
true);
|
||||
CanBubble::eNo,
|
||||
Cancelable::eYes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1398,7 +1398,7 @@ nsXULElement::LoadSrc()
|
||||
|
||||
(new AsyncEventDispatcher(this,
|
||||
NS_LITERAL_STRING("XULFrameLoaderCreated"),
|
||||
/* aBubbles */ true))->RunDOMEventWhenSafe();
|
||||
CanBubble::eYes))->RunDOMEventWhenSafe();
|
||||
}
|
||||
|
||||
frameLoader->LoadFrame(false);
|
||||
|
@ -862,7 +862,8 @@ APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrol
|
||||
nsContentUtils::DispatchTrustedEvent(
|
||||
ownerDoc, targetContent,
|
||||
aEvent,
|
||||
true, true);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eYes);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -531,7 +531,10 @@ private:
|
||||
for (int32_t i = 0; i < targets.Count(); ++i) {
|
||||
nsIDocument* d = targets[i];
|
||||
nsContentUtils::DispatchTrustedEvent(d, d->GetWindow(),
|
||||
aEvent, false, false, nullptr);
|
||||
aEvent,
|
||||
CanBubble::eNo,
|
||||
Cancelable::eNo,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3055,7 +3058,7 @@ nsDocumentViewer::SetTextZoom(float aTextZoom)
|
||||
if (textZoomChange) {
|
||||
nsContentUtils::DispatchChromeEvent(mDocument, static_cast<nsIDocument*>(mDocument),
|
||||
NS_LITERAL_STRING("TextZoomChange"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3175,7 +3178,7 @@ nsDocumentViewer::SetFullZoom(float aFullZoom)
|
||||
if (fullZoomChange) {
|
||||
nsContentUtils::DispatchChromeEvent(mDocument, static_cast<nsIDocument*>(mDocument),
|
||||
NS_LITERAL_STRING("FullZoomChange"),
|
||||
true, true);
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1678,8 +1678,8 @@ void nsComboboxControlFrame::FireValueChangeEvent()
|
||||
{
|
||||
// Fire ValueChange event to indicate data value of combo box has changed
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new AsyncEventDispatcher(mContent, NS_LITERAL_STRING("ValueChange"), true,
|
||||
false));
|
||||
new AsyncEventDispatcher(mContent, NS_LITERAL_STRING("ValueChange"),
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eNo));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -328,12 +328,14 @@ nsFileControlFrame::DnDListener::HandleEvent(Event* aEvent)
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(inputElement->OwnerDoc(),
|
||||
static_cast<nsINode*>(inputElement),
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
nsContentUtils::DispatchTrustedEvent(inputElement->OwnerDoc(),
|
||||
static_cast<nsINode*>(inputElement),
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,9 @@ nsListControlFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostD
|
||||
if (ShouldFireDropDownEvent()) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new AsyncEventDispatcher(mContent,
|
||||
NS_LITERAL_STRING("mozhidedropdown"), true,
|
||||
true));
|
||||
NS_LITERAL_STRING("mozhidedropdown"),
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eYes));
|
||||
}
|
||||
|
||||
nsCheckboxRadioFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
|
||||
@ -1387,12 +1388,14 @@ nsListControlFrame::FireOnInputAndOnChange()
|
||||
nsCOMPtr<nsIContent> content = mContent;
|
||||
// Dispatch the input event.
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), content,
|
||||
NS_LITERAL_STRING("input"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("input"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
// Dispatch the change event.
|
||||
nsContentUtils::DispatchTrustedEvent(content->OwnerDoc(), content,
|
||||
NS_LITERAL_STRING("change"), true,
|
||||
false);
|
||||
NS_LITERAL_STRING("change"),
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1785,7 +1788,8 @@ FireShowDropDownEvent(nsIContent* aContent, bool aShow, bool aIsSourceTouchEvent
|
||||
eventName = NS_LITERAL_STRING("mozhidedropdown");
|
||||
}
|
||||
nsContentUtils::DispatchChromeEvent(aContent->OwnerDoc(), aContent,
|
||||
eventName, true, false);
|
||||
eventName, CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3870,7 +3870,10 @@ nsFrame::FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent)
|
||||
|
||||
if (target) {
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(target, aDOMEventName, true, false);
|
||||
new AsyncEventDispatcher(target,
|
||||
aDOMEventName,
|
||||
CanBubble::eYes,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
DebugOnly<nsresult> rv = asyncDispatcher->PostDOMEvent();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncEventDispatcher failed to dispatch");
|
||||
}
|
||||
|
@ -4537,8 +4537,8 @@ ScrollFrameHelper::FireScrollEndEvent()
|
||||
nsContentUtils::DispatchEventOnlyToChrome(mOuter->GetContent()->OwnerDoc(),
|
||||
mOuter->GetContent(),
|
||||
NS_LITERAL_STRING("scrollend"),
|
||||
true /* aCanBubble */,
|
||||
false /* aCancelable */);
|
||||
CanBubble::eYes,
|
||||
Cancelable::eNo);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -269,7 +269,7 @@ public:
|
||||
NS_IMETHOD Run() override {
|
||||
nsContentUtils::DispatchTrustedEvent(mContent->OwnerDoc(), mContent,
|
||||
NS_LITERAL_STRING("resizevideocontrols"),
|
||||
false, false);
|
||||
CanBubble::eNo, Cancelable::eNo);
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
|
@ -1641,7 +1641,7 @@ nsPrintJob::FirePrintingErrorEvent(nsresult aPrintError)
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(doc, event);
|
||||
asyncDispatcher->mOnlyChromeDispatch = true;
|
||||
asyncDispatcher->mOnlyChromeDispatch = ChromeOnlyDispatch::eYes;
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
|
||||
// Inform any progress listeners of the Error.
|
||||
@ -1992,8 +1992,9 @@ nsPrintJob::FirePrintPreviewUpdateEvent()
|
||||
if (mIsDoingPrintPreview && !mIsDoingPrinting) {
|
||||
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(mDocViewerPrint);
|
||||
(new AsyncEventDispatcher(
|
||||
cv->GetDocument(), NS_LITERAL_STRING("printPreviewUpdate"), true, true)
|
||||
)->RunDOMEventWhenSafe();
|
||||
cv->GetDocument(), NS_LITERAL_STRING("printPreviewUpdate"),
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eYes
|
||||
))->RunDOMEventWhenSafe();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ FontFaceSet::DispatchLoadingEventAndReplaceReadyPromise()
|
||||
}
|
||||
|
||||
(new AsyncEventDispatcher(this, NS_LITERAL_STRING("loading"),
|
||||
false))->PostDOMEvent();
|
||||
CanBubble::eNo))->PostDOMEvent();
|
||||
|
||||
if (PrefEnabled()) {
|
||||
if (mReady &&
|
||||
|
@ -322,7 +322,7 @@ SheetLoadData::FireLoadEvent(nsIThreadInternal* aThread)
|
||||
mLoadFailed ?
|
||||
NS_LITERAL_STRING("error") :
|
||||
NS_LITERAL_STRING("load"),
|
||||
false, false);
|
||||
CanBubble::eNo, Cancelable::eNo);
|
||||
|
||||
// And unblock onload
|
||||
mLoader->UnblockOnload(true);
|
||||
@ -1989,7 +1989,8 @@ Loader::LoadStyleLink(const SheetInfo& aInfo, nsICSSLoaderObserver* aObserver)
|
||||
RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||
new LoadBlockingAsyncEventDispatcher(aInfo.mContent,
|
||||
NS_LITERAL_STRING("error"),
|
||||
false, false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
return Err(rv);
|
||||
|
@ -652,7 +652,7 @@ NS_IMETHODIMP nsTreeSelection::SetCurrentIndex(int32_t aIndex)
|
||||
new AsyncEventDispatcher(treeElt,
|
||||
(aIndex != -1 ? DOMMenuItemActive :
|
||||
DOMMenuItemInactive),
|
||||
true, false);
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eNo);
|
||||
return asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
|
||||
@ -835,7 +835,8 @@ nsTreeSelection::FireOnSelectHandler()
|
||||
NS_ENSURE_STATE(elt);
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(elt, NS_LITERAL_STRING("select"), true, false);
|
||||
new AsyncEventDispatcher(elt, NS_LITERAL_STRING("select"),
|
||||
CanBubble::eYes, ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ nsPrefetchService::DispatchEvent(nsPrefetchNode *node, bool aSuccess)
|
||||
aSuccess ?
|
||||
NS_LITERAL_STRING("load") :
|
||||
NS_LITERAL_STRING("error"),
|
||||
/* aCanBubble = */ false);
|
||||
CanBubble::eNo);
|
||||
dispatcher->RequireNodeInDocument();
|
||||
dispatcher->PostDOMEvent();
|
||||
}
|
||||
@ -731,11 +731,10 @@ nsPrefetchService::Preload(nsIURI *aURI,
|
||||
nsCOMPtr<nsINode> domNode = do_QueryInterface(aSource);
|
||||
if (domNode && domNode->IsInComposedDoc()) {
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(//domNode->OwnerDoc(),
|
||||
domNode,
|
||||
new AsyncEventDispatcher(domNode,
|
||||
NS_LITERAL_STRING("error"),
|
||||
/* aCanBubble = */ false,
|
||||
/* aCancelable = */ false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
return NS_OK;
|
||||
@ -778,8 +777,8 @@ nsPrefetchService::Preload(nsIURI *aURI,
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(domNode,
|
||||
NS_LITERAL_STRING("error"),
|
||||
/* aCanBubble = */ false,
|
||||
/* aCancelable = */ false);
|
||||
CanBubble::eNo,
|
||||
ChromeOnlyDispatch::eNo);
|
||||
asyncDispatcher->RunDOMEventWhenSafe();
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,30 @@ enum nsEventStatus
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum class CanBubble
|
||||
{
|
||||
eYes,
|
||||
eNo
|
||||
};
|
||||
|
||||
enum class Cancelable
|
||||
{
|
||||
eYes,
|
||||
eNo
|
||||
};
|
||||
|
||||
enum class ChromeOnlyDispatch
|
||||
{
|
||||
eYes,
|
||||
eNo
|
||||
};
|
||||
|
||||
enum class Trusted
|
||||
{
|
||||
eYes,
|
||||
eNo
|
||||
};
|
||||
|
||||
/**
|
||||
* Event messages
|
||||
*/
|
||||
|
@ -283,7 +283,7 @@ nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y)
|
||||
nsContentUtils::DispatchChromeEvent(mDocShell->GetDocument(),
|
||||
eventTarget,
|
||||
NS_LITERAL_STRING("MozUpdateWindowPos"),
|
||||
false, false, nullptr);
|
||||
CanBubble::eNo, Cancelable::eNo, nullptr);
|
||||
}
|
||||
|
||||
// Persist position, but not immediately, in case this OS is firing
|
||||
|
Loading…
x
Reference in New Issue
Block a user