tor-browser

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

text-object.js (723B)


      1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-json.parse
      5 description: >
      6  Objects are coerced to strings using ToString.
      7 info: |
      8  JSON.parse ( text [ , reviver ] )
      9 
     10  1. Let JText be ? ToString(text).
     11  2. Parse JText interpreted as UTF-16 encoded Unicode points (6.1.4) as a JSON
     12  text as specified in ECMA-404. Throw a SyntaxError exception if JText is not
     13  a valid JSON text as defined in that specification.
     14 ---*/
     15 
     16 var hint = JSON.parse({
     17  toString: function() {
     18    return '"string"';
     19  },
     20  valueOf: function() {
     21    return '"default_or_number"';
     22  },
     23 });
     24 
     25 assert.sameValue(hint, 'string');
     26 
     27 reportCompare(0, 0);