Bug 777285 - Autogenerate SettingsEvent implementation, r=anygregor
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 01 Aug 2012 12:48:35 +0300
changeset 101073 f6daa7cc4dd93c1a6d7e7847f2df86371ede6383
parent 101072 bcfaabb6bac8b4fea120206de9ca70496b96b43a
child 101074 476a189f5cda075980415dd9b819d007cb0520bc
push id23209
push useropettay@mozilla.com
push dateWed, 01 Aug 2012 10:24:52 +0000
treeherdermozilla-central@f6daa7cc4dd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanygregor
bugs777285
milestone17.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 777285 - Autogenerate SettingsEvent implementation, r=anygregor
content/events/src/Makefile.in
content/events/src/nsDOMSettingsEvent.cpp
content/events/src/nsDOMSettingsEvent.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/settings/Makefile.in
dom/interfaces/settings/nsIDOMMozSettingsEvent.idl
dom/interfaces/settings/nsIDOMSettingsManager.idl
js/xpconnect/src/dictionary_helper_gen.conf
js/xpconnect/src/event_impl_gen.conf.in
--- a/content/events/src/Makefile.in
+++ b/content/events/src/Makefile.in
@@ -55,17 +55,16 @@ CPPSRCS		= \
 		nsDOMNotifyPaintEvent.cpp \
 		nsDOMNotifyAudioAvailableEvent.cpp \
 		nsDOMSimpleGestureEvent.cpp \
 		nsDOMMozTouchEvent.cpp \
 		nsDOMEventTargetHelper.cpp \
 		nsDOMScrollAreaEvent.cpp \
 		nsDOMTransitionEvent.cpp \
 		nsDOMAnimationEvent.cpp \
-		nsDOMSettingsEvent.cpp \
 		nsDOMTouchEvent.cpp \
 		nsDOMCompositionEvent.cpp \
 		$(NULL)
 
 ifdef MOZ_B2G_RIL
 CPPSRCS += \
     nsDOMWifiEvent.cpp \
     $(NULL)
deleted file mode 100644
--- a/content/events/src/nsDOMSettingsEvent.cpp
+++ /dev/null
@@ -1,77 +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 "nsDOMClassInfoID.h"
-#include "nsDOMSettingsEvent.h"
-#include "DictionaryHelpers.h"
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMozSettingsEvent)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSettingValue)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSettingValue)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-DOMCI_DATA(MozSettingsEvent, nsDOMMozSettingsEvent)
-
-NS_INTERFACE_MAP_BEGIN(nsDOMMozSettingsEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMozSettingsEvent)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSettingsEvent)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
-
-NS_IMPL_ADDREF_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
-
-NS_IMETHODIMP
-nsDOMMozSettingsEvent::GetSettingName(nsAString & aSettingName)
-{
-  aSettingName = mSettingName;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMMozSettingsEvent::GetSettingValue(nsIVariant** aSettingValue)
-{
-  NS_IF_ADDREF(*aSettingValue = mSettingValue);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMMozSettingsEvent::InitMozSettingsEvent(const nsAString& aType,
-                                            bool aCanBubble,
-                                            bool aCancelable,
-                                            const nsAString &aSettingName,
-                                            nsIVariant *aSettingValue)
-{
-  nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mSettingName = aSettingName;
-  mSettingValue = aSettingValue;
-
-  return NS_OK;
-}
-
-nsresult
-nsDOMMozSettingsEvent::InitFromCtor(const nsAString& aType,
-                                    JSContext* aCx, jsval* aVal)
-{
-  mozilla::dom::MozSettingsEventInit d;
-  nsresult rv = d.Init(aCx, aVal);
-  NS_ENSURE_SUCCESS(rv, rv);
-  return InitMozSettingsEvent(aType, d.bubbles, d.cancelable, d.settingName, d.settingValue);
-}
-
-nsresult
-NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
-                          nsPresContext* aPresContext,
-                          nsEvent* aEvent) 
-{
-  nsDOMMozSettingsEvent* e = new nsDOMMozSettingsEvent(aPresContext, aEvent);
-  return CallQueryInterface(e, aInstancePtrResult);
-}
deleted file mode 100644
--- a/content/events/src/nsDOMSettingsEvent.h
+++ /dev/null
@@ -1,33 +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 nsDOMSettingsEvent_h__
-#define nsDOMSettingsEvent_h__
-
-#include "nsIDOMSettingsManager.h"
-#include "nsDOMEvent.h"
-
-class nsDOMMozSettingsEvent : public nsDOMEvent,
-                              public nsIDOMMozSettingsEvent
-{
-public:
-  nsDOMMozSettingsEvent(nsPresContext* aPresContext, nsEvent* aEvent)
-    : nsDOMEvent(aPresContext, aEvent) {}
-                     
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMMozSettingsEvent, nsDOMEvent)
-  // Forward to base class
-  NS_FORWARD_TO_NSDOMEVENT
-
-  NS_DECL_NSIDOMMOZSETTINGSEVENT
-
-  virtual nsresult InitFromCtor(const nsAString& aType,
-                                JSContext* aCx, jsval* aVal);
-private:
-  nsString mSettingName;
-  nsCOMPtr<nsIVariant> mSettingValue;
-};
-
-#endif // nsDOMSettingsEvent_h__
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1637,18 +1637,16 @@ static nsDOMClassInfoData sClassInfoData
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MediaQueryList, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MutationObserver, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MutationRecord, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(MozSettingsEvent, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_CLASSINFO_DATA(MozWifiStatusChangeEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozWifiConnectionInfoEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(Telephony, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
@@ -1732,17 +1730,16 @@ static const nsContractIDMapData kConstr
   {                                                         \
     nsIDOMEvent* e = nullptr;                                \
     nsresult rv = NS_NewDOM##_class(&e, nullptr, nullptr);    \
     *aInstancePtrResult = e;                                \
     return rv;                                              \
   }
 
 NS_DEFINE_EVENT_CTOR(Event)
-NS_DEFINE_EVENT_CTOR(MozSettingsEvent)
 NS_DEFINE_EVENT_CTOR(UIEvent)
 NS_DEFINE_EVENT_CTOR(MouseEvent)
 #ifdef MOZ_B2G_RIL
 NS_DEFINE_EVENT_CTOR(MozWifiStatusChangeEvent)
 NS_DEFINE_EVENT_CTOR(MozWifiConnectionInfoEvent)
 #endif
 
 #define MOZ_GENERATED_EVENT_LIST
@@ -1778,17 +1775,16 @@ struct nsConstructorFuncMapData
   { eDOMClassInfo_##_class##_id, NS_DOM##_class##Ctor },
 
 static const nsConstructorFuncMapData kConstructorFuncMap[] =
 {
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Blob, nsDOMMultipartFile::NewBlob)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(File, nsDOMFileFile::NewFile)
   NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozBlobBuilder, NS_NewBlobBuilder)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event)
-  NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozSettingsEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent)
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiStatusChangeEvent)
   NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiConnectionInfoEvent)
 #endif
 #define MOZ_GENERATED_EVENT_LIST
