Bug 833278 - Part 2/2: Implement MozVoicemailEvent using codegenerator. r=gwagner,smaug
authorVicamo Yang <vyang@mozilla.com>
Tue, 05 Feb 2013 17:02:18 +0800
changeset 130726 1057dfda57a5d820900b15689eef9717442f5bb8
parent 130725 4f741c36cc20f3509c1b473830f89c7822f2bff2
child 130727 fbdf53493d31f51b1d336abe90e4cea5da8e0e65
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner, smaug
bugs833278
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 833278 - Part 2/2: Implement MozVoicemailEvent using codegenerator. r=gwagner,smaug
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/voicemail/Makefile.in
dom/voicemail/Voicemail.cpp
dom/voicemail/VoicemailEvent.cpp
dom/voicemail/VoicemailEvent.h
dom/voicemail/nsIDOMMozVoicemailEvent.idl
js/xpconnect/src/event_impl_gen.conf.in
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -433,17 +433,16 @@ using mozilla::dom::workers::ResolveWork
 #include "USSDReceivedEvent.h"
 #include "DataErrorEvent.h"
 #include "mozilla/dom/network/Utils.h"
 
 #ifdef MOZ_B2G_RIL
 #include "Telephony.h"
 #include "TelephonyCall.h"
 #include "nsIDOMMozVoicemail.h"
-#include "nsIDOMMozVoicemailEvent.h"
 #include "nsIDOMIccManager.h"
 #include "StkCommandEvent.h"
 #include "nsIDOMMozCellBroadcast.h"
 #include "nsIDOMMozCellBroadcastEvent.h"
 #include "CFStateChangeEvent.h"
 #endif // MOZ_B2G_RIL
 
 #ifdef MOZ_B2G_FM
