W3C home > Mailing lists > Public > public-webrtc@w3.org > August 2012

Re: CHANGE: [Bug 18486] New: Let RTCSessionDescription take a Dictionary parameter

From: Eric Rescorla <ekr@rtfm.com>
Date: Fri, 24 Aug 2012 07:55:30 -0700
Message-ID: <CABcZeBP26a_27Hkup-MiZ3Njn6fjYtqcPjUkZCU=sMD7Y1sCzg@mail.gmail.com>
To: Tommy Widenflycht (ᛏᚮᛘᛘᚤ) <tommyw@google.com>
Cc: "Cullen Jennings (fluffy)" <fluffy@cisco.com>, Harald Alvestrand <harald@alvestrand.no>, "<public-webrtc@w3.org>" <public-webrtc@w3.org>
To follow up on this:

1. The current algorithm has a pseudo-JSON structure wrapped in parentheses.
Did I miss the discussion of why the parentheses are there?

2. I say "pseudo-JSON" because the attributes are not quoted.

Is there a published rationale for this?

-Ekr


On Fri, Aug 24, 2012 at 7:43 AM, Tommy Widenflycht (ᛏᚮᛘᛘᚤ)
<tommyw@google.com> wrote:
> It has been pointed out to me that the stringify algorithm is broken,
> especially for RTCSessionDescription since the sdp member most certainly
> contains newlines. Should had noticed that myself, doh.
>
> Also some clarification regarding exactly what the end result is need to be
> put in the specification.
> We had a discussion regarding if this was meant to be JSON or not.
>
> /Tommy
>
>
> On Wed, Aug 22, 2012 at 2:10 PM, Tommy Widenflycht (ᛏᚮᛘᛘᚤ)
> <tommyw@google.com> wrote:
>>
>> I'm fine both with removing the stringifier and letting it create "JS
>> object strings" as long as everyone understands that it isn't necessarily
>> JSON compatible.
>>
>> JSON.stringify(object) != (string)object
>>
>>
>> On Mon, Aug 13, 2012 at 5:01 PM, Cullen Jennings (fluffy)
>> <fluffy@cisco.com> wrote:
>>>
>>>
>>> This one is not a real big deal to me one way or ther other but the
>>> string still seems nicer in the exmaple code I have. Is there a real strong
>>> argument one way or the other?
>>>
>>>
>>> On Aug 6, 2012, at 9:52 AM, Harald Alvestrand <harald@alvestrand.no>
>>> wrote:
>>>
>>> > [Chair hat on]
>>> > Based on discussion so far, this seems reasonable.
>>> > If anyone objects, please say so Real Soon (like in the next 48 hours).
>>> >
>>> >            Harald
>>> >
>>> > On 08/04/2012 02:22 AM, bugzilla@jessica.w3.org wrote:
>>> >> https://www.w3.org/Bugs/Public/show_bug.cgi?id=18486
>>> >>
>>> >>            Summary: Let RTCSessionDescription take a Dictionary
>>> >> parameter
>>> >>            Product: WebRTC Working Group
>>> >>            Version: unspecified
>>> >>           Platform: PC
>>> >>         OS/Version: Linux
>>> >>             Status: NEW
>>> >>           Severity: normal
>>> >>           Priority: P2
>>> >>          Component: WebRTC API
>>> >>         AssignedTo: public-webrtc@w3.org
>>> >>         ReportedBy: harald@alvestrand.no
>>> >>                 CC: public-webrtc@w3.org
>>> >>
>>> >>
>>> >> >From Tommy Widenflycht, July 31 (see mailing list for discussion):
>>> >>
>>> >> Today I would like to propose a small change to RTCSessionDescription
>>> >> and
>>> >> RTCIceCandidate which would make the much more flexible:
>>> >>
>>> >> [Constructor(optional Dictionary description)]
>>> >> interface RTCSessionDescription {
>>> >>              attribute RTCSdpType type;
>>> >>              attribute DOMString  sdp;
>>> >> };
>>> >>
>>> >> In short the single constructor takes an Dictionary which is expected
>>> >> to mimic
>>> >> its members, and the stringifier method is removed.
>>> >>
>>> >>
>>> >> This has the advantages of being extremely powerful:
>>> >>
>>> >> sd = new RTCSessionDescription();
>>> >> sd.sdp = ...;
>>> >> sd.type = ...;
>>> >>
>>> >> sd = new RTCSessionDescription({sdp:"..."});
>>> >> sd.type = ...;
>>> >>
>>> >> sd = new RTCSessionDescription({type:"answer", sdp:"..."});
>>> >>
>>> >> sd = new RTCSessionDescription(JSON.parse(some_json_string));
>>> >>
>>> >> sd2 = new RTCSessionDescription(sd);
>>> >>
>>> >> and in the other direction
>>> >>
>>> >> jsonified_sd = JSON.stringify(sd);
>>> >>
>>> >>
>>> >> There's some precedence in using a constructor like this in some of
>>> >> the base
>>> >> Event classes.
>>> >>
>>> >
>>> >
>>>
>>>
>>
>>
>>
>> --
>> Tommy Widenflycht | Senior Software Engineer | tommyw@google.com | +46
>> 734162531
>> Google Sweden AB, Kungsbron 2, SE-11122 Stockholm, Sweden
>> Org. nr. 556656-6880
>>
>>
>
>
>
> --
> Tommy Widenflycht | Senior Software Engineer | tommyw@google.com | +46
> 734162531
> Google Sweden AB, Kungsbron 2, SE-11122 Stockholm, Sweden
> Org. nr. 556656-6880
>
>
Received on Friday, 24 August 2012 14:56:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 August 2012 14:56:39 GMT