js/src/tests/ecma_5/JSON/trailing-comma.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     4 var gTestfile = 'trailing-comma.js';
     5 //-----------------------------------------------------------------------------
     6 var BUGNUMBER = 564621;
     7 var summary = 'JSON.parse should reject {"a" : "b",} or [1,]';
     9 print(BUGNUMBER + ": " + summary);
    11 /**************
    12  * BEGIN TEST *
    13  **************/
    15 testJSON('[]', false);
    16 testJSON('[1]', false);
    17 testJSON('["a"]', false);
    18 testJSON('{}', false);
    19 testJSON('{"a":1}', false);
    20 testJSON('{"a":"b"}', false);
    21 testJSON('{"a":true}', false);
    22 testJSON('[{}]', false);
    24 testJSON('[1,]', true);
    25 testJSON('["a",]', true);
    26 testJSON('{,}', true);
    27 testJSON('{"a":1,}', true);
    28 testJSON('{"a":"b",}', true);
    29 testJSON('{"a":true,}', true);
    30 testJSON('[{,}]', true);
    31 testJSON('[[1,]]', true);
    32 testJSON('[{"a":"b",}]', true);

mercurial