@@ -1419,18 +1418,16 @@ static nsDOMClassInfoData sClassInfoData
 
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_CLASSINFO_DATA(Telephony, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(TelephonyCall, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozVoicemail, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(MozVoicemailEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozIccManager, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozStkCommandEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
 #ifdef MOZ_B2G_FM
   NS_DEFINE_CLASSINFO_DATA(FMRadio, nsEventTargetSH,
@@ -3678,21 +3675,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozVoicemail, nsIDOMMozVoicemail)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozVoicemail)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(MozVoicemailEvent, nsIDOMMozVoicemailEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozVoicemailEvent)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(MozIccManager, nsIDOMMozIccManager)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozIccManager)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozStkCommandEvent, nsIDOMMozStkCommandEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozStkCommandEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -402,17 +402,16 @@ DOMCI_CLASS(MozCSSKeyframesRule)
 DOMCI_CLASS(CSSPageRule)
 
 DOMCI_CLASS(MediaQueryList)
 
 #ifdef MOZ_B2G_RIL
 DOMCI_CLASS(Telephony)
 DOMCI_CLASS(TelephonyCall)
 DOMCI_CLASS(MozVoicemail)
-DOMCI_CLASS(MozVoicemailEvent)
 DOMCI_CLASS(MozIccManager)
 DOMCI_CLASS(MozStkCommandEvent)
 #endif
 
 #ifdef MOZ_B2G_FM
 DOMCI_CLASS(FMRadio)
 #endif
 
--- a/dom/voicemail/Makefile.in
+++ b/dom/voicemail/Makefile.in
@@ -20,17 +20,16 @@ include $(topsrcdir)/dom/dom-config.mk
 
 EXPORTS_NAMESPACES = mozilla/dom
 EXPORTS_mozilla/dom = \
   Voicemail.h \
   $(NULL)
 
 CPPSRCS = \
   Voicemail.cpp \
-  VoicemailEvent.cpp \
   $(NULL)
 
 XPIDLSRCS = \
   nsINavigatorVoicemail.idl \
   nsIDOMMozVoicemail.idl \
   nsIDOMMozVoicemailEvent.idl \
   nsIDOMMozVoicemailStatus.idl \
   $(NULL)
--- a/dom/voicemail/Voicemail.cpp
+++ b/dom/voicemail/Voicemail.cpp
@@ -1,24 +1,24 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=40: */
 /* 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 "Voicemail.h"
 #include "nsIDOMMozVoicemailStatus.h"
+#include "nsIDOMMozVoicemailEvent.h"
 
 #include "mozilla/Services.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsRadioInterfaceLayer.h"
 #include "nsServiceManagerUtils.h"
-
-#include "VoicemailEvent.h"
+#include "GeneratedEvents.h"
 
 DOMCI_DATA(MozVoicemail, mozilla::dom::Voicemail)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED_0(Voicemail, nsDOMEventTargetHelper)
 
@@ -88,22 +88,25 @@ Voicemail::GetDisplayName(nsAString& aDi
 
 NS_IMPL_EVENT_HANDLER(Voicemail, statuschanged)
 
 // nsIRILVoicemailCallback
 
 NS_IMETHODIMP
 Voicemail::VoicemailNotification(nsIDOMMozVoicemailStatus* aStatus)
 {
-  nsRefPtr<VoicemailEvent> event = new VoicemailEvent(nullptr, nullptr);
-  nsresult rv = event->InitVoicemailEvent(NS_LITERAL_STRING("statuschanged"),
+  nsCOMPtr<nsIDOMEvent> event;
+  NS_NewDOMMozVoicemailEvent(getter_AddRefs(event), nullptr, nullptr);
+
+  nsCOMPtr<nsIDOMMozVoicemailEvent> ce = do_QueryInterface(event);
+  nsresult rv = ce->InitMozVoicemailEvent(NS_LITERAL_STRING("statuschanged"),
                                           false, false, aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return DispatchTrustedEvent(static_cast<nsIDOMMozVoicemailEvent*>(event));
+  return DispatchTrustedEvent(ce);
 }
 
 } // namespace dom
 } // namespace mozilla
 
 nsresult
 NS_NewVoicemail(nsPIDOMWindow* aWindow, nsIDOMMozVoicemail** aVoicemail)
 {
deleted file mode 100644
--- a/dom/voicemail/VoicemailEvent.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- 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 "VoicemailEvent.h"
-#include "nsDOMClassInfo.h"
-#include "nsIDOMMozVoicemailStatus.h"
-
-DOMCI_DATA(MozVoicemailEvent, mozilla::dom::VoicemailEvent)
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(VoicemailEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mStatus)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(VoicemailEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStatus)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(VoicemailEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMozVoicemailEvent)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozVoicemailEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
-
-NS_IMPL_ADDREF_INHERITED(VoicemailEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(VoicemailEvent, nsDOMEvent)
-
-nsresult
-VoicemailEvent::InitVoicemailEvent(const nsAString& aEventTypeArg,
-                                   bool aCanBubbleArg, bool aCancelableArg,
-                                   nsIDOMMozVoicemailStatus* aStatus)
-{
-  nsresult rv = nsDOMEvent::InitEvent(aEventTypeArg, aCanBubbleArg,
-                                      aCancelableArg);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mStatus = aStatus;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-VoicemailEvent::GetStatus(nsIDOMMozVoicemailStatus** aStatus)
-{
-  NS_IF_ADDREF(*aStatus = mStatus);
-  return NS_OK;
-}
-
-} // namespace dom
-} // namespace mozilla
-
-namespace {
-
-nsresult
-NS_NewDOMVoicemailEvent(nsIDOMEvent** aInstancePtrResult,
-                  nsPresContext* aPresContext,
-                  nsEvent* aEvent)
-{
-  return CallQueryInterface(
-    new mozilla::dom::VoicemailEvent(aPresContext, aEvent),
-    aInstancePtrResult);
-}
-
-}
deleted file mode 100644
--- a/dom/voicemail/VoicemailEvent.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_dom_voicemail_VoicemailEvent_h__
-#define mozilla_dom_voicemail_VoicemailEvent_h__
-
-#include "nsIDOMMozVoicemailEvent.h"
-#include "nsDOMEvent.h"
-
-class nsIDOMMozVoicemailStatus;
-
-namespace mozilla {
-namespace dom {
-
-class VoicemailEvent : public nsIDOMMozVoicemailEvent,
-                       public nsDOMEvent
-{
-public:
-  VoicemailEvent(nsPresContext* aPresContext, nsEvent* aEvent)
-    : nsDOMEvent(aPresContext, aEvent) { }
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMMOZVOICEMAILEVENT
-
-  NS_FORWARD_TO_NSDOMEVENT
-
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(VoicemailEvent, nsDOMEvent)
-
-  nsresult InitVoicemailEvent(const nsAString& aEventTypeArg,
-                              bool aCanBubbleArg, bool aCancelableArg,
-                              nsIDOMMozVoicemailStatus* aStatus);
-
-private:
-  nsCOMPtr<nsIDOMMozVoicemailStatus> mStatus;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_voicemail_VoicemailEvent_h__
--- a/dom/voicemail/nsIDOMMozVoicemailEvent.idl
+++ b/dom/voicemail/nsIDOMMozVoicemailEvent.idl
@@ -3,16 +3,26 @@
 /* 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 nsIDOMMozVoicemailStatus;
 
-[scriptable, builtinclass, uuid(8fd09b8e-1572-48ff-8719-f8f179afef4b)]
+[scriptable, builtinclass, uuid(63e42e5f-0742-4c8f-bd52-938a7e03d2c9)]
 interface nsIDOMMozVoicemailEvent : nsIDOMEvent
 {
   /**
    * The voicemail status that caused this event to fire
    */
   readonly attribute nsIDOMMozVoicemailStatus status;
+
+  [noscript] void initMozVoicemailEvent(in DOMString aType,
+                                        in boolean aCanBubble,
+                                        in boolean aCancelable,
+                                        in nsIDOMMozVoicemailStatus aStatus);
 };
+
+dictionary MozVoicemailEventInit : EventInit
+{
+  nsIDOMMozVoicemailStatus status;
+};
--- a/js/xpconnect/src/event_impl_gen.conf.in
+++ b/js/xpconnect/src/event_impl_gen.conf.in
@@ -28,16 +28,17 @@ simple_events = [
     'BluetoothDeviceAddressEvent',
 #endif
 #ifdef MOZ_B2G_RIL
     'CallEvent',
     'ICCCardLockErrorEvent',
     'MozWifiStatusChangeEvent',
     'MozWifiConnectionInfoEvent',
     'MozCellBroadcastEvent',
+    'MozVoicemailEvent',
 #endif
     'DeviceStorageChangeEvent',
     'PopupBlockedEvent'
   ]
 
 """ include file names """
 special_includes = [
     'DictionaryHelpers.h',