| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = 'eval-002.js'; |
| 7 | |
| 8 | /** |
| 9 | * File Name: eval-002.js |
| 10 | * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) |
| 11 | * |
| 12 | * The global eval function may not be accessed indirectly and then called. |
| 13 | * This feature will continue to work in JavaScript 1.3 but will result in an |
| 14 | * error in JavaScript 1.4. This restriction is also in place for the With and |
| 15 | * Closure constructors. |
| 16 | * |
| 17 | * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 |
| 18 | * |
| 19 | * Author: [email protected] |
| 20 | * Date: 11 August 1998 |
| 21 | * |
| 22 | * |
| 23 | * REVISION: 05 February 2001 |
| 24 | * Author: [email protected] |
| 25 | * |
| 26 | * Indirect eval IS NOT ILLEGAL per ECMA3!!! See |
| 27 | * |
| 28 | * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 |
| 29 | * |
| 30 | * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- |
| 31 | * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, |
| 32 | * see the short, section-less Chapter 16. It does say an implementation that |
| 33 | * doesn't throw EvalError must allow assignment to eval and indirect calls |
| 34 | * of the evalnative method. |
| 35 | * |
| 36 | */ |
| 37 | var SECTION = "eval-002.js"; |
| 38 | var VERSION = "JS1_4"; |
| 39 | var TITLE = "Calling eval indirectly should NOT fail in version 140"; |
| 40 | var BUGNUMBER="38512"; |
| 41 | |
| 42 | startTest(); |
| 43 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 44 | |
| 45 | var MY_EVAL = eval; |
| 46 | var RESULT = ""; |
| 47 | var EXPECT = 1 + "testString" |
| 48 | |
| 49 | EvalTest(); |
| 50 | |
| 51 | test(); |
| 52 | |
| 53 | |
| 54 | function EvalTest() |
| 55 | { |
| 56 | MY_EVAL( "RESULT = EXPECT" ); |
| 57 | |
| 58 | new TestCase( |
| 59 | SECTION, |
| 60 | "Call eval indirectly", |
| 61 | EXPECT, |
| 62 | RESULT ); |
| 63 | } |
| 64 |