1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/Regress/regress-68498-003.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 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 + * Date: 15 Feb 2001 1.11 + * 1.12 + * SUMMARY: calling obj.eval(str) 1.13 + * 1.14 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 1.15 + * See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 1.16 + * 1.17 + * Brendan: 1.18 + * 1.19 + * "Backward compatibility: support calling obj.eval(str), which evaluates 1.20 + * str using obj as the scope chain and variable object." 1.21 + */ 1.22 +//----------------------------------------------------------------------------- 1.23 +var BUGNUMBER = 68498; 1.24 +var summary = 'Testing calling obj.eval(str)'; 1.25 +var statprefix = '; currently at expect['; 1.26 +var statsuffix = '] within test -'; 1.27 +var actual = [ ]; 1.28 +var expect = [ ]; 1.29 + 1.30 + 1.31 +// Capture a reference to the global object - 1.32 +var self = this; 1.33 + 1.34 +// This function is the heart of the test - 1.35 +function f(s) {self.eval(s); return y;} 1.36 + 1.37 + 1.38 +// Set the actual-results array - 1.39 +actual[0] = f('var y = 43'); 1.40 +actual[1] = 'y' in self && y; 1.41 +actual[2] = delete y; 1.42 +actual[3] = 'y' in self; 1.43 + 1.44 +// Set the expected-results array - 1.45 +expect[0] = 43; 1.46 +expect[1] = 43; 1.47 +expect[2] = true; 1.48 +expect[3] = false; 1.49 + 1.50 + 1.51 +//------------------------------------------------------------------------------------------------- 1.52 +test(); 1.53 +//------------------------------------------------------------------------------------------------- 1.54 + 1.55 + 1.56 +function test() 1.57 +{ 1.58 + enterFunc ('test'); 1.59 + printBugNumber(BUGNUMBER); 1.60 + printStatus (summary); 1.61 + 1.62 + for (var i in expect) 1.63 + { 1.64 + reportCompare(expect[i], actual[i], getStatus(i)); 1.65 + } 1.66 + 1.67 + exitFunc ('test'); 1.68 +} 1.69 + 1.70 + 1.71 +function getStatus(i) 1.72 +{ 1.73 + return (summary + statprefix + i + statsuffix); 1.74 +}