W3C home > Mailing lists > Public > public-webrtc@w3.org > December 2013

Nullable interface members (which cannot be initialized to null by the script)

From: Adam Bergkvist <adam.bergkvist@ericsson.com>
Date: Thu, 5 Dec 2013 11:11:26 +0100
Message-ID: <52A0514E.4010809@ericsson.com>
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
Hi

We have a few cases in the spec where interfaces have nullable 
attributes, but the dictionaries used to initiate these attributes don't 
have nullable types for the corresponding dictionary members.

I guess the platform could create an object by bypassing the dictionary 
(and set a value of null), but I think that should be an exception.

Looking at the first one - I don't think we want a MediaStreamEvent with 
a null-MediaStream that would need a not-null-check before it can be 
used. Are any of the other motivated or should I remove the "?" from the 
attributes from all of them?

/Adam

dictionary MediaStreamEventInit : EventInit {
     MediaStream stream;
};

[ Constructor (DOMString type, MediaStreamEventInit eventInitDict)]
interface MediaStreamEvent : Event {
     readonly    attribute MediaStream? stream;
};

==============

dictionary RTCSessionDescriptionInit {
     RTCSdpType type;
     DOMString  sdp;
};

[ Constructor (optional RTCSessionDescriptionInit descriptionInitDict)]
interface RTCSessionDescription {
                 attribute RTCSdpType? type;
                 attribute DOMString?  sdp;
     serializer = {attribute};
};

==============

dictionary RTCIceCandidateInit {
     DOMString      candidate;
     DOMString      sdpMid;
     unsigned short sdpMLineIndex;
};

[ Constructor (optional RTCIceCandidateInit candidateInitDict)]
interface RTCIceCandidate {
                 attribute DOMString?      candidate;
                 attribute DOMString?      sdpMid;
                 attribute unsigned short? sdpMLineIndex;
     serializer = {attribute};
};
Received on Thursday, 5 December 2013 10:11:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:37 UTC