W3C home > Mailing lists > Public > public-webrtc@w3.org > March 2015

Re: PSA: JSON.stringify has changed behavior wrt DOM objects in Chrome

From: Harald Alvestrand <harald@alvestrand.no>
Date: Wed, 18 Mar 2015 11:36:01 +0100
Message-ID: <55095511.90707@alvestrand.no>
To: public-webrtc@w3.org
On 03/18/2015 11:20 AM, Tim Panton new wrote:
>> On 18 Mar 2015, at 09:46, Harald Alvestrand <harald@alvestrand.no> wrote:
>>
>> There's been a change in the behavior of recent (canary) versions of Chrome, described here:
>>
>> https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/H0MGw0jkdn4/discussion
>>
>> The change means that a lot of DOM attributes are now no longer picked up by JSON.stringify; I'm not quite sure whether this was intentional or not.
> Would this be why I can no longer call JSON.stringify() directly on a RTCSessionDescription ?
> - I’ve had to resort to :
>
> createOffer(function(offer){
> 	offer_sdp = {
>    		sdp: offer.sdp.sdp
>    		type: offer.sdp.type
> 	};
> 	send_offer(Json.stringify(offer_sdp));
> },fail);
>
> where previously I had :
>
> createOffer(function(offer){
> 	send_offer(Json.stringify(offer.sdp));
> },fail);
>
> If so, this could break a _lot_ of running code.

It would surprise me if WEBRTC is the only area where people use 
Json.stringify on DOM objects, so I'm waiting to see what the West Coast 
folks say when they wake up.

It's possible that the right solution is to modify Json.stringify() to 
work in harmony with the new definitions, in which case we don't need to 
do anything.

>
>
>> This affects a couple of examples in our spec that use JSON.stringify.
>> I've filed #204 to deal with the issue.
>>
>> Harald
>>
>>
>
Received on Wednesday, 18 March 2015 10:36:30 UTC

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