Yes, when the spec. says ToString it really does mean to fully apply the ToString algorithms. This is a good test case to have.
Allen >-----Original Message----- >From: Oliver Hunt [mailto:[email protected]] >Sent: Thursday, August 27, 2009 4:33 PM >To: Allen Wirfs-Brock >Cc: Hallvord R. M. Steen; [email protected] >Subject: Re: a test for stringify "whitelist" which WebKit fails > >Do we intend that > >str = new String("foo"); >str.toString=function(){ alert("Wiffle"); } >JSON.stringify(..., [str]) > >will execute the custom toString? > >--Oliver > >On Aug 27, 2009, at 7:47 AM, Allen Wirfs-Brock wrote: > >> This is a fairly recent (last couple months, I believe) change to >> the spec. The whitelist used to require strings. It now may >> contain strings, numbers, string objects, or number objects. They >> all get converted to string values. See stringify steps 4.b.ii.2-4. >> >> Allen >> >>> -----Original Message----- >>> From: [email protected] [mailto:es-discuss- >>> [email protected]] On Behalf Of Hallvord R. M. Steen >>> Sent: Thursday, August 27, 2009 4:44 AM >>> To: Oliver Hunt >>> Cc: [email protected] >>> Subject: a test for stringify "whitelist" which WebKit fails >>> >>> Hi Oliver, >>> I'm curious about this TC - it appears to be WebKit against the >>> rest of >>> us, but it will take me some assistance from somebody with Superior >>> Spec-Reading Skills to figure out who does the right thing.. >>> >>> http://testsuites.opera.com/JSON/correctness/046.html >>> >>> (test code is at >>> http://testsuites.opera.com/JSON/correctness/scripts/046.js ) >>> >>> Issue: if an object has properties whose name is a number inside a >>> string >>> ({'1':'foo'}) and you pass in a white-list array to stringify(), >>> WebKit >>> requires the elements in the array to be numbers inside strings too, >>> while >>> other implementations allow either plain numbers or numbers inside >>> strings. >>> >>> The latter makes more sense to me given that JS generally doesn't >>> distinguish obj[1] and obj['1']. Do you think this is a WebKit bug? >>> >>> -- >>> Hallvord R. M. Steen, Core Tester, Opera Software >>> http://www.opera.com http://my.opera.com/hallvors/ >>> _______________________________________________ >>> es-discuss mailing list >>> [email protected] >>> https://mail.mozilla.org/listinfo/es-discuss >> > _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

