tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

replacer-array-empty.js (896B)


      1 // Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-serializejsonobject
      5 description: >
      6  Objects are serialized to {} if replacer array is empty.
      7 info: |
      8  JSON.stringify ( value [ , replacer [ , space ] ] )
      9 
     10  [...]
     11  12. Return ? SerializeJSONProperty(the empty String, wrapper).
     12 
     13  SerializeJSONProperty ( key, holder )
     14 
     15  [...]
     16  10. If Type(value) is Object and IsCallable(value) is false, then
     17    [...]
     18    c. Return ? SerializeJSONObject(value).
     19 
     20  SerializeJSONObject ( value )
     21 
     22  [...]
     23  5. If PropertyList is not undefined, then
     24    a. Let K be PropertyList.
     25 ---*/
     26 
     27 assert.sameValue(
     28  JSON.stringify({a: 1, b: 2}, []),
     29  '{}'
     30 );
     31 
     32 assert.sameValue(
     33  JSON.stringify({a: 1, b: {c: 2}}, []),
     34  '{}'
     35 );
     36 
     37 assert.sameValue(
     38  JSON.stringify([1, {a: 2}], []),
     39  '[1,{}]'
     40 );
     41 
     42 reportCompare(0, 0);