Bug 919840 - Use WebIDL codegen to implement WebRTC events, r=jib

--HG--
extra : rebase_source : ae7aa26cbfb775ddea775a0c084d4a8d1f6fa82e
This commit is contained in:
Olli Pettay 2013-09-25 12:48:03 +03:00
parent 6220c02999
commit 8e10f4454e
6 changed files with 4 additions and 86 deletions

View File

@ -13,17 +13,11 @@ 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).
@ -156,72 +150,6 @@ RTCSessionDescription.prototype = {
}
};
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 = [];
@ -1101,6 +1029,5 @@ PeerConnectionObserver.prototype = {
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
[GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection,
RTCPeerConnectionIceEvent, MediaStreamEvent, RTCDataChannelEvent]
[GlobalPCList, RTCIceCandidate, RTCSessionDescription, RTCPeerConnection]
);

View File

@ -2,14 +2,8 @@ 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}

View File

@ -12,7 +12,6 @@ dictionary MediaStreamEventInit : EventInit {
};
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/mediastreamevent;1",
Constructor(DOMString type, optional MediaStreamEventInit eventInitDict)]
interface MediaStreamEvent : Event {
readonly attribute MediaStream? stream;

View File

@ -14,7 +14,6 @@ dictionary RTCDataChannelEventInit : EventInit {
};
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/datachannelevent;1",
Constructor(DOMString type, optional RTCDataChannelEventInit eventInitDict)]
interface RTCDataChannelEvent : Event {
readonly attribute RTCDataChannel? channel;

View File

@ -12,7 +12,6 @@ dictionary RTCPeerConnectionIceEventInit : EventInit {
};
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/rtcpeerconnectioniceevent;1",
Constructor(DOMString type,
optional RTCPeerConnectionIceEventInit eventInitDict)]
interface RTCPeerConnectionIceEvent : Event {

View File

@ -203,7 +203,6 @@ WEBIDL_FILES = [
'MediaStream.webidl',
'MediaStreamAudioDestinationNode.webidl',
'MediaStreamAudioSourceNode.webidl',
'MediaStreamEvent.webidl',
'MediaStreamTrack.webidl',
'MessageChannel.webidl',
'MessageEvent.webidl',
@ -253,10 +252,8 @@ WEBIDL_FILES = [
'Rect.webidl',
'RGBColor.webidl',
'RTCConfiguration.webidl',
'RTCDataChannelEvent.webidl',
'RTCIceCandidate.webidl',
'RTCPeerConnection.webidl',
'RTCPeerConnectionIceEvent.webidl',
'RTCSessionDescription.webidl',
'Screen.webidl',
'ScriptProcessorNode.webidl',
@ -541,6 +538,9 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'BlobEvent.webidl',
'DeviceLightEvent.webidl',
'DeviceProximityEvent.webidl',
'MediaStreamEvent.webidl',
'RTCDataChannelEvent.webidl',
'RTCPeerConnectionIceEvent.webidl',
'UserProximityEvent.webidl',
]