JDK-8131683.js revision 1360:b983e998f528
1/* 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24/** 25 * JDK-8131683: Delete fails over multiple scopes 26 * 27 * @test 28 * @run 29 */ 30 31a = 1; 32b = 2; 33c = 3; 34 35var A = 1; 36var B = 2; 37var C = 3; 38function D() {} 39 40print((function() { 41 var x; // force creation of scope 42 (function() { x; })(); 43 return delete a; 44})()); 45 46print((function() { 47 eval(""); 48 return delete b; 49})()); 50 51print((function() { 52 return eval("delete c"); 53})()); 54 55print((function() { 56 eval("d = 4"); 57 return eval("delete d"); 58})()); 59 60print(typeof a); 61print(typeof b); 62print(typeof c); 63print(typeof d); 64 65print((function() { 66 var x; // force creation of scope 67 (function() { x; })(); 68 return delete A; 69})()); 70 71print((function() { 72 eval(""); 73 return delete B; 74})()); 75 76print((function() { 77 return eval("delete C"); 78})()); 79 80print((function() { 81 eval(""); 82 return delete D; 83})()); 84 85print(typeof A); 86print(typeof B); 87print(typeof C); 88print(typeof D); 89 90