]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/js1_4/Eval/eval-002.js
JavaScriptCore-461.tar.gz
[apple/javascriptcore.git] / tests / mozilla / js1_4 / Eval / eval-002.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
5 *
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
10 *
11 * The Original Code is Mozilla Communicator client code, released March
12 * 31, 1998.
13 *
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 */
22 /**
23 * File Name: eval-002.js
24 * Description: (SEE REVISED DESCRIPTION FURTHER BELOW)
25 *
26 * The global eval function may not be accessed indirectly and then called.
27 * This feature will continue to work in JavaScript 1.3 but will result in an
28 * error in JavaScript 1.4. This restriction is also in place for the With and
29 * Closure constructors.
30 *
31 * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451
32 *
33 * Author: christine@netscape.com
34 * Date: 11 August 1998
35 *
36 *
37 * REVISION: 05 February 2001
38 * Author: pschwartau@netscape.com
39 *
40 * Indirect eval IS NOT ILLEGAL per ECMA3!!! See
41 *
42 * http://bugzilla.mozilla.org/show_bug.cgi?id=38512
43 *
44 * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 -------
45 * ECMA-262 Edition 3 doesn't require implementations to throw EvalError,
46 * see the short, section-less Chapter 16. It does say an implementation that
47 * doesn't throw EvalError must allow assignment to eval and indirect calls
48 * of the evalnative method.
49 *
50 */
51 var SECTION = "eval-002.js";
52 var VERSION = "JS1_4";
53 var TITLE = "Calling eval indirectly should NOT fail in version 140";
54 var BUGNUMBER="38512";
55
56 startTest();
57 writeHeaderToLog( SECTION + " "+ TITLE);
58
59 var testcases = new Array();
60
61 var MY_EVAL = eval;
62 var RESULT = "";
63 var EXPECT = 1 + "testString"
64
65 EvalTest();
66
67 test();
68
69
70 function EvalTest()
71 {
72 MY_EVAL( "RESULT = EXPECT" );
73
74 testcases[tc++] = new TestCase(
75 SECTION,
76 "Call eval indirectly",
77 EXPECT,
78 RESULT );
79 }
80