1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/Regress/regress-156354.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,97 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * 1.11 + * Date: 16 September 2002 1.12 + * SUMMARY: Testing propertyIsEnumerable() on nonexistent property 1.13 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=156354 1.14 + * 1.15 + */ 1.16 +//----------------------------------------------------------------------------- 1.17 +var UBound = 0; 1.18 +var BUGNUMBER = 156354; 1.19 +var summary = 'Testing propertyIsEnumerable() on nonexistent property'; 1.20 +var status = ''; 1.21 +var statusitems = []; 1.22 +var actual = ''; 1.23 +var actualvalues = []; 1.24 +var expect= ''; 1.25 +var expectedvalues = []; 1.26 + 1.27 + 1.28 +status = inSection(1); 1.29 +actual = this.propertyIsEnumerable('XYZ'); 1.30 +expect = false; 1.31 +addThis(); 1.32 + 1.33 +status = inSection(2); 1.34 +actual = this.propertyIsEnumerable(''); 1.35 +expect = false; 1.36 +addThis(); 1.37 + 1.38 +status = inSection(3); 1.39 +actual = this.propertyIsEnumerable(undefined); 1.40 +expect = false; 1.41 +addThis(); 1.42 + 1.43 +status = inSection(4); 1.44 +actual = this.propertyIsEnumerable(null); 1.45 +expect = false; 1.46 +addThis(); 1.47 + 1.48 +status = inSection(5); 1.49 +actual = this.propertyIsEnumerable('\u02b1'); 1.50 +expect = false; 1.51 +addThis(); 1.52 + 1.53 + 1.54 +var obj = {prop1:null}; 1.55 + 1.56 +status = inSection(6); 1.57 +actual = obj.propertyIsEnumerable('prop1'); 1.58 +expect = true; 1.59 +addThis(); 1.60 + 1.61 +status = inSection(7); 1.62 +actual = obj.propertyIsEnumerable('prop2'); 1.63 +expect = false; 1.64 +addThis(); 1.65 + 1.66 +// let's try one via eval(), too - 1.67 +status = inSection(8); 1.68 +eval("actual = obj.propertyIsEnumerable('prop2')"); 1.69 +expect = false; 1.70 +addThis(); 1.71 + 1.72 + 1.73 + 1.74 +//----------------------------------------------------------------------------- 1.75 +test(); 1.76 +//----------------------------------------------------------------------------- 1.77 + 1.78 + 1.79 +function addThis() 1.80 +{ 1.81 + statusitems[UBound] = status; 1.82 + actualvalues[UBound] = actual; 1.83 + expectedvalues[UBound] = expect; 1.84 + UBound++; 1.85 +} 1.86 + 1.87 + 1.88 +function test() 1.89 +{ 1.90 + enterFunc('test'); 1.91 + printBugNumber(BUGNUMBER); 1.92 + printStatus(summary); 1.93 + 1.94 + for (var i=0; i<UBound; i++) 1.95 + { 1.96 + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); 1.97 + } 1.98 + 1.99 + exitFunc ('test'); 1.100 +}