@@ -4406,21 +4402,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(MutationObserver, nsIDOMMutationObserver)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMutationObserver)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MutationRecord, nsIDOMMutationRecord)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMutationRecord)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(MozSettingsEvent, nsIDOMMozSettingsEvent)
-     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSettingsEvent)
-     DOM_CLASSINFO_EVENT_MAP_ENTRIES
-  DOM_CLASSINFO_MAP_END
-
 #ifdef MOZ_B2G_RIL
   DOM_CLASSINFO_MAP_BEGIN(MozWifiStatusChangeEvent, nsIDOMMozWifiStatusChangeEvent)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiStatusChangeEvent)
      DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozWifiConnectionInfoEvent, nsIDOMMozWifiConnectionInfoEvent)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWifiConnectionInfoEvent)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -502,18 +502,16 @@ DOMCI_CLASS(TouchEvent)
 DOMCI_CLASS(MozCSSKeyframeRule)
 DOMCI_CLASS(MozCSSKeyframesRule)
 
 DOMCI_CLASS(MediaQueryList)
 
 DOMCI_CLASS(MutationObserver)
 DOMCI_CLASS(MutationRecord)
 
-DOMCI_CLASS(MozSettingsEvent)
-
 #ifdef MOZ_B2G_RIL
 DOMCI_CLASS(MozWifiStatusChangeEvent)
 DOMCI_CLASS(MozWifiConnectionInfoEvent)
 DOMCI_CLASS(Telephony)
 DOMCI_CLASS(TelephonyCall)
 DOMCI_CLASS(CallEvent)
 DOMCI_CLASS(MozVoicemail)
 DOMCI_CLASS(MozVoicemailEvent)
--- a/dom/interfaces/settings/Makefile.in
+++ b/dom/interfaces/settings/Makefile.in
@@ -11,11 +11,12 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE         = dom
 XPIDL_MODULE   = dom_settings
 GRE_MODULE     = 1
 
 XPIDLSRCS =                           \
             nsIDOMSettingsManager.idl \
             nsISettingsService.idl    \
