Remove numeric constants from WebRTC

WebRTC currently defines numeric constants on a few of its interfaces
(specifically, MediaStream and PeerConnection).  These are verboten in new
JS APIs, as now noted in the WebIDL spec <>.  Instead, the
appropriate properties should simply contain strings.

The MediaStream interface should be changed to:

[Constructor (MediaStreamTrackList? audioTracks, MediaStreamTrackList?
interface MediaStream {
    readonly attribute DOMString            label;
    readonly attribute MediaStreamTrackList audioTracks;
    readonly attribute MediaStreamTrackList videoTracks;
    MediaStreamRecorder record ();
-   const unsigned short LIVE = 1;
-   const unsigned short ENDED = 2;
-   readonly attribute unsigned short       readyState;
+   readonly attribute DOMString            readyState;
             attribute Function?            onended;

where readyState can be the values "live" or "ended".

The PeerConnection interface should be changed to:

[Constructor (DOMString configuration, SignalingCallback signalingCallback)]
interface PeerConnection {
    void processSignalingMessage (DOMString message);
-   const unsigned short NEW = 0;
-   const unsigned short NEGOTIATING = 1;
-   const unsigned short ACTIVE = 2;
-   const unsigned short CLOSING = 4;
-   const unsigned short CLOSED = 3;
-   readonly attribute unsigned short readyState;
+   readonly attribute DOMString readyState;
-   const unsigned short ICE_GATHERING = 0x100;
-   const unsigned short ICE_WAITING = 0x200;
-   const unsigned short ICE_CHECKING = 0x300;
-   const unsigned short ICE_CONNECTED = 0x400;
-   const unsigned short ICE_COMPLETED = 0x500;
-   const unsigned short ICE_FAILED = 0x600;
-   const unsigned short ICE_CLOSED = 0x700;
-   readonly attribute unsigned short iceState;
+   readonly attribute DOMString iceState;
-   const unsigned short SDP_IDLE = 0x1000;
-   const unsigned short SDP_WAITING = 0x2000;
-   const unsigned short SDP_GLARE = 0x3000;
-   readonly attribute unsigned short sdpState;
+   readonly attribute DOMString sdpState;
    void addStream (MediaStream stream, MediaStreamHints hints);
    void removeStream (MediaStream stream);
    readonly attribute MediaStream[]  localStreams;
    readonly attribute MediaStream[]  remoteStreams;
    void close ();
             attribute Function?      onconnecting;
             attribute Function?      onopen;
             attribute Function?      onstatechange;
             attribute Function?      onaddstream;
             attribute Function?      onremovestream;

where readyState can be the value "new", "negotiating", "active",
"closing", or "closed", iceState can be the values "gathering", "waiting",
"checking", "connected", "completed", "failed", or "closed", and sdpState
can be the values "idle", "waiting", or "glare".


Received on Friday, 16 December 2011 22:45:17 UTC