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

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