1// Copyright 2013 the V8 project authors. All rights reserved. 2// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions 6// are met: 7// 1. Redistributions of source code must retain the above copyright 8// notice, this list of conditions and the following disclaimer. 9// 2. Redistributions in binary form must reproduce the above copyright 10// notice, this list of conditions and the following disclaimer in the 11// documentation and/or other materials provided with the distribution. 12// 13// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24description( 25"This test checks that deletion of properties works properly with getters and setters." 26); 27 28b1 = 1; 29this.__defineSetter__("a1", function() {}); 30this.__defineSetter__("b1", function() {}); 31delete a1; 32shouldThrow("b1.property"); 33 34a2 = 1; 35this.__defineSetter__("a2", function() {}); 36this.__defineSetter__("b2", function() {}); 37delete b2; 38shouldThrow("a2.property"); 39 40b3 = 1; 41this.__defineGetter__("a3", function() {}); 42this.__defineGetter__("b3", function() {}); 43delete a3; 44shouldThrow("b3.property"); 45 46a4 = 1; 47this.__defineGetter__("a4", function() {}); 48this.__defineGetter__("b4", function() {}); 49delete b4; 50shouldThrow("a4.property"); 51 52b5 = 1; 53this.__defineSetter__("a5", function() {}); 54this.__defineGetter__("b5", function() {}); 55delete a5; 56shouldThrow("b5.property"); 57 58a6 = 1; 59this.__defineSetter__("a6", function() {}); 60this.__defineGetter__("b6", function() {}); 61delete b6; 62shouldThrow("a6.property"); 63 64b7 = 1; 65this.__defineGetter__("a7", function() {}); 66this.__defineSetter__("b7", function() {}); 67delete a7; 68shouldThrow("b7.property"); 69 70a8 = 1; 71this.__defineGetter__("a8", function() {}); 72this.__defineSetter__("b8", function() {}); 73delete b8; 74shouldThrow("a8.property"); 75 76var o1 = { b: 1 }; 77o1.__defineSetter__("a", function() {}); 78o1.__defineSetter__("b", function() {}); 79delete o1.a; 80shouldThrow("o1.b.property"); 81 82var o2 = { a: 1 }; 83o2.__defineSetter__("a", function() {}); 84o2.__defineSetter__("b", function() {}); 85delete o2.b; 86shouldThrow("o1.a.property"); 87 88var o3 = { b: 1 }; 89o3.__defineGetter__("a", function() {}); 90o3.__defineGetter__("b", function() {}); 91delete o3.a; 92shouldThrow("o3.b.property"); 93 94var o4 = { a: 1 }; 95o4.__defineGetter__("a", function() {}); 96o4.__defineGetter__("b", function() {}); 97delete o4.b; 98shouldThrow("o4.a.property"); 99 100var o5 = { b: 1 }; 101o5.__defineSetter__("a", function() {}); 102o5.__defineSetter__("b", function() {}); 103delete o5.a; 104shouldThrow("o5.b.property"); 105 106var o6 = { a: 1 }; 107o6.__defineSetter__("a", function() {}); 108o6.__defineSetter__("b", function() {}); 109delete o6.b; 110shouldThrow("o6.a.property"); 111 112var o7 = { b: 1 }; 113o7.__defineGetter__("a", function() {}); 114o7.__defineGetter__("b", function() {}); 115delete o7.a; 116shouldThrow("o7.b.property"); 117 118var o8 = { a: 1 }; 119o8.__defineGetter__("a", function() {}); 120o8.__defineGetter__("b", function() {}); 121delete o8.b; 122shouldThrow("o8.a.property"); 123