--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -188,21 +188,17 @@ DOMRequest::FireDetailedError(DOMError*
void
DOMRequest::FireEvent(const nsAString& aType, bool aBubble, bool aCancelable)
{
if (NS_FAILED(CheckInnerWindowCorrectness())) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(aType, aBubble, aCancelable);
- if (NS_FAILED(rv)) {
- return;
- }
-
+ event->InitEvent(aType, aBubble, aCancelable);
event->SetTrusted(true);
bool dummy;
DispatchEvent(event, &dummy);
}
void
DOMRequest::RootResultVal()
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -752,22 +752,17 @@ EventSource::AnnounceConnection()
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it doesn't bubble, and it isn't cancelable
- rv = event->InitEvent(NS_LITERAL_STRING("open"), false, false);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to init the open event!!!");
- return;
- }
-
+ event->InitEvent(NS_LITERAL_STRING("open"), false, false);
event->SetTrusted(true);
rv = DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch the open event!!!");
return;
}
}
@@ -808,22 +803,17 @@ EventSource::ReestablishConnection()
rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it doesn't bubble, and it isn't cancelable
- rv = event->InitEvent(NS_LITERAL_STRING("error"), false, false);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to init the error event!!!");
- return;
- }
-
+ event->InitEvent(NS_LITERAL_STRING("error"), false, false);
event->SetTrusted(true);
rv = DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch the error event!!!");
return;
}
@@ -959,22 +949,17 @@ EventSource::FailConnection()
rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it doesn't bubble, and it isn't cancelable
- rv = event->InitEvent(NS_LITERAL_STRING("error"), false, false);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to init the error event!!!");
- return;
- }
-
+ event->InitEvent(NS_LITERAL_STRING("error"), false, false);
event->SetTrusted(true);
rv = DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch the error event!!!");
return;
}
}
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -1802,19 +1802,17 @@ WebSocket::CreateAndDispatchSimpleEvent(
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return NS_OK;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it doesn't bubble, and it isn't cancelable
- rv = event->InitEvent(aName, false, false);
- NS_ENSURE_SUCCESS(rv, rv);
-
+ event->InitEvent(aName, false, false);
event->SetTrusted(true);
return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
nsresult
WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
bool aIsBinary)
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3751,19 +3751,17 @@ nsresult GetEventAndTarget(nsIDocument*
nsCOMPtr<EventTarget> target(do_QueryInterface(aTarget));
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
nsCOMPtr<nsIDOMEvent> event;
nsresult rv =
domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
NS_ENSURE_SUCCESS(rv, rv);
- rv = event->InitEvent(aEventName, aCanBubble, aCancelable);
- NS_ENSURE_SUCCESS(rv, rv);
-
+ event->InitEvent(aEventName, aCanBubble, aCancelable);
event->SetTrusted(aTrusted);
rv = event->SetTarget(target);
NS_ENSURE_SUCCESS(rv, rv);
event.forget(aEvent);
target.forget(aTargetOut);
return NS_OK;
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -450,19 +450,17 @@ nsDOMDataChannel::OnSimpleEvent(nsISuppo
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return NS_OK;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- rv = event->InitEvent(aName, false, false);
- NS_ENSURE_SUCCESS(rv,rv);
-
+ event->InitEvent(aName, false, false);
event->SetTrusted(true);
return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
nsresult
nsDOMDataChannel::OnChannelConnected(nsISupports* aContext)
{
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -9117,20 +9117,17 @@ NotifyPageHide(nsIDocument* aDocument, v
return true;
}
static void
DispatchCustomEventWithFlush(nsINode* aTarget, const nsAString& aEventType,
bool aBubbles, bool aOnlyChromeDispatch)
{
RefPtr<Event> event = NS_NewDOMEvent(aTarget, nullptr, nullptr);
- nsresult rv = event->InitEvent(aEventType, aBubbles, false);
- if (NS_FAILED(rv)) {
- return;
- }
+ event->InitEvent(aEventType, aBubbles, false);
event->SetTrusted(true);
if (aOnlyChromeDispatch) {
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
}
if (nsIPresShell* shell = aTarget->OwnerDoc()->GetShell()) {
shell->GetPresContext()->
RefreshDriver()->ScheduleEventDispatch(aTarget, event);
}
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -11023,23 +11023,21 @@ nsGlobalWindow::Observe(nsISupports* aSu
if (!nsCRT::strcmp(aTopic, NS_NETWORK_ACTIVITY_BLIP_UPLOAD_TOPIC) ||
!nsCRT::strcmp(aTopic, NS_NETWORK_ACTIVITY_BLIP_DOWNLOAD_TOPIC)) {
MOZ_ASSERT(IsInnerWindow());
if (!IsCurrentInnerWindow()) {
return NS_OK;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(
+ event->InitEvent(
!nsCRT::strcmp(aTopic, NS_NETWORK_ACTIVITY_BLIP_UPLOAD_TOPIC)
? NETWORK_UPLOAD_EVENT_NAME
: NETWORK_DOWNLOAD_EVENT_NAME,
false, false);
- NS_ENSURE_SUCCESS(rv, rv);
-
event->SetTrusted(true);
bool dummy;
return DispatchEvent(event, &dummy);
}
#endif // MOZ_B2G
if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
@@ -11059,19 +11057,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
}
// The event has to be dispatched only to the current inner window.
if (!IsCurrentInnerWindow()) {
return NS_OK;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("languagechange"), false, false);
- NS_ENSURE_SUCCESS(rv, rv);
-
+ event->InitEvent(NS_LITERAL_STRING("languagechange"), false, false);
event->SetTrusted(true);
bool dummy;
return DispatchEvent(event, &dummy);
}
NS_WARNING("unrecognized topic in nsGlobalWindow::Observe");
return NS_ERROR_FAILURE;
--- a/dom/base/nsPerformance.cpp
+++ b/dom/base/nsPerformance.cpp
@@ -478,21 +478,17 @@ nsPerformance::Timing()
return mTiming;
}
void
nsPerformance::DispatchBufferFullEvent()
{
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it bubbles, and it isn't cancelable
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("resourcetimingbufferfull"),
- true, false);
- if (NS_FAILED(rv)) {
- return;
- }
+ event->InitEvent(NS_LITERAL_STRING("resourcetimingbufferfull"), true, false);
event->SetTrusted(true);
DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
nsPerformanceNavigation*
nsPerformance::Navigation()
{
if (!mNavigation) {
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -15972,17 +15972,17 @@ class CGEventMethod(CGNativeMember):
self.args.insert(0, Argument("mozilla::dom::EventTarget*", "aOwner"))
constructorForNativeCaller = CGNativeMember.declare(self, cgClass)
self.args = list(self.originalArgs)
if needCx(None, self.arguments(), [], considerTypes=True, static=True):
self.args.insert(0, Argument("JSContext*", "aCx"))
if not self.isInit:
self.args.insert(0, Argument("const GlobalObject&", "aGlobal"))
- self.args.append(Argument('ErrorResult&', 'aRv'))
+ self.args.append(Argument('ErrorResult&', 'aRv'))
return constructorForNativeCaller + CGNativeMember.declare(self, cgClass)
def defineInit(self, cgClass):
iface = self.descriptorProvider.interface
members = ""
while iface.identifier.name != "Event":
i = 3 # Skip the boilerplate args: type, bubble,s cancelable.
for m in iface.members:
@@ -15994,30 +15994,24 @@ class CGEventMethod(CGNativeMember):
continue
name = CGDictionary.makeMemberName(m.identifier.name)
members += "%s = %s;\n" % (name, self.args[i].name)
i += 1
iface = iface.parent
self.body = fill(
"""
- nsresult rv = InitEvent(${typeArg}, ${bubblesArg}, ${cancelableArg});
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return;
- }
+ InitEvent(${typeArg}, ${bubblesArg}, ${cancelableArg});
${members}
""",
typeArg=self.args[0].name,
bubblesArg=self.args[1].name,
cancelableArg=self.args[2].name,
members=members)
- self.args.append(Argument('ErrorResult&', 'aRv'))
-
return CGNativeMember.define(self, cgClass)
def define(self, cgClass):
self.args = list(self.originalArgs)
if self.isInit:
return self.defineInit(cgClass)
members = ""
holdJS = ""
--- a/dom/events/AnimationEvent.cpp
+++ b/dom/events/AnimationEvent.cpp
@@ -39,17 +39,17 @@ AnimationEvent::Constructor(const Global
const nsAString& aType,
const AnimationEventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<AnimationEvent> e = new AnimationEvent(t, nullptr, nullptr);
bool trusted = e->Init(t);
- aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
+ e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
InternalAnimationEvent* internalEvent = e->mEvent->AsAnimationEvent();
internalEvent->animationName = aParam.mAnimationName;
internalEvent->elapsedTime = aParam.mElapsedTime;
internalEvent->pseudoElement = aParam.mPseudoElement;
e->SetTrusted(trusted);
return e.forget();
--- a/dom/events/AsyncEventDispatcher.cpp
+++ b/dom/events/AsyncEventDispatcher.cpp
@@ -35,18 +35,17 @@ AsyncEventDispatcher::AsyncEventDispatch
}
NS_IMETHODIMP
AsyncEventDispatcher::Run()
{
RefPtr<Event> event = mEvent ? mEvent->InternalDOMEvent() : nullptr;
if (!event) {
event = NS_NewDOMEvent(mTarget, nullptr, nullptr);
- nsresult rv = event->InitEvent(mEventType, mBubbles, false);
- NS_ENSURE_SUCCESS(rv, rv);
+ event->InitEvent(mEventType, mBubbles, false);
event->SetTrusted(true);
}
if (mOnlyChromeDispatch) {
MOZ_ASSERT(event->IsTrusted());
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
}
bool dummy;
mTarget->DispatchEvent(event, &dummy);
--- a/dom/events/ClipboardEvent.cpp
+++ b/dom/events/ClipboardEvent.cpp
@@ -38,32 +38,27 @@ ClipboardEvent::InitClipboardEvent(const
bool aCanBubble,
bool aCancelable,
nsIDOMDataTransfer* aClipboardData)
{
nsCOMPtr<DataTransfer> clipboardData = do_QueryInterface(aClipboardData);
// Null clipboardData is OK
ErrorResult rv;
- InitClipboardEvent(aType, aCanBubble, aCancelable, clipboardData, rv);
+ InitClipboardEvent(aType, aCanBubble, aCancelable, clipboardData);
return rv.StealNSResult();
}
void
ClipboardEvent::InitClipboardEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable,
- DataTransfer* aClipboardData,
- ErrorResult& aError)
+ DataTransfer* aClipboardData)
{
- aError = Event::InitEvent(aType, aCanBubble, aCancelable);
- if (aError.Failed()) {
- return;
- }
-
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mEvent->AsClipboardEvent()->clipboardData = aClipboardData;
}
already_AddRefed<ClipboardEvent>
ClipboardEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const ClipboardEventInit& aParam,
ErrorResult& aRv)
@@ -81,17 +76,17 @@ ClipboardEvent::Constructor(const Global
// checked properly within DataTransfer.
clipboardData = new DataTransfer(ToSupports(e), eCopy, false, -1);
clipboardData->SetData(aParam.mDataType, aParam.mData, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
}
}
e->InitClipboardEvent(aType, aParam.mBubbles, aParam.mCancelable,
- clipboardData, aRv);
+ clipboardData);
e->SetTrusted(trusted);
return e.forget();
}
NS_IMETHODIMP
ClipboardEvent::GetClipboardData(nsIDOMDataTransfer** aClipboardData)
{
NS_IF_ADDREF(*aClipboardData = GetClipboardData());
--- a/dom/events/ClipboardEvent.h
+++ b/dom/events/ClipboardEvent.h
@@ -41,18 +41,17 @@ public:
const nsAString& aType,
const ClipboardEventInit& aParam,
ErrorResult& aRv);
DataTransfer* GetClipboardData();
void InitClipboardEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable,
- DataTransfer* aClipboardData,
- ErrorResult& aError);
+ DataTransfer* aClipboardData);
protected:
~ClipboardEvent() {}
};
} // namespace dom
} // namespace mozilla
--- a/dom/events/CommandEvent.cpp
+++ b/dom/events/CommandEvent.cpp
@@ -46,18 +46,17 @@ CommandEvent::GetCommand(nsAString& aCom
}
NS_IMETHODIMP
CommandEvent::InitCommandEvent(const nsAString& aTypeArg,
bool aCanBubbleArg,
bool aCancelableArg,
const nsAString& aCommand)
{
- nsresult rv = Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
- NS_ENSURE_SUCCESS(rv, rv);
+ Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
mEvent->AsCommandEvent()->command = do_GetAtom(aCommand);
return NS_OK;
}
} // namespace dom
} // namespace mozilla
--- a/dom/events/CustomEvent.cpp
+++ b/dom/events/CustomEvent.cpp
@@ -61,18 +61,17 @@ CustomEvent::WrapObjectInternal(JSContex
}
NS_IMETHODIMP
CustomEvent::InitCustomEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIVariant* aDetail)
{
- nsresult rv = Event::InitEvent(aType, aCanBubble, aCancelable);
- NS_ENSURE_SUCCESS(rv, rv);
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mDetail = aDetail;
return NS_OK;
}
void
CustomEvent::InitCustomEvent(JSContext* aCx,
const nsAString& aType,
bool aCanBubble,
@@ -84,17 +83,17 @@ CustomEvent::InitCustomEvent(JSContext*
if (nsIXPConnect* xpc = nsContentUtils::XPConnect()) {
xpc->JSToVariant(aCx, aDetail, getter_AddRefs(detail));
}
if (!detail) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
- aRv = InitCustomEvent(aType, aCanBubble, aCancelable, detail);
+ InitCustomEvent(aType, aCanBubble, aCancelable, detail);
}
NS_IMETHODIMP
CustomEvent::GetDetail(nsIVariant** aDetail)
{
NS_IF_ADDREF(*aDetail = mDetail);
return NS_OK;
}
--- a/dom/events/DOMEventTargetHelper.cpp
+++ b/dom/events/DOMEventTargetHelper.cpp
@@ -258,18 +258,17 @@ DOMEventTargetHelper::DispatchEvent(nsID
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);
return rv;
}
nsresult
DOMEventTargetHelper::DispatchTrustedEvent(const nsAString& aEventName)
{
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(aEventName, false, false);
- NS_ENSURE_SUCCESS(rv, rv);
+ event->InitEvent(aEventName, false, false);
return DispatchTrustedEvent(event);
}
nsresult
DOMEventTargetHelper::DispatchTrustedEvent(nsIDOMEvent* event)
{
event->SetTrusted(true);
--- a/dom/events/DeviceMotionEvent.cpp
+++ b/dom/events/DeviceMotionEvent.cpp
@@ -28,23 +28,19 @@ NS_INTERFACE_MAP_END_INHERITING(Event)
void
DeviceMotionEvent::InitDeviceMotionEvent(
const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const DeviceAccelerationInit& aAcceleration,
const DeviceAccelerationInit& aAccelIncludingGravity,
const DeviceRotationRateInit& aRotationRate,
- Nullable<double> aInterval,
- ErrorResult& aRv)
+ Nullable<double> aInterval)
{
- aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
- if (aRv.Failed()) {
- return;
- }
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mAcceleration = new DeviceAcceleration(this, aAcceleration.mX,
aAcceleration.mY,
aAcceleration.mZ);
mAccelerationIncludingGravity =
new DeviceAcceleration(this, aAccelIncludingGravity.mX,
aAccelIncludingGravity.mY,
@@ -59,20 +55,17 @@ DeviceMotionEvent::InitDeviceMotionEvent
already_AddRefed<DeviceMotionEvent>
DeviceMotionEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const DeviceMotionEventInit& aEventInitDict,
ErrorResult& aRv)
{
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<DeviceMotionEvent> e = new DeviceMotionEvent(t, nullptr, nullptr);
- aRv = e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
- if (aRv.Failed()) {
- return nullptr;
- }
+ e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
bool trusted = e->Init(t);
e->mAcceleration = new DeviceAcceleration(e,
aEventInitDict.mAcceleration.mX,
aEventInitDict.mAcceleration.mY,
aEventInitDict.mAcceleration.mZ);
e->mAccelerationIncludingGravity = new DeviceAcceleration(e,
--- a/dom/events/DeviceMotionEvent.h
+++ b/dom/events/DeviceMotionEvent.h
@@ -123,18 +123,17 @@ public:
void InitDeviceMotionEvent(
const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const DeviceAccelerationInit& aAcceleration,
const DeviceAccelerationInit& aAccelerationIncludingGravity,
const DeviceRotationRateInit& aRotationRate,
- Nullable<double> aInterval,
- ErrorResult& aRv);
+ Nullable<double> aInterval);
static already_AddRefed<DeviceMotionEvent>
Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const DeviceMotionEventInit& aEventInitDict,
ErrorResult& aRv);
protected:
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -409,17 +409,17 @@ already_AddRefed<Event>
Event::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const EventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<Event> e = new Event(t, nullptr, nullptr);
bool trusted = e->Init(t);
- aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
+ e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
e->SetTrusted(trusted);
return e.forget();
}
uint16_t
Event::EventPhase() const
{
// Note, remember to check that this works also
@@ -567,23 +567,23 @@ Event::SetEventType(const nsAString& aEv
&(mEvent->mMessage));
} else {
mEvent->userType = nullptr;
mEvent->mMessage = eUnidentifiedEvent;
mEvent->typeString = aEventTypeArg;
}
}
-NS_IMETHODIMP
+void
Event::InitEvent(const nsAString& aEventTypeArg,
bool aCanBubbleArg,
bool aCancelableArg)
{
// Make sure this event isn't already being dispatched.
- NS_ENSURE_TRUE(!mEvent->mFlags.mIsBeingDispatched, NS_OK);
+ NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
if (IsTrusted()) {
// Ensure the caller is permitted to dispatch trusted DOM events.
if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
SetTrusted(false);
}
}
@@ -595,17 +595,16 @@ Event::InitEvent(const nsAString& aEvent
mEvent->mFlags.mDefaultPrevented = false;
mEvent->mFlags.mDefaultPreventedByContent = false;
mEvent->mFlags.mDefaultPreventedByChrome = false;
// Clearing the old targets, so that the event is targeted correctly when
// re-dispatching it.
mEvent->target = nullptr;
mEvent->originalTarget = nullptr;
- return NS_OK;
}
NS_IMETHODIMP
Event::DuplicatePrivateData()
{
NS_ASSERTION(mEvent, "No WidgetEvent for Event duplication!");
if (mEventIsInternal) {
return NS_OK;
@@ -1185,18 +1184,17 @@ Event::Deserialize(const IPC::Message* a
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &bubbles), false);
bool cancelable = false;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &cancelable), false);
bool trusted = false;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &trusted), false);
- nsresult rv = InitEvent(type, bubbles, cancelable);
- NS_ENSURE_SUCCESS(rv, false);
+ InitEvent(type, bubbles, cancelable);
SetTrusted(trusted);
return true;
}
NS_IMETHODIMP_(void)
Event::SetOwner(mozilla::dom::EventTarget* aOwner)
{
--- a/dom/events/Event.h
+++ b/dom/events/Event.h
@@ -201,22 +201,16 @@ public:
bool IsSynthesized() const
{
return mEvent->mFlags.mIsSynthesizedForTests;
}
double TimeStamp() const;
- void InitEvent(const nsAString& aType, bool aBubbles, bool aCancelable,
- ErrorResult& aRv)
- {
- aRv = InitEvent(aType, aBubbles, aCancelable);
- }
-
EventTarget* GetOriginalTarget() const;
EventTarget* GetExplicitOriginalTarget() const;
EventTarget* GetComposedTarget() const;
bool GetPreventDefault() const;
/**
* @param aCalledByDefaultHandler Should be true when this is called by
@@ -307,17 +301,17 @@ private:
NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget) override { return _to GetCurrentTarget(aCurrentTarget); } \
NS_IMETHOD GetEventPhase(uint16_t* aEventPhase) override { return _to GetEventPhase(aEventPhase); } \
NS_IMETHOD GetBubbles(bool* aBubbles) override { return _to GetBubbles(aBubbles); } \
NS_IMETHOD GetCancelable(bool* aCancelable) override { return _to GetCancelable(aCancelable); } \
NS_IMETHOD GetTimeStamp(DOMTimeStamp* aTimeStamp) override { return _to GetTimeStamp(aTimeStamp); } \
NS_IMETHOD StopPropagation(void) override { return _to StopPropagation(); } \
NS_IMETHOD StopCrossProcessForwarding(void) override { return _to StopCrossProcessForwarding(); } \
NS_IMETHOD PreventDefault(void) override { return _to PreventDefault(); } \
- NS_IMETHOD InitEvent(const nsAString& eventTypeArg, bool canBubbleArg, bool cancelableArg) override { return _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
+ void InitEvent(const nsAString& eventTypeArg, bool canBubbleArg, bool cancelableArg) override { _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
NS_IMETHOD GetDefaultPrevented(bool* aDefaultPrevented) override { return _to GetDefaultPrevented(aDefaultPrevented); } \
NS_IMETHOD StopImmediatePropagation(void) override { return _to StopImmediatePropagation(); } \
NS_IMETHOD GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget) override { return _to GetOriginalTarget(aOriginalTarget); } \
NS_IMETHOD GetExplicitOriginalTarget(nsIDOMEventTarget** aExplicitOriginalTarget) override { return _to GetExplicitOriginalTarget(aExplicitOriginalTarget); } \
NS_IMETHOD GetPreventDefault(bool* aRetval) override { return _to GetPreventDefault(aRetval); } \
NS_IMETHOD GetIsTrusted(bool* aIsTrusted) override { return _to GetIsTrusted(aIsTrusted); } \
NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget) override { return _to SetTarget(aTarget); } \
NS_IMETHOD_(bool) IsDispatchStopped(void) override { return _to IsDispatchStopped(); } \
--- a/dom/events/MessageEvent.cpp
+++ b/dom/events/MessageEvent.cpp
@@ -126,21 +126,17 @@ MessageEvent::Constructor(const GlobalOb
/* static */ already_AddRefed<MessageEvent>
MessageEvent::Constructor(EventTarget* aEventTarget,
const nsAString& aType,
const MessageEventInit& aParam,
ErrorResult& aRv)
{
RefPtr<MessageEvent> event = new MessageEvent(aEventTarget, nullptr, nullptr);
- aRv = event->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
- if (aRv.Failed()) {
- return nullptr;
- }
-
+ event->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
bool trusted = event->Init(aEventTarget);
event->SetTrusted(trusted);
event->mData = aParam.mData;
mozilla::HoldJSObjects(event.get());
if (aParam.mOrigin.WasPassed()) {
@@ -177,43 +173,36 @@ NS_IMETHODIMP
MessageEvent::InitMessageEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
JS::Handle<JS::Value> aData,
const nsAString& aOrigin,
const nsAString& aLastEventId,
nsIDOMWindow* aSource)
{
- nsresult rv = Event::InitEvent(aType, aCanBubble, aCancelable);
- NS_ENSURE_SUCCESS(rv, rv);
-
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mData = aData;
mozilla::HoldJSObjects(this);
mOrigin = aOrigin;
mLastEventId = aLastEventId;
mWindowSource = aSource;
return NS_OK;
}
void
MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType,
bool aCanBubble, bool aCancelable,
JS::Handle<JS::Value> aData,
const nsAString& aOrigin,
const nsAString& aLastEventId,
const Nullable<WindowProxyOrMessagePort>& aSource,
- const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts,
- ErrorResult& aRv)
+ const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts)
{
- aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
- if (NS_WARN_IF(aRv.Failed())) {
- return;
- }
-
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mData = aData;
mozilla::HoldJSObjects(this);
mOrigin = aOrigin;
mLastEventId = aLastEventId;
mWindowSource = nullptr;
mPortSource = nullptr;
--- a/dom/events/MessageEvent.h
+++ b/dom/events/MessageEvent.h
@@ -78,18 +78,17 @@ public:
const nsAString& aType,
const MessageEventInit& aEventInit,
ErrorResult& aRv);
void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
bool aCancelable, JS::Handle<JS::Value> aData,
const nsAString& aOrigin, const nsAString& aLastEventId,
const Nullable<WindowProxyOrMessagePort>& aSource,
- const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts,
- ErrorResult& aRv);
+ const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts);
protected:
~MessageEvent();
private:
JS::Heap<JS::Value> mData;
nsString mOrigin;
nsString mLastEventId;
--- a/dom/events/MutationEvent.cpp
+++ b/dom/events/MutationEvent.cpp
@@ -91,18 +91,17 @@ MutationEvent::InitMutationEvent(const n
bool aCanBubbleArg,
bool aCancelableArg,
nsIDOMNode* aRelatedNodeArg,
const nsAString& aPrevValueArg,
const nsAString& aNewValueArg,
const nsAString& aAttrNameArg,
uint16_t aAttrChangeArg)
{
- nsresult rv = Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
- NS_ENSURE_SUCCESS(rv, rv);
+ Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
InternalMutationEvent* mutation = mEvent->AsMutationEvent();
mutation->mRelatedNode = aRelatedNodeArg;
if (!aPrevValueArg.IsEmpty())
mutation->mPrevAttrValue = do_GetAtom(aPrevValueArg);
if (!aNewValueArg.IsEmpty())
mutation->mNewAttrValue = do_GetAtom(aNewValueArg);
if (!aAttrNameArg.IsEmpty()) {
--- a/dom/events/SpeechRecognitionError.cpp
+++ b/dom/events/SpeechRecognitionError.cpp
@@ -24,31 +24,27 @@ already_AddRefed<SpeechRecognitionError>
SpeechRecognitionError::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const SpeechRecognitionErrorInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<SpeechRecognitionError> e = new SpeechRecognitionError(t, nullptr, nullptr);
bool trusted = e->Init(t);
- e->InitSpeechRecognitionError(aType, aParam.mBubbles, aParam.mCancelable, aParam.mError, aParam.mMessage, aRv);
+ e->InitSpeechRecognitionError(aType, aParam.mBubbles, aParam.mCancelable, aParam.mError, aParam.mMessage);
e->SetTrusted(trusted);
return e.forget();
}
void
SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
SpeechRecognitionErrorCode aError,
- const nsAString& aMessage,
- ErrorResult& aRv)
+ const nsAString& aMessage)
{
- aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
- NS_ENSURE_TRUE_VOID(!aRv.Failed());
-
+ Event::InitEvent(aType, aCanBubble, aCancelable);
mError = aError;
mMessage = aMessage;
- return;
}
} // namespace dom
} // namespace mozilla
--- a/dom/events/SpeechRecognitionError.h
+++ b/dom/events/SpeechRecognitionError.h
@@ -44,18 +44,17 @@ public:
return mError;
}
void
InitSpeechRecognitionError(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
SpeechRecognitionErrorCode aError,
- const nsAString& aMessage,
- ErrorResult& aRv);
+ const nsAString& aMessage);
protected:
SpeechRecognitionErrorCode mError;
nsString mMessage;
};
} // namespace dom
} // namespace mozilla
--- a/dom/events/StorageEvent.cpp
+++ b/dom/events/StorageEvent.cpp
@@ -80,24 +80,19 @@ StorageEvent::Constructor(const GlobalOb
}
void
StorageEvent::InitStorageEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable, const nsAString& aKey,
const nsAString& aOldValue,
const nsAString& aNewValue,
const nsAString& aURL,
- DOMStorage* aStorageArea,
- ErrorResult& aRv)
+ DOMStorage* aStorageArea)
{
- aRv = InitEvent(aType, aCanBubble, aCancelable);
- if (aRv.Failed()) {
- return;
- }
-
+ InitEvent(aType, aCanBubble, aCancelable);
mKey = aKey;
mOldValue = aOldValue;
mNewValue = aNewValue;
mUrl = aURL;
mStorageArea = aStorageArea;
}
} // namespace dom
--- a/dom/events/StorageEvent.h
+++ b/dom/events/StorageEvent.h
@@ -52,18 +52,17 @@ public:
Constructor(const GlobalObject& aGlobal, const nsAString& aType,
const StorageEventInit& aEventInitDict, ErrorResult& aRv);
void InitStorageEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable, const nsAString& aKey,
const nsAString& aOldValue,
const nsAString& aNewValue,
const nsAString& aURL,
- DOMStorage* aStorageArea,
- ErrorResult& aRv);
+ DOMStorage* aStorageArea);
void GetKey(nsString& aRetVal) const
{
aRetVal = mKey;
}
void GetOldValue(nsString& aRetVal) const
{
--- a/dom/events/TouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -97,24 +97,19 @@ TouchEvent::InitTouchEvent(const nsAStri
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
TouchList* aTouches,
TouchList* aTargetTouches,
- TouchList* aChangedTouches,
- ErrorResult& aRv)
+ TouchList* aChangedTouches)
{
- aRv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
- if (aRv.Failed()) {
- return;
- }
-
+ UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
aShiftKey, aMetaKey);
mTouches = aTouches;
mTargetTouches = aTargetTouches;
mChangedTouches = aChangedTouches;
}
TouchList*
--- a/dom/events/TouchEvent.h
+++ b/dom/events/TouchEvent.h
@@ -110,18 +110,17 @@ public:
nsIDOMWindow* aView,
int32_t aDetail,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
TouchList* aTouches,
TouchList* aTargetTouches,
- TouchList* aChangedTouches,
- ErrorResult& aRv);
+ TouchList* aChangedTouches);
static bool PrefEnabled(JSContext* aCx = nullptr,
JSObject* aGlobal = nullptr);
protected:
~TouchEvent() {}
RefPtr<TouchList> mTouches;
--- a/dom/events/TransitionEvent.cpp
+++ b/dom/events/TransitionEvent.cpp
@@ -39,17 +39,17 @@ TransitionEvent::Constructor(const Globa
const nsAString& aType,
const TransitionEventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<TransitionEvent> e = new TransitionEvent(t, nullptr, nullptr);
bool trusted = e->Init(t);
- aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
+ e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
InternalTransitionEvent* internalEvent = e->mEvent->AsTransitionEvent();
internalEvent->propertyName = aParam.mPropertyName;
internalEvent->elapsedTime = aParam.mElapsedTime;
internalEvent->pseudoElement = aParam.mPseudoElement;
e->SetTrusted(trusted);
return e.forget();
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -156,19 +156,17 @@ UIEvent::InitUIEvent(const nsAString& ty
bool cancelableArg,
nsIDOMWindow* viewArg,
int32_t detailArg)
{
if (viewArg) {
nsCOMPtr<nsPIDOMWindow> view = do_QueryInterface(viewArg);
NS_ENSURE_TRUE(view, NS_ERROR_INVALID_ARG);
}
- nsresult rv = Event::InitEvent(typeArg, canBubbleArg, cancelableArg);
- NS_ENSURE_SUCCESS(rv, rv);
-
+ Event::InitEvent(typeArg, canBubbleArg, cancelableArg);
mDetail = detailArg;
mView = viewArg;
return NS_OK;
}
NS_IMETHODIMP
UIEvent::GetPageX(int32_t* aPageX)
--- a/dom/indexedDB/IDBEvents.cpp
+++ b/dom/indexedDB/IDBEvents.cpp
@@ -30,20 +30,19 @@ const char16_t* kVersionChangeEventType
already_AddRefed<nsIDOMEvent>
CreateGenericEvent(EventTarget* aOwner,
const nsDependentString& aType,
Bubbles aBubbles,
Cancelable aCancelable)
{
RefPtr<Event> event = new Event(aOwner, nullptr, nullptr);
- MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
- event->InitEvent(aType,
- aBubbles == eDoesBubble ? true : false,
- aCancelable == eCancelable ? true : false)));
+ event->InitEvent(aType,
+ aBubbles == eDoesBubble ? true : false,
+ aCancelable == eCancelable ? true : false);
event->SetTrusted(true);
return event.forget();
}
// static
already_AddRefed<IDBVersionChangeEvent>
@@ -53,17 +52,17 @@ IDBVersionChangeEvent::CreateInternal(Ev
Nullable<uint64_t> aNewVersion)
{
RefPtr<IDBVersionChangeEvent> event =
new IDBVersionChangeEvent(aOwner, aOldVersion);
if (!aNewVersion.IsNull()) {
event->mNewVersion.SetValue(aNewVersion.Value());
}
- MOZ_ALWAYS_TRUE(NS_SUCCEEDED(event->InitEvent(aType, false, false)));
+ event->InitEvent(aType, false, false);
event->SetTrusted(true);
return event.forget();
}
already_AddRefed<IDBVersionChangeEvent>
IDBVersionChangeEvent::Constructor(const GlobalObject& aGlobal,
--- a/dom/interfaces/events/nsIDOMAnimationEvent.idl
+++ b/dom/interfaces/events/nsIDOMAnimationEvent.idl
@@ -6,14 +6,14 @@
#include "nsIDOMEvent.idl"
/**
* Animation events are defined in:
* http://www.w3.org/TR/css3-animations/#animation-events-
* http://dev.w3.org/csswg/css3-animations/#animation-events-
*/
-[builtinclass, uuid(b1bea1bc-689b-4e07-8cbc-ef342725f9a6)]
+[builtinclass, uuid(772c7069-3f7d-42cf-97ab-b32f1c0b83da)]
interface nsIDOMAnimationEvent : nsIDOMEvent {
readonly attribute DOMString animationName;
readonly attribute float elapsedTime;
readonly attribute DOMString pseudoElement;
};
--- a/dom/interfaces/events/nsIDOMBeforeUnloadEvent.idl
+++ b/dom/interfaces/events/nsIDOMBeforeUnloadEvent.idl
@@ -10,17 +10,17 @@
* sent to handlers of the "beforeunload" event. This event is
* non-standard. Interface derived from Microsoft IE's event
* implementation.
*
* http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events.asp
*
*/
-[builtinclass, uuid(ee7b8943-440e-4cc3-b25e-c17c8a821d8b)]
+[builtinclass, uuid(96abf41b-32a8-4ff6-a0d6-4ade4ddebf89)]
interface nsIDOMBeforeUnloadEvent : nsIDOMEvent
{
/**
* Attribute used to pass back a return value from a beforeunload
* handler
*/
attribute DOMString returnValue;
};
--- a/dom/interfaces/events/nsIDOMClipboardEvent.idl
+++ b/dom/interfaces/events/nsIDOMClipboardEvent.idl
@@ -3,17 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsIDOMEvent.idl"
interface nsIDOMDataTransfer;
-[builtinclass, uuid(8D92944A-F2E5-41F4-9CF3-D85043B90CAC)]
+[builtinclass, uuid(4ef84980-52c2-425c-b41a-2ee75ec5d497)]
interface nsIDOMClipboardEvent : nsIDOMEvent
{
readonly attribute nsIDOMDataTransfer clipboardData;
// The constructor must be used from script to initialize
// clipboard events.
[noscript] void initClipboardEvent(in DOMString typeArg,
in boolean canBubbleArg,
--- a/dom/interfaces/events/nsIDOMCommandEvent.idl
+++ b/dom/interfaces/events/nsIDOMCommandEvent.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
-[builtinclass, uuid(3fdc07cb-3b2e-4c6e-a054-008a4f302202)]
+[builtinclass, uuid(7efbe68a-811a-4159-801c-226948cfd08f)]
interface nsIDOMCommandEvent : nsIDOMEvent
{
readonly attribute DOMString command;
void initCommandEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean canCancelArg,
in DOMString command);
--- a/dom/interfaces/events/nsIDOMCompositionEvent.idl
+++ b/dom/interfaces/events/nsIDOMCompositionEvent.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
-[builtinclass, uuid(ef545b90-a5f4-471c-b4f8-03b5e0f6fda2)]
+[builtinclass, uuid(5adfd99b-d3c7-4c6d-92d1-527264a71b50)]
interface nsIDOMCompositionEvent : nsIDOMUIEvent
{
readonly attribute DOMString data;
readonly attribute DOMString locale;
void initCompositionEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
--- a/dom/interfaces/events/nsIDOMCustomEvent.idl
+++ b/dom/interfaces/events/nsIDOMCustomEvent.idl
@@ -1,17 +1,17 @@
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
interface nsIVariant;
-[builtinclass, uuid(b56ae6ca-c822-489e-be71-2a9f3c56082e)]
+[builtinclass, uuid(55fa3a13-4812-45a7-98b7-3be6cec2df43)]
interface nsIDOMCustomEvent : nsIDOMEvent
{
readonly attribute nsIVariant detail;
void initCustomEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
--- a/dom/interfaces/events/nsIDOMDataContainerEvent.idl
+++ b/dom/interfaces/events/nsIDOMDataContainerEvent.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
#include "nsIVariant.idl"
-[builtinclass, uuid(dc6b39da-87ff-4b6f-b065-b52602602e06)]
+[builtinclass, uuid(31ceb43e-5f49-43bf-9a18-3b60a535c814)]
interface nsIDOMDataContainerEvent : nsIDOMEvent
{
/**
* Return the data associated with the given key.
*
* @param key the key
* @return the data associated with the key
*/
--- a/dom/interfaces/events/nsIDOMDragEvent.idl
+++ b/dom/interfaces/events/nsIDOMDragEvent.idl
@@ -3,17 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsIDOMMouseEvent.idl"
interface nsIDOMDataTransfer;
-[builtinclass, uuid(4d0fe952-7ca7-4730-a163-4454e39ed187)]
+[builtinclass, uuid(12aabbe9-7c70-4bf9-b133-a8d6a120679e)]
interface nsIDOMDragEvent : nsIDOMMouseEvent
{
readonly attribute nsIDOMDataTransfer dataTransfer;
void initDragEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in nsIDOMWindow aView,
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -35,17 +35,17 @@ class EventTarget;
* The nsIDOMEvent interface is the primary datatype for all events in
* the Document Object Model.
*
* For more information on this interface please see
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
-[builtinclass, uuid(63857daf-c084-4ea6-a8b9-6812e3176991)]
+[builtinclass, uuid(f58daacf-4d1a-4002-8fd7-06b614dfbcf6)]
interface nsIDOMEvent : nsISupports
{
// PhaseType
/**
* The event isn't being dispatched.
*/
const unsigned short NONE = 0;
/**
@@ -156,16 +156,17 @@ interface nsIDOMEvent : nsISupports
* recommended that third parties adding their
* own events use their own prefix to avoid
* confusion and lessen the probability of
* conflicts with other new events.
* @param canBubbleArg Specifies whether or not the event can bubble.
* @param cancelableArg Specifies whether or not the event's default
* action can be prevented.
*/
+ [notxpcom]
void initEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
/**
* Used to indicate whether preventDefault() has been called for this event.
*/
readonly attribute boolean defaultPrevented;
--- a/dom/interfaces/events/nsIDOMFocusEvent.idl
+++ b/dom/interfaces/events/nsIDOMFocusEvent.idl
@@ -1,12 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
-[builtinclass, uuid(4faecbd6-1bcd-42d8-bc66-ec6b95050063)]
+[builtinclass, uuid(f2606aee-1801-4e4c-9700-af99e435c02c)]
interface nsIDOMFocusEvent : nsIDOMUIEvent
{
readonly attribute nsIDOMEventTarget relatedTarget;
};
--- a/dom/interfaces/events/nsIDOMKeyEvent.idl
+++ b/dom/interfaces/events/nsIDOMKeyEvent.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
-[builtinclass, uuid(d2b3e35f-8627-4732-a92d-cda54c8f8054)]
+[builtinclass, uuid(f4082a63-73c0-49ad-86e0-c406a54573f7)]
interface nsIDOMKeyEvent : nsIDOMUIEvent
{
const unsigned long DOM_VK_CANCEL = 0x03;
const unsigned long DOM_VK_HELP = 0x06;
const unsigned long DOM_VK_BACK_SPACE = 0x08;
const unsigned long DOM_VK_TAB = 0x09;
const unsigned long DOM_VK_CLEAR = 0x0C;
const unsigned long DOM_VK_RETURN = 0x0D;
--- a/dom/interfaces/events/nsIDOMMessageEvent.idl
+++ b/dom/interfaces/events/nsIDOMMessageEvent.idl
@@ -7,17 +7,17 @@
/**
* The nsIDOMMessageEvent interface is used for server-sent events and for
* cross-domain messaging.
*
* For more information on this interface, please see
* http://www.whatwg.org/specs/web-apps/current-work/#messageevent
*/
-[builtinclass, uuid(bb869a03-5fc0-4a1b-838a-342e5025fc05)]
+[builtinclass, uuid(4408a2f5-614f-40a3-8786-e16bd3f74e32)]
interface nsIDOMMessageEvent : nsIDOMEvent
{
/**
* Custom string data associated with this event.
*/
[implicit_jscontext]
readonly attribute jsval data;
--- a/dom/interfaces/events/nsIDOMMouseEvent.idl
+++ b/dom/interfaces/events/nsIDOMMouseEvent.idl
@@ -8,17 +8,17 @@
/**
* The nsIDOMMouseEvent interface is the datatype for all mouse events
* in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
-[builtinclass, uuid(df068636-9a5b-11e3-b71f-2c27d728e7f9)]
+[builtinclass, uuid(dbebc4be-75c9-47ca-aee8-0a8b4ae14a87)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
readonly attribute long screenX;
readonly attribute long screenY;
readonly attribute long mozMovementX;
readonly attribute long mozMovementY;
--- a/dom/interfaces/events/nsIDOMMouseScrollEvent.idl
+++ b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMMouseEvent.idl"
-[builtinclass, uuid(2bce5c03-5bed-4c22-8a6a-a3ac8f5563d7)]
+[builtinclass, uuid(00404ebe-4598-4c4e-a60a-d7491922f9db)]
interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent
{
const long HORIZONTAL_AXIS = 1;
const long VERTICAL_AXIS = 2;
readonly attribute long axis;
void initMouseScrollEvent(in DOMString typeArg,
--- a/dom/interfaces/events/nsIDOMMutationEvent.idl
+++ b/dom/interfaces/events/nsIDOMMutationEvent.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
-[builtinclass, uuid(982d9800-1402-46e5-8ad2-56fb0f4905ef)]
+[builtinclass, uuid(df7e4cd9-e41f-4c8e-a764-2e3191d2f463)]
interface nsIDOMMutationEvent : nsIDOMEvent
{
const unsigned short MODIFICATION = 1;
const unsigned short ADDITION = 2;
const unsigned short REMOVAL = 3;
readonly attribute nsIDOMNode relatedNode;
readonly attribute DOMString prevValue;
--- a/dom/interfaces/events/nsIDOMNotifyPaintEvent.idl
+++ b/dom/interfaces/events/nsIDOMNotifyPaintEvent.idl
@@ -7,17 +7,17 @@
interface nsIDOMPaintRequestList;
/**
* The nsIDOMNotifyPaintEvent interface is used for the MozDOMAfterPaint
* event, which fires at a window when painting has happened in
* that window.
*/
-[builtinclass, uuid(ef68f0d5-5b55-4198-9e59-a5e2c57d3adc)]
+[builtinclass, uuid(550f660c-65a5-4e17-b828-3dbec7c44304)]
interface nsIDOMNotifyPaintEvent : nsIDOMEvent
{
/**
* Get a list of rectangles which are affected. The rectangles are in CSS pixels
* relative to the viewport origin.
* If the caller is not trusted (e.g., regular Web content) then only painting
* caused by the current document is reported; in particular, painting in subdocuments
* is not reported.
--- a/dom/interfaces/events/nsIDOMScrollAreaEvent.idl
+++ b/dom/interfaces/events/nsIDOMScrollAreaEvent.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
-[builtinclass, uuid(49ab3d1d-f549-4cdb-904c-f6b6d3a0ec9e)]
+[builtinclass, uuid(05aaf2cf-27c3-4d3d-9e55-4c6a4cf700ec)]
interface nsIDOMScrollAreaEvent : nsIDOMUIEvent
{
// Scroll area client rect
readonly attribute float x;
readonly attribute float y;
readonly attribute float width;
readonly attribute float height;
--- a/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
+++ b/dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
@@ -99,17 +99,17 @@
* Default behavior:
*
* Some operating systems support default behaviors for gesture events
* when they are not handled by the application. Consumers should
* use event.preventDefault() to prevent default behavior when
* consuming events.
*/
-[builtinclass, uuid(d78656ab-9d68-4f03-83f9-7c7bee071aa7)]
+[builtinclass, uuid(1b9afbf0-2cf0-4a7b-99bc-cd35dbd5b637)]
interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
{
/* Swipe direction constants */
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
--- a/dom/interfaces/events/nsIDOMTransitionEvent.idl
+++ b/dom/interfaces/events/nsIDOMTransitionEvent.idl
@@ -6,14 +6,14 @@
#include "nsIDOMEvent.idl"
/**
* Transition events are defined in:
* http://www.w3.org/TR/css3-transitions/#transition-events-
* http://dev.w3.org/csswg/css3-transitions/#transition-events-
*/
-[builtinclass, uuid(a37171e0-9f43-41ea-a25c-0b78a3329683)]
+[builtinclass, uuid(acb69403-0dcb-4db0-9ffc-8a22cc56c4eb)]
interface nsIDOMTransitionEvent : nsIDOMEvent {
readonly attribute DOMString propertyName;
readonly attribute float elapsedTime;
readonly attribute DOMString pseudoElement;
};
--- a/dom/interfaces/events/nsIDOMUIEvent.idl
+++ b/dom/interfaces/events/nsIDOMUIEvent.idl
@@ -8,17 +8,17 @@
/**
* The nsIDOMUIEvent interface is the datatype for all UI events in the
* Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
-[builtinclass, uuid(d73852f8-7bd6-477d-8233-117dbf83860b)]
+[builtinclass, uuid(db058d10-1db9-4cf9-bb4c-483c304a137f)]
interface nsIDOMUIEvent : nsIDOMEvent
{
readonly attribute nsIDOMWindow view;
readonly attribute long detail;
void initUIEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in nsIDOMWindow viewArg,
--- a/dom/interfaces/events/nsIDOMWheelEvent.idl
+++ b/dom/interfaces/events/nsIDOMWheelEvent.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMMouseEvent.idl"
-[builtinclass, uuid(86e2b577-7e61-4ed5-8ddd-c1533bf07137)]
+[builtinclass, uuid(f1ca2983-8559-43d1-be0e-1af8331755fd)]
interface nsIDOMWheelEvent : nsIDOMMouseEvent
{
const unsigned long DOM_DELTA_PIXEL = 0x00;
const unsigned long DOM_DELTA_LINE = 0x01;
const unsigned long DOM_DELTA_PAGE = 0x02;
// Note that DOM Level 3 Events defines the type of delta values as float.
// However, we should use double for them. Javascript engine always uses
--- a/dom/interfaces/smil/nsIDOMTimeEvent.idl
+++ b/dom/interfaces/smil/nsIDOMTimeEvent.idl
@@ -8,17 +8,17 @@
/**
* The SMIL TimeEvent interface.
*
* For more information please refer to:
* http://www.w3.org/TR/SMIL/smil-timing.html#Events-TimeEvent
* http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
*/
-[builtinclass, uuid(4a5a5fa6-2783-4171-b8bb-cae4ab06e6ff)]
+[builtinclass, uuid(7a1dc95e-2c05-4171-8bde-275f094dda1d)]
interface nsIDOMTimeEvent : nsIDOMEvent
{
readonly attribute long detail;
readonly attribute nsIDOMWindow view;
void initTimeEvent(in DOMString typeArg,
in nsIDOMWindow viewArg,
in long detailArg);
--- a/dom/interfaces/xul/nsIDOMXULCommandEvent.idl
+++ b/dom/interfaces/xul/nsIDOMXULCommandEvent.idl
@@ -6,17 +6,17 @@
/**
* This interface is supported by command events, which are dispatched to
* XUL elements as a result of mouse or keyboard activation.
*/
#include "nsIDOMUIEvent.idl"
-[builtinclass, uuid(2d5b6e19-74bb-40af-9aac-59a1e53e3fcc)]
+[builtinclass, uuid(8aa1b009-4a88-4c85-bfba-87ee32fd789f)]
interface nsIDOMXULCommandEvent : nsIDOMUIEvent
{
/**
* Command events support the same set of modifier keys as mouse and key
* events.
*/
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -1070,23 +1070,17 @@ MediaRecorder::DispatchSimpleEvent(const
{
MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
nsresult rv = CheckInnerWindowCorrectness();
if (NS_FAILED(rv)) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- rv = event->InitEvent(aStr, false, false);
-
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to init the error event!!!");
- return;
- }
-
+ event->InitEvent(aStr, false, false);
event->SetTrusted(true);
rv = DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (NS_FAILED(rv)) {
NS_ERROR("Failed to dispatch the event!!!");
return;
}
}
--- a/dom/media/TextTrackList.cpp
+++ b/dom/media/TextTrackList.cpp
@@ -160,22 +160,17 @@ TextTrackList::DispatchTrackEvent(nsIDOM
return DispatchTrustedEvent(aEvent);
}
void
TextTrackList::CreateAndDispatchChangeEvent()
{
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("change"), false, false);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to init the change event!");
- return;
- }
-
+ event->InitEvent(NS_LITERAL_STRING("change"), false, false);
event->SetTrusted(true);
nsCOMPtr<nsIRunnable> eventRunner = new TrackEventRunner(this, event);
NS_DispatchToMainThread(eventRunner);
}
void
TextTrackList::CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
--- a/dom/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp
@@ -865,19 +865,18 @@ SpeechRecognition::DispatchError(EventTy
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aErrorType == EVENT_RECOGNITIONSERVICE_ERROR ||
aErrorType == EVENT_AUDIO_ERROR, "Invalid error type!");
RefPtr<SpeechRecognitionError> srError =
new SpeechRecognitionError(nullptr, nullptr, nullptr);
- ErrorResult err;
srError->InitSpeechRecognitionError(NS_LITERAL_STRING("error"), true, false,
- aErrorCode, aMessage, err);
+ aErrorCode, aMessage);
RefPtr<SpeechEvent> event = new SpeechEvent(this, aErrorType);
event->mError = srError;
NS_DispatchToMainThread(event);
}
/*
* Buffer audio samples into mAudioSamplesBuffer until aBufferSize.
--- a/dom/network/TCPServerSocket.cpp
+++ b/dom/network/TCPServerSocket.cpp
@@ -154,18 +154,17 @@ TCPServerSocket::OnSocketAccepted(nsISer
return NS_OK;
}
NS_IMETHODIMP
TCPServerSocket::OnStopListening(nsIServerSocket* aServer, nsresult aStatus)
{
if (aStatus != NS_BINDING_ABORTED) {
RefPtr<Event> event = new Event(GetOwner());
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("error"), false, false);
- NS_ENSURE_SUCCESS(rv, rv);
+ event->InitEvent(NS_LITERAL_STRING("error"), false, false);
event->SetTrusted(true);
bool dummy;
DispatchEvent(event, &dummy);
NS_WARNING("Server socket was closed by unexpected reason.");
return NS_ERROR_FAILURE;
}
mServerSocket = nullptr;
--- a/dom/notification/DesktopNotification.cpp
+++ b/dom/notification/DesktopNotification.cpp
@@ -170,20 +170,17 @@ void
DesktopNotification::DispatchNotificationEvent(const nsString& aName)
{
if (NS_FAILED(CheckInnerWindowCorrectness())) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
// it doesn't bubble, and it isn't cancelable
- nsresult rv = event->InitEvent(aName, false, false);
- if (NS_FAILED(rv)) {
- return;
- }
+ event->InitEvent(aName, false, false);
event->SetTrusted(true);
DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
nsresult
DesktopNotification::SetAllow(bool aAllow)
{
mAllow = aAllow;
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -1105,18 +1105,17 @@ Notification::DispatchNotificationClickE
return false;
}
bool
Notification::DispatchClickEvent()
{
AssertIsOnTargetThread();
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("click"), false, true);
- NS_ENSURE_SUCCESS(rv, false);
+ event->InitEvent(NS_LITERAL_STRING("click"), false, true);
event->SetTrusted(true);
WantsPopupControlCheck popupControlCheck(event);
bool doDefaultAction = true;
DispatchEvent(event, &doDefaultAction);
return doDefaultAction;
}
// Overrides dispatch and run handlers so we can directly dispatch from main
--- a/dom/smil/TimeEvent.cpp
+++ b/dom/smil/TimeEvent.cpp
@@ -59,19 +59,18 @@ TimeEvent::GetDetail(int32_t* aDetail)
return NS_OK;
}
NS_IMETHODIMP
TimeEvent::InitTimeEvent(const nsAString& aTypeArg,
nsIDOMWindow* aViewArg,
int32_t aDetailArg)
{
- nsresult rv = Event::InitEvent(aTypeArg, false /*doesn't bubble*/,
- false /*can't cancel*/);
- NS_ENSURE_SUCCESS(rv, rv);
+ Event::InitEvent(aTypeArg, false /*doesn't bubble*/,
+ false /*can't cancel*/);
mDetail = aDetailArg;
mView = aViewArg;
return NS_OK;
}
} // namespace dom
--- a/dom/smil/TimeEvent.h
+++ b/dom/smil/TimeEvent.h
@@ -42,22 +42,16 @@ public:
return mDetail;
}
nsIDOMWindow* GetView() const
{
return mView;
}
- void InitTimeEvent(const nsAString& aType, nsIDOMWindow* aView,
- int32_t aDetail, ErrorResult& aRv)
- {
- aRv = InitTimeEvent(aType, aView, aDetail);
- }
-
private:
~TimeEvent() {}
nsCOMPtr<nsIDOMWindow> mView;
int32_t mDetail;
};
} // namespace dom
--- a/dom/system/nsDeviceSensors.cpp
+++ b/dom/system/nsDeviceSensors.cpp
@@ -382,25 +382,23 @@ nsDeviceSensors::FireDOMMotionEvent(nsID
return;
}
nsCOMPtr<nsIDOMEvent> event;
domdoc->CreateEvent(NS_LITERAL_STRING("DeviceMotionEvent"), getter_AddRefs(event));
DeviceMotionEvent* me = static_cast<DeviceMotionEvent*>(event.get());
- ErrorResult rv;
me->InitDeviceMotionEvent(NS_LITERAL_STRING("devicemotion"),
true,
false,
*mLastAcceleration,
*mLastAccelerationIncludingGravity,
*mLastRotationRate,
- Nullable<double>(DEFAULT_SENSOR_POLL),
- rv);
+ Nullable<double>(DEFAULT_SENSOR_POLL));
event->SetTrusted(true);
bool defaultActionEnabled = true;
target->DispatchEvent(event, &defaultActionEnabled);
mLastRotationRate.reset();
mLastAccelerationIncludingGravity.reset();
--- a/dom/webidl/CompositionEvent.webidl
+++ b/dom/webidl/CompositionEvent.webidl
@@ -12,16 +12,15 @@
interface CompositionEvent : UIEvent
{
readonly attribute DOMString? data;
readonly attribute DOMString locale;
};
partial interface CompositionEvent
{
- [Throws]
void initCompositionEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Window? viewArg,
DOMString? dataArg,
DOMString localeArg);
};
--- a/dom/webidl/DeviceMotionEvent.webidl
+++ b/dom/webidl/DeviceMotionEvent.webidl
@@ -42,17 +42,16 @@ dictionary DeviceMotionEventInit : Event
DeviceAccelerationInit acceleration;
DeviceAccelerationInit accelerationIncludingGravity;
DeviceRotationRateInit rotationRate;
double? interval = null;
};
// Mozilla extensions.
partial interface DeviceMotionEvent {
- [Throws]
void initDeviceMotionEvent(DOMString type,
boolean canBubble,
boolean cancelable,
DeviceAccelerationInit acceleration,
DeviceAccelerationInit accelerationIncludingGravity,
DeviceRotationRateInit rotationRate,
double? interval);
};
--- a/dom/webidl/DeviceOrientationEvent.webidl
+++ b/dom/webidl/DeviceOrientationEvent.webidl
@@ -8,17 +8,16 @@
interface DeviceOrientationEvent : Event
{
readonly attribute double? alpha;
readonly attribute double? beta;
readonly attribute double? gamma;
readonly attribute boolean absolute;
// initDeviceOrientationEvent is a Gecko specific deprecated method.
- [Throws]
void initDeviceOrientationEvent(DOMString type,
boolean canBubble,
boolean cancelable,
double? alpha,
double? beta,
double? gamma,
boolean absolute);
};
--- a/dom/webidl/DragEvent.webidl
+++ b/dom/webidl/DragEvent.webidl
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString type, optional DragEventInit eventInitDict)]
interface DragEvent : MouseEvent
{
readonly attribute DataTransfer? dataTransfer;
- [Throws]
void initDragEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? aView,
long aDetail,
long aScreenX,
long aScreenY,
long aClientX,
--- a/dom/webidl/Event.webidl
+++ b/dom/webidl/Event.webidl
@@ -38,17 +38,16 @@ interface Event {
[Pure]
readonly attribute boolean defaultPrevented;
[Unforgeable, Pure]
readonly attribute boolean isTrusted;
[Pure]
readonly attribute DOMHighResTimeStamp timeStamp;
- [Throws]
void initEvent(DOMString type, boolean bubbles, boolean cancelable);
};
// Mozilla specific legacy stuff.
partial interface Event {
const long ALT_MASK = 0x00000001;
const long CONTROL_MASK = 0x00000002;
const long SHIFT_MASK = 0x00000004;
--- a/dom/webidl/HashChangeEvent.webidl
+++ b/dom/webidl/HashChangeEvent.webidl
@@ -5,17 +5,16 @@
*/
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict), LegacyEventInit]
interface HashChangeEvent : Event
{
readonly attribute DOMString? oldURL;
readonly attribute DOMString? newURL;
- [Throws]
void initHashChangeEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
DOMString? oldURLArg,
DOMString? newURLArg);
};
dictionary HashChangeEventInit : EventInit
--- a/dom/webidl/KeyEvent.webidl
+++ b/dom/webidl/KeyEvent.webidl
@@ -219,17 +219,16 @@ interface KeyEvent
const unsigned long DOM_VK_PLAY = 0xFA;
const unsigned long DOM_VK_ZOOM = 0xFB;
const unsigned long DOM_VK_PA1 = 0xFD;
// OEM specific virtual keyCode of Windows should pass through DOM keyCode
// for compatibility with the other web browsers on Windows.
const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE;
- [Throws]
void initKeyEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? view,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
boolean metaKey,
--- a/dom/webidl/MessageEvent.webidl
+++ b/dom/webidl/MessageEvent.webidl
@@ -37,17 +37,16 @@ interface MessageEvent : Event {
/**
* Initializes this event with the given data, in a manner analogous to
* the similarly-named method on the nsIDOMEvent interface, also setting the
* data, origin, source, and lastEventId attributes of this appropriately.
*/
readonly attribute MessagePortList? ports;
- [Throws]
void initMessageEvent(DOMString type, boolean bubbles, boolean cancelable,
any data, DOMString origin, DOMString lastEventId,
(WindowProxy or MessagePort)? source,
sequence<MessagePort>? ports);
};
dictionary MessageEventInit : EventInit {
any data;
--- a/dom/webidl/MouseEvent.webidl
+++ b/dom/webidl/MouseEvent.webidl
@@ -27,17 +27,16 @@ interface MouseEvent : UIEvent {
readonly attribute EventTarget? relatedTarget;
readonly attribute DOMString? region;
// Pointer Lock
readonly attribute long movementX;
readonly attribute long movementY;
// Deprecated in DOM Level 3:
- [Throws]
void initMouseEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Window? viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
@@ -86,17 +85,16 @@ partial interface MouseEvent
const unsigned short MOZ_SOURCE_PEN = 2;
const unsigned short MOZ_SOURCE_ERASER = 3;
const unsigned short MOZ_SOURCE_CURSOR = 4;
const unsigned short MOZ_SOURCE_TOUCH = 5;
const unsigned short MOZ_SOURCE_KEYBOARD = 6;
readonly attribute unsigned short mozInputSource;
- [Throws]
void initNSMouseEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Window? viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
--- a/dom/webidl/MouseScrollEvent.webidl
+++ b/dom/webidl/MouseScrollEvent.webidl
@@ -6,17 +6,16 @@
interface MouseScrollEvent : MouseEvent
{
const long HORIZONTAL_AXIS = 1;
const long VERTICAL_AXIS = 2;
readonly attribute long axis;
- [Throws]
void initMouseScrollEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? view,
long detail,
long screenX,
long screenY,
long clientX,
--- a/dom/webidl/ScrollAreaEvent.webidl
+++ b/dom/webidl/ScrollAreaEvent.webidl
@@ -6,17 +6,16 @@
interface ScrollAreaEvent : UIEvent
{
readonly attribute float x;
readonly attribute float y;
readonly attribute float width;
readonly attribute float height;
- [Throws]
void initScrollAreaEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? view,
long detail,
float x,
float y,
float width,
--- a/dom/webidl/SimpleGestureEvent.webidl
+++ b/dom/webidl/SimpleGestureEvent.webidl
@@ -19,17 +19,16 @@ interface SimpleGestureEvent : MouseEven
attribute unsigned long allowedDirections;
readonly attribute unsigned long direction;
readonly attribute double delta;
readonly attribute unsigned long clickCount;
- [Throws]
void initSimpleGestureEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Window? viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
--- a/dom/webidl/StorageEvent.webidl
+++ b/dom/webidl/StorageEvent.webidl
@@ -15,17 +15,16 @@ interface StorageEvent : Event
{
readonly attribute DOMString? key;
readonly attribute DOMString? oldValue;
readonly attribute DOMString? newValue;
readonly attribute DOMString? url;
readonly attribute Storage? storageArea;
// Bug 1016053 - This is not spec compliant.
- [Throws]
void initStorageEvent(DOMString type,
boolean canBubble,
boolean cancelable,
DOMString? key,
DOMString? oldValue,
DOMString? newValue,
DOMString? url,
Storage? storageArea);
--- a/dom/webidl/TouchEvent.webidl
+++ b/dom/webidl/TouchEvent.webidl
@@ -10,17 +10,16 @@ interface TouchEvent : UIEvent {
readonly attribute TouchList targetTouches;
readonly attribute TouchList changedTouches;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
- [Throws]
void initTouchEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? view,
long detail,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
--- a/dom/webidl/XULCommandEvent.webidl
+++ b/dom/webidl/XULCommandEvent.webidl
@@ -9,17 +9,16 @@ interface XULCommandEvent : UIEvent
{
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute Event? sourceEvent;
- [Throws]
void initCommandEvent(DOMString type,
boolean canBubble,
boolean cancelable,
Window? view,
long detail,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
--- a/dom/workers/ServiceWorkerMessageEvent.cpp
+++ b/dom/workers/ServiceWorkerMessageEvent.cpp
@@ -137,20 +137,17 @@ ServiceWorkerMessageEvent::Constructor(c
ServiceWorkerMessageEvent::Constructor(EventTarget* aEventTarget,
const nsAString& aType,
const ServiceWorkerMessageEventInit& aParam,
ErrorResult& aRv)
{
RefPtr<ServiceWorkerMessageEvent> event =
new ServiceWorkerMessageEvent(aEventTarget, nullptr, nullptr);
- aRv = event->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
- if (NS_WARN_IF(aRv.Failed())) {
- return nullptr;
- }
+ event->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
bool trusted = event->Init(aEventTarget);
event->SetTrusted(trusted);
event->mData = aParam.mData;
if (aParam.mOrigin.WasPassed()) {
event->mOrigin = aParam.mOrigin.Value();
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -567,22 +567,17 @@ private:
NS_ASSERTION(target, "This must never be null!");
aWorkerPrivate->CloseHandlerStarted();
WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope();
RefPtr<Event> event = NS_NewDOMEvent(globalScope, nullptr, nullptr);
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("close"), false, false);
- if (NS_FAILED(rv)) {
- Throw(aCx, rv);
- return false;
- }
-
+ event->InitEvent(NS_LITERAL_STRING("close"), false, false);
event->SetTrusted(true);
globalScope->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
return true;
}
NS_IMETHOD Cancel() override
@@ -3068,19 +3063,17 @@ WorkerPrivate::OfflineStatusChangeEventI
if (aIsOffline) {
eventType.AssignLiteral("offline");
} else {
eventType.AssignLiteral("online");
}
RefPtr<Event> event = NS_NewDOMEvent(globalScope, nullptr, nullptr);
- nsresult rv = event->InitEvent(eventType, false, false);
- NS_ENSURE_SUCCESS_VOID(rv);
-
+ event->InitEvent(eventType, false, false);
event->SetTrusted(true);
globalScope->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
}
template <class Derived>
bool
WorkerPrivateParent<Derived>::RegisterSharedWorker(JSContext* aCx,
--- a/embedding/components/windowwatcher/nsAutoWindowStateHelper.cpp
+++ b/embedding/components/windowwatcher/nsAutoWindowStateHelper.cpp
@@ -56,19 +56,17 @@ nsAutoWindowStateHelper::DispatchEventTo
return true;
}
ErrorResult rv;
RefPtr<Event> event = doc->CreateEvent(NS_LITERAL_STRING("Events"), rv);
if (rv.Failed()) {
return false;
}
- NS_ENSURE_TRUE(NS_SUCCEEDED(event->InitEvent(
- NS_ConvertASCIItoUTF16(aEventName), true, true)),
- false);
+ event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), true, true);
event->SetTrusted(true);
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
nsCOMPtr<EventTarget> target = do_QueryInterface(mWindow);
bool defaultActionEnabled;
target->DispatchEvent(event, &defaultActionEnabled);
return defaultActionEnabled;
}
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1059,16 +1059,17 @@ nsDocumentViewer::PermitUnload(bool *aPe
nsresult
nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
bool *aPermitUnload)
{
AutoDontWarnAboutSyncXHR disableSyncXHRWarning;
+ nsresult rv = NS_OK;
*aPermitUnload = true;
if (!mDocument
|| mInPermitUnload
|| mInPermitUnloadPrompt) {
return NS_OK;
}
@@ -1098,19 +1099,17 @@ nsDocumentViewer::PermitUnloadInternal(b
// Now, fire an BeforeUnload event to the document and see if it's ok
// to unload...
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
nsCOMPtr<nsIDOMEvent> event;
domDoc->CreateEvent(NS_LITERAL_STRING("beforeunloadevent"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMBeforeUnloadEvent> beforeUnload = do_QueryInterface(event);
NS_ENSURE_STATE(beforeUnload);
- nsresult rv = event->InitEvent(NS_LITERAL_STRING("beforeunload"),
- false, true);
- NS_ENSURE_SUCCESS(rv, rv);
+ event->InitEvent(NS_LITERAL_STRING("beforeunload"), false, true);
// Dispatching to |window|, but using |document| as the target.
event->SetTarget(mDocument);
event->SetTrusted(true);
// In evil cases we might be destroyed while handling the
// onbeforeunload event, don't let that happen. (see also bug#331040)
RefPtr<nsDocumentViewer> kungFuDeathGrip(this);