Bug 919840 - Use WebIDL codegen to implement WebRTC events, r=jib
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 25 Sep 2013 12:48:03 +0300
changeset 148645 dc2423699bd568650efef5fed8bd1e626a013b0d
parent 148644 ab5af752fa81c589bede57e10e1e59c5caec76ee
child 148646 c1f06e0edcf5ca87a7dccb40219a806bac780693
push id25349
push userryanvm@gmail.com
push dateWed, 25 Sep 2013 18:52:12 +0000
treeherderautoland@39f30376058c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs919840
milestone27.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 919840 - Use WebIDL codegen to implement WebRTC events, r=jib
dom/media/PeerConnection.js
dom/media/PeerConnection.manifest
dom/webidl/MediaStreamEvent.webidl
dom/webidl/RTCDataChannelEvent.webidl
dom/webidl/RTCPeerConnectionIceEvent.webidl
dom/webidl/moz.build
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -8,27 +8,21 @@ const {classes: Cc, interfaces: Ci, util
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const PC_CONTRACT = "@mozilla.org/dom/peerconnection;1";
 const PC_ICE_CONTRACT = "@mozilla.org/dom/rtcicecandidate;1";
 const PC_SESSION_CONTRACT = "@mozilla.org/dom/rtcsessiondescription;1";
 const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1";
-const PC_ICEEVENT_CONTRACT = "@mozilla.org/dom/rtcpeerconnectioniceevent;1";
-const MSEVENT_CONTRACT = "@mozilla.org/dom/mediastreamevent;1";
-const DCEVENT_CONTRACT = "@mozilla.org/dom/datachannelevent;1";
 
 const PC_CID = Components.ID("{9878b414-afaa-4176-a887-1e02b3b047c2}");
 const PC_ICE_CID = Components.ID("{02b9970c-433d-4cc2-923d-f7028ac66073}");
 const PC_SESSION_CID = Components.ID("{1775081b-b62d-4954-8ffe-a067bbf508a7}");
 const PC_MANAGER_CID = Components.ID("{7293e901-2be3-4c02-b4bd-cbef6fc24f78}");
-const PC_ICEEVENT_CID = Components.ID("{b9cd25a7-9859-4f9e-8f84-ef5181ff36c0}");
-const MSEVENT_CID = Components.ID("{a722a8a9-2290-4e99-a5ed-07b504292d08}");
-const DCEVENT_CID = Components.ID("{d5ed7fbf-01a8-4b18-af6c-861cf2aac920}");
 
 // Global list of PeerConnection objects, so they can be cleaned up when
 // a page is torn down. (Maps inner window ID to an array of PC objects).
 function GlobalPCList() {
   this._list = [];
   this._networkdown = false; // XXX Need to query current state somehow
   Services.obs.addObserver(this, "inner-window-destroyed", true);
   Services.obs.addObserver(this, "profile-change-net-teardown", true);
@@ -151,82 +145,16 @@ RTCSessionDescription.prototype = {
   init: function(win) { this._win = win; },
 
   __init: function(dict) {
     this.type = dict.type;
     this.sdp  = dict.sdp;
   }
 };
 
-function MediaStreamEvent() {
-  this.type = this._stream = null;
-}
-MediaStreamEvent.prototype = {
-  classDescription: "MediaStreamEvent",
-  classID: MSEVENT_CID,
-  contractID: MSEVENT_CONTRACT,
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
-                                         Ci.nsIDOMGlobalPropertyInitializer]),
-
-  init: function(win) { this._win = win; },
-
-  __init: function(type, dict) {
-    this.type = type;
-    this.__DOM_IMPL__.initEvent(type, dict.bubbles || false,
-                                dict.cancelable || false);
-    this._stream = dict.stream;
-  },
-
-  get stream() { return this._stream; }
-};
-
-function RTCDataChannelEvent() {
-  this.type = this._channel = null;
-}
-RTCDataChannelEvent.prototype = {
-  classDescription: "RTCDataChannelEvent",
-  classID: DCEVENT_CID,
-  contractID: DCEVENT_CONTRACT,
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
-                                         Ci.nsIDOMGlobalPropertyInitializer]),
-
-  init: function(win) { this._win = win; },
-
-  __init: function(type, dict) {
-    this.type = type;
-    this.__DOM_IMPL__.initEvent(type, dict.bubbles || false,
-                                dict.cancelable || false);
-    this._channel = dict.channel;
-  },
-
-  get channel() { return this._channel; }
-};
-
-function RTCPeerConnectionIceEvent() {
-  this.type = this._candidate = null;
-}
-RTCPeerConnectionIceEvent.prototype = {
-  classDescription: "RTCPeerConnectionIceEvent",
-  classID: PC_ICEEVENT_CID,
-  contractID: PC_ICEEVENT_CONTRACT,
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
-                                         Ci.nsIDOMGlobalPropertyInitializer]),
-
-  init: function(win) { this._win = win; },
-
-  __init: function(type, dict) {
-    this.type = type;
-    this.__DOM_IMPL__.initEvent(type, dict.bubbles || false,
-                                dict.cancelable || false);
-    this._candidate = dict.candidate;
-  },
-
-  get candidate() { return this._candidate; }
-};
-
 function RTCPeerConnection() {
   this._queue = [];
 
   this._pc = null;
   this._observer = null;
   this._closed = false;
 
   this._onCreateOfferSuccess = null;
@@ -1096,11 +1024,10 @@ PeerConnectionObserver.prototype = {
   },
 
   notifyClosedConnection: function() {
     this.dispatchEvent(new this._dompc._win.Event("closedconnection"));
   }
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
-  [GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection,
-   RTCPeerConnectionIceEvent, MediaStreamEvent, RTCDataChannelEvent]
+  [GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection]
 );