+            nsIDOMMozSettingsEvent.idl \
             $(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/dom/interfaces/settings/nsIDOMMozSettingsEvent.idl
@@ -0,0 +1,25 @@
+/* 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;
+
+[scriptable, builtinclass, uuid(5e304193-af49-4546-8329-bf7c9159ed98)]
+interface nsIDOMMozSettingsEvent : nsIDOMEvent
+{
+  readonly attribute DOMString  settingName;
+  readonly attribute nsIVariant settingValue;
+
+  [noscript] void initMozSettingsEvent(in DOMString aType,
+                                       in boolean aCanBubble,
+                                       in boolean aCancelable,
+                                       in DOMString aSettingName,
+                                       in nsIVariant aSettingValue);
+};
+
+dictionary MozSettingsEventInit : EventInit
+{
+  DOMString  settingName;
+  nsIVariant settingValue;
+};
--- a/dom/interfaces/settings/nsIDOMSettingsManager.idl
+++ b/dom/interfaces/settings/nsIDOMSettingsManager.idl
@@ -1,15 +1,14 @@
 /* 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 "domstubs.idl"
 #include "nsIDOMEventTarget.idl"
-#include "nsIDOMEvent.idl"
 
 interface nsIDOMDOMRequest;
 interface nsIVariant;
 
 [scriptable, uuid(ef95ddd0-6308-11e1-b86c-0800200c9a66)]
 interface nsIDOMSettingsLock : nsISupports
 {
   // Contains a JSON object with name/value pairs to be set.
@@ -26,27 +25,8 @@ interface nsIDOMSettingsManager : nsISup
 {
   nsIDOMSettingsLock getLock();
 
   void addObserver(in DOMString name, in jsval callback);
   void removeObserver(in DOMString name, in jsval callback);
 
   attribute nsIDOMEventListener onsettingchange;
 };
-
-[scriptable, builtinclass, uuid(5e304193-af49-4546-8329-bf7c9159ed98)]
-interface nsIDOMMozSettingsEvent : nsIDOMEvent
-{
-  readonly attribute DOMString  settingName;
-  readonly attribute nsIVariant settingValue;
-
-  [noscript] void initMozSettingsEvent(in DOMString aType,
-                                       in boolean aCanBubble,
-                                       in boolean aCancelable,
-                                       in DOMString aSettingName,
-                                       in nsIVariant aSettingValue);
-};
-
-dictionary MozSettingsEventInit : EventInit
-{
-  DOMString  settingName;
-  nsIVariant settingValue;
-};
--- a/js/xpconnect/src/dictionary_helper_gen.conf
+++ b/js/xpconnect/src/dictionary_helper_gen.conf
@@ -7,17 +7,16 @@ dictionaries = [
      [ 'EventInit', 'nsIDOMEvent.idl' ],
      [ 'UIEventInit', 'nsIDOMUIEvent.idl' ],
      [ 'MouseEventInit', 'nsIDOMMouseEvent.idl' ],
      [ 'IDBObjectStoreParameters', 'nsIIDBDatabase.idl' ],
      [ 'IDBIndexParameters', 'nsIIDBObjectStore.idl' ],
      [ 'StorageEventInit', 'nsIDOMStorageEvent.idl' ],
      [ 'BlobPropertyBag', 'nsIDOMFile.idl' ],
      [ 'MutationObserverInit', 'nsIDOMMutationObserver.idl' ],
-     [ 'SettingsEventInit', 'nsIDOMSettingsManager.idl' ],
      [ 'WifiConnectionInfoEventInit', 'nsIWifiEventInits.idl' ],
      [ 'WifiStatusChangeEventInit', 'nsIWifiEventInits.idl' ],
      [ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl' ],
      [ 'DOMFileMetadataParameters', 'nsIDOMLockedFile.idl' ],
      [ 'XMLHttpRequestParameters', 'nsIXMLHttpRequest.idl' ],
      [ 'DeviceStorageEnumerationParameters', 'nsIDOMDeviceStorage.idl' ],
      [ 'CameraSize', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRegion', 'nsIDOMCameraManager.idl' ],
--- a/js/xpconnect/src/event_impl_gen.conf.in
+++ b/js/xpconnect/src/event_impl_gen.conf.in
@@ -4,16 +4,17 @@
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
  The name of the event which real interface should have nsIDOM-prefix,
  and should be in nsIDOM<name>.idl file and which should have
  <name>Init dictionary for the event constructor. """
 
 simple_events = [
     'DeviceProximityEvent',
+    'MozSettingsEvent',
     'UserProximityEvent',
     'CustomEvent',
     'PageTransitionEvent',
     'PopStateEvent',
     'HashChangeEvent',
     'CloseEvent',
     'MozContactChangeEvent',
     'DeviceOrientationEvent',