JDK-8025149.js revision 877:cf4d2252d444
1178253Sdelphij/* 21573Srgrimes * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 31573Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41573Srgrimes * 51573Srgrimes * This code is free software; you can redistribute it and/or modify it 61573Srgrimes * under the terms of the GNU General Public License version 2 only, as 71573Srgrimes * published by the Free Software Foundation. 81573Srgrimes * 91573Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 101573Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111573Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 121573Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 131573Srgrimes * accompanied this code). 141573Srgrimes * 151573Srgrimes * You should have received a copy of the GNU General Public License version 161573Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 171573Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181573Srgrimes * 191573Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 201573Srgrimes * or visit www.oracle.com if you need additional information or have any 211573Srgrimes * questions. 221573Srgrimes */ 231573Srgrimes 241573Srgrimes/** 251573Srgrimes * JDK-8025149: JSON.stringify does not handle 'space' argument as per the spec. 261573Srgrimes * 271573Srgrimes * @test 281573Srgrimes * @run 291573Srgrimes */ 301573Srgrimes 3123668Speterprint(JSON.stringify({ foo : 23, bar: { x : 22} }, undefined ,new Number(Infinity))); 321573Srgrimes 3390039Sobrienprint(JSON.stringify({ foo : 23, bar: { x : 22} }, undefined ,new Number(-Infinity))); 3490039Sobrien 351573Srgrimestry { 3671579Sdeischen JSON.stringify({},[], 371573Srgrimes (n = new Number(0), n.valueOf = function() { throw ("inside n.valueOf") }, n)); 3823768Sbde} catch (e) { 397978Sbde print(e); 401573Srgrimes} 411573Srgrimes 427978Sbdetry { 431573Srgrimes JSON.stringify({},[], 441573Srgrimes (s = new String(""), s.toString = function() { throw ("inside s.toString") }, s)); 45108631Stjr} catch (e) { 461573Srgrimes print(e); 4771579Sdeischen} 481573Srgrimes