--- a/dom/media/PeerConnection.manifest
+++ b/dom/media/PeerConnection.manifest
@@ -1,15 +1,9 @@
 component {9878b414-afaa-4176-a887-1e02b3b047c2} PeerConnection.js
 component {02b9970c-433d-4cc2-923d-f7028ac66073} PeerConnection.js
 component {1775081b-b62d-4954-8ffe-a067bbf508a7} PeerConnection.js
 component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js
-component {b9cd25a7-9859-4f9e-8f84-ef5181ff36c0} PeerConnection.js
-component {a722a8a9-2290-4e99-a5ed-07b504292d08} PeerConnection.js
-component {d5ed7fbf-01a8-4b18-af6c-861cf2aac920} PeerConnection.js
 
 contract @mozilla.org/dom/peerconnection;1 {9878b414-afaa-4176-a887-1e02b3b047c2}
 contract @mozilla.org/dom/rtcicecandidate;1 {02b9970c-433d-4cc2-923d-f7028ac66073}
 contract @mozilla.org/dom/rtcsessiondescription;1 {1775081b-b62d-4954-8ffe-a067bbf508a7}
 contract @mozilla.org/dom/peerconnectionmanager;1 {7293e901-2be3-4c02-b4bd-cbef6fc24f78}
-contract @mozilla.org/dom/rtcpeerconnectioniceevent;1 {b9cd25a7-9859-4f9e-8f84-ef5181ff36c0}
-contract @mozilla.org/dom/mediastreamevent;1 {a722a8a9-2290-4e99-a5ed-07b504292d08}
-contract @mozilla.org/dom/datachannelevent;1 {d5ed7fbf-01a8-4b18-af6c-861cf2aac920}
--- a/dom/webidl/MediaStreamEvent.webidl
+++ b/dom/webidl/MediaStreamEvent.webidl
@@ -7,13 +7,12 @@
  * http://dev.w3.org/2011/webrtc/editor/webrtc.html#mediastreamevent
  */
 
 dictionary MediaStreamEventInit : EventInit {
     MediaStream? stream = null;
 };
 
 [Pref="media.peerconnection.enabled",
- JSImplementation="@mozilla.org/dom/mediastreamevent;1",
  Constructor(DOMString type, optional MediaStreamEventInit eventInitDict)]
 interface MediaStreamEvent : Event {
   readonly attribute MediaStream? stream;
 };
