15.12.2-2-3.js (1428B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es5id: 15.12.2-2-3 6 description: > 7 JSON.parse - parsing an object where property name ends with a 8 null character 9 ---*/ 10 11 var nullChars = new Array(); 12 nullChars[0] = '\"\u0000\"'; 13 nullChars[1] = '\"\u0001\"'; 14 nullChars[2] = '\"\u0002\"'; 15 nullChars[3] = '\"\u0003\"'; 16 nullChars[4] = '\"\u0004\"'; 17 nullChars[5] = '\"\u0005\"'; 18 nullChars[6] = '\"\u0006\"'; 19 nullChars[7] = '\"\u0007\"'; 20 nullChars[8] = '\"\u0008\"'; 21 nullChars[9] = '\"\u0009\"'; 22 nullChars[10] = '\"\u000A\"'; 23 nullChars[11] = '\"\u000B\"'; 24 nullChars[12] = '\"\u000C\"'; 25 nullChars[13] = '\"\u000D\"'; 26 nullChars[14] = '\"\u000E\"'; 27 nullChars[15] = '\"\u000F\"'; 28 nullChars[16] = '\"\u0010\"'; 29 nullChars[17] = '\"\u0011\"'; 30 nullChars[18] = '\"\u0012\"'; 31 nullChars[19] = '\"\u0013\"'; 32 nullChars[20] = '\"\u0014\"'; 33 nullChars[21] = '\"\u0015\"'; 34 nullChars[22] = '\"\u0016\"'; 35 nullChars[23] = '\"\u0017\"'; 36 nullChars[24] = '\"\u0018\"'; 37 nullChars[25] = '\"\u0019\"'; 38 nullChars[26] = '\"\u001A\"'; 39 nullChars[27] = '\"\u001B\"'; 40 nullChars[28] = '\"\u001C\"'; 41 nullChars[29] = '\"\u001D\"'; 42 nullChars[30] = '\"\u001E\"'; 43 nullChars[31] = '\"\u001F\"'; 44 45 for (var index in nullChars) { 46 assert.throws(SyntaxError, function() { 47 var obj = JSON.parse('{' + "name" + nullChars[index] + ' : "John" } '); 48 }); 49 } 50 51 reportCompare(0, 0);