mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1124261, part 2 - Make NS_NewXBLEventHandler infallible. r=smaug
This commit is contained in:
parent
2e40389e4b
commit
69b2819df2
@ -160,30 +160,26 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOMEvent* aEvent)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsXBLEventHandler>
|
||||
NS_NewXBLEventHandler(nsXBLPrototypeHandler* aHandler,
|
||||
nsIAtom* aEventType,
|
||||
nsXBLEventHandler** aResult)
|
||||
nsIAtom* aEventType)
|
||||
{
|
||||
nsRefPtr<nsXBLEventHandler> handler;
|
||||
|
||||
switch (nsContentUtils::GetEventClassID(nsDependentAtomString(aEventType))) {
|
||||
case eDragEventClass:
|
||||
case eMouseEventClass:
|
||||
case eMouseScrollEventClass:
|
||||
case eWheelEventClass:
|
||||
case eSimpleGestureEventClass:
|
||||
*aResult = new nsXBLMouseEventHandler(aHandler);
|
||||
handler = new nsXBLMouseEventHandler(aHandler);
|
||||
break;
|
||||
default:
|
||||
*aResult = new nsXBLEventHandler(aHandler);
|
||||
handler = new nsXBLEventHandler(aHandler);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
return handler.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -113,10 +113,9 @@ private:
|
||||
bool mUsingContentXBLScope;
|
||||
};
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsXBLEventHandler>
|
||||
NS_NewXBLEventHandler(nsXBLPrototypeHandler* aHandler,
|
||||
nsIAtom* aEventType,
|
||||
nsXBLEventHandler** aResult);
|
||||
nsIAtom* aEventType);
|
||||
|
||||
nsresult
|
||||
NS_NewXBLKeyEventHandler(nsIAtom* aEventType, uint8_t aPhase,
|
||||
|
@ -132,8 +132,7 @@ public:
|
||||
nsXBLEventHandler* GetEventHandler()
|
||||
{
|
||||
if (!mHandler) {
|
||||
NS_NewXBLEventHandler(this, mEventName, getter_AddRefs(mHandler));
|
||||
// XXX Need to signal out of memory?
|
||||
mHandler = NS_NewXBLEventHandler(this, mEventName);
|
||||
}
|
||||
|
||||
return mHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user