Bug 847591 - Paris binding for CommandEvent, r=peterv
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 13 Mar 2013 23:05:32 +0200
changeset 124757 6681cf6b14e61452bed89e1debc91f19ecedd45c
parent 124756 5cb34f00f6ae4bf8af1b1fc64b165591dfa0872b
child 124758 2ef912e53996b7eaba6c65a61a5884e484417f15
push id24582
push useropettay@mozilla.com
push dateWed, 13 Mar 2013 21:10:01 +0000
treeherdermozilla-inbound@6681cf6b14e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs847591
milestone22.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 847591 - Paris binding for CommandEvent, r=peterv
content/events/src/nsDOMCommandEvent.cpp
content/events/src/nsDOMCommandEvent.h
dom/bindings/Bindings.conf
dom/webidl/CommandEvent.webidl
dom/webidl/WebIDL.mk
--- a/content/events/src/nsDOMCommandEvent.cpp
+++ b/content/events/src/nsDOMCommandEvent.cpp
@@ -13,16 +13,17 @@ nsDOMCommandEvent::nsDOMCommandEvent(moz
                new nsCommandEvent(false, nullptr, nullptr, nullptr))
 {
   mEvent->time = PR_Now();
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
   }
+  SetIsDOMBinding();
 }
 
 nsDOMCommandEvent::~nsDOMCommandEvent()
 {
   if (mEventIsInternal && mEvent->eventStructType == NS_COMMAND_EVENT) {
     delete static_cast<nsCommandEvent*>(mEvent);
     mEvent = nullptr;
   }
--- a/content/events/src/nsDOMCommandEvent.h
+++ b/content/events/src/nsDOMCommandEvent.h
@@ -3,27 +3,42 @@
  * 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 nsDOMCommandEvent_h__
 #define nsDOMCommandEvent_h__
 
 #include "nsIDOMCommandEvent.h"
 #include "nsDOMEvent.h"
+#include "mozilla/dom/CommandEventBinding.h"
 
 class nsDOMCommandEvent : public nsDOMEvent,
                           public nsIDOMCommandEvent
 {
 public:
   nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
                     nsPresContext* aPresContext,
                     nsCommandEvent* aEvent);
   virtual ~nsDOMCommandEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMCOMMANDEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMEVENT
+
+  virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
+  {
+    return mozilla::dom::CommandEventBinding::Wrap(aCx, aScope, this);
+  }
+
+  void InitCommandEvent(const nsAString& aType,
+                        bool aCanBubble,
+                        bool aCancelable,
+                        const nsAString& aCommand,
+                        mozilla::ErrorResult& aRv)
+  {
+    aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aCommand);
+  }
 };
 
 #endif // nsDOMCommandEvent_h__
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -154,16 +154,20 @@ DOMInterfaces = {
 },
 
 'ClientRectList': {
     'nativeType': 'nsClientRectList',
     'headerFile': 'nsClientRect.h',
     'resultNotAddRefed': [ 'item' ]
 },
 
+'CommandEvent': {
+    'nativeType': 'nsDOMCommandEvent',
+},
+
 'CSS': {
     'concrete': False,
 },
 
 'CSS2Properties': {
   'nativeType': 'nsDOMCSSDeclaration'
 },
 
new file mode 100644
--- /dev/null
+++ b/dom/webidl/CommandEvent.webidl
@@ -0,0 +1,14 @@
+/* -*- 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/.
+ */
+
+interface CommandEvent : Event {
+  readonly attribute DOMString? command;
+
+  void initCommandEvent(DOMString type,
+                        boolean canBubble,
+                        boolean cancelable,
+                        DOMString? command);
+};
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -22,16 +22,17 @@ webidl_files = \
   BiquadFilterNode.webidl \
   Blob.webidl \
   CanvasRenderingContext2D.webidl \
   CaretPosition.webidl \
   CDATASection.webidl \
   CFStateChangeEvent.webidl \
   CharacterData.webidl \
   ClientRectList.webidl \
+  CommandEvent.webidl \
   Comment.webidl \
   CSS.webidl \
   CSSPrimitiveValue.webidl \
   CSSStyleDeclaration.webidl \
   CSSValue.webidl \
   CSSValueList.webidl \
   DelayNode.webidl \
   Document.webidl \