--- a/dom/webidl/RTCDataChannelEvent.webidl
+++ b/dom/webidl/RTCDataChannelEvent.webidl
@@ -9,13 +9,12 @@
 
 interface RTCDataChannel;
 
 dictionary RTCDataChannelEventInit : EventInit {
     RTCDataChannel? channel = null;
 };
 
 [Pref="media.peerconnection.enabled",
- JSImplementation="@mozilla.org/dom/datachannelevent;1",
  Constructor(DOMString type, optional RTCDataChannelEventInit eventInitDict)]
 interface RTCDataChannelEvent : Event {
   readonly attribute RTCDataChannel? channel;
 };
--- a/dom/webidl/RTCPeerConnectionIceEvent.webidl
+++ b/dom/webidl/RTCPeerConnectionIceEvent.webidl
@@ -7,14 +7,13 @@
  * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnectionIceEvent
  */
 
 dictionary RTCPeerConnectionIceEventInit : EventInit {
   mozRTCIceCandidate? candidate = null;
 };
 
 [Pref="media.peerconnection.enabled",
- JSImplementation="@mozilla.org/dom/rtcpeerconnectioniceevent;1",
  Constructor(DOMString type,
              optional RTCPeerConnectionIceEventInit eventInitDict)]
 interface RTCPeerConnectionIceEvent : Event {
   readonly attribute mozRTCIceCandidate? candidate;
 };
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -198,17 +198,16 @@ WEBIDL_FILES = [
     'Location.webidl',
     'MediaElementAudioSourceNode.webidl',
     'MediaError.webidl',
     'MediaRecorder.webidl',
     'MediaSource.webidl',
     'MediaStream.webidl',
     'MediaStreamAudioDestinationNode.webidl',
     'MediaStreamAudioSourceNode.webidl',
-    'MediaStreamEvent.webidl',
     'MediaStreamTrack.webidl',
     'MessageChannel.webidl',
     'MessageEvent.webidl',
     'MessagePort.webidl',
     'MessagePortList.webidl',
     'MimeType.webidl',
     'MimeTypeArray.webidl',
     'MobileMessageManager.webidl',
@@ -248,20 +247,18 @@ WEBIDL_FILES = [
     'PositionError.webidl',
     'ProcessingInstruction.webidl',
     'Promise.webidl',
     'PushManager.webidl',
     'Range.webidl',
     'Rect.webidl',
     'RGBColor.webidl',
     'RTCConfiguration.webidl',
-    'RTCDataChannelEvent.webidl',
     'RTCIceCandidate.webidl',
     'RTCPeerConnection.webidl',
-    'RTCPeerConnectionIceEvent.webidl',
     'RTCSessionDescription.webidl',
     'Screen.webidl',
     'ScriptProcessorNode.webidl',
     'ScrollAreaEvent.webidl',
     'SettingsManager.webidl',
     'SimpleGestureEvent.webidl',
     'SourceBuffer.webidl',
     'SourceBufferList.webidl',
@@ -536,16 +533,19 @@ if CONFIG['MOZ_B2G']:
     WEBIDL_FILES += [
         'InputMethod.webidl',
     ]
 
 GENERATED_EVENTS_WEBIDL_FILES = [
     'BlobEvent.webidl',
     'DeviceLightEvent.webidl',
     'DeviceProximityEvent.webidl',
+    'MediaStreamEvent.webidl',
+    'RTCDataChannelEvent.webidl',
+    'RTCPeerConnectionIceEvent.webidl',
     'UserProximityEvent.webidl',
 ]
 
 if CONFIG['MOZ_GAMEPAD']:
     GENERATED_EVENTS_WEBIDL_FILES += [
         'GamepadAxisMoveEvent.webidl',
         'GamepadButtonEvent.webidl',
         'GamepadEvent.webidl',