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/. */
8
* File Name: eval-003.js
9
* Description: (SEE REVISED DESCRIPTION FURTHER BELOW)
11
* The global eval function may not be accessed indirectly and then called.
12
* This feature will continue to work in JavaScript 1.3 but will result in an
13
* error in JavaScript 1.4. This restriction is also in place for the With and
14
* Closure constructors.
16
* http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451
18
* Author: christine@netscape.com
19
* Date: 11 August 1998
22
* REVISION: 05 February 2001
23
* Author: pschwartau@netscape.com
25
* Indirect eval IS NOT ILLEGAL per ECMA3!!! See
27
* http://bugzilla.mozilla.org/show_bug.cgi?id=38512
29
* ------- Additional Comments From Brendan Eich 2001-01-30 17:12 -------
30
* ECMA-262 Edition 3 doesn't require implementations to throw EvalError,
31
* see the short, section-less Chapter 16. It does say an implementation that
32
* doesn't throw EvalError must allow assignment to eval and indirect calls
33
* of the evalnative method.
36
var SECTION = "eval-003.js";
37
var VERSION = "JS1_4";
38
var TITLE = "Calling eval indirectly should NOT fail in version 140";
39
var BUGNUMBER="38512";
42
writeHeaderToLog( SECTION + " "+ TITLE);
47
var h = function f(x,y){var g = function(z){return Math.exp(z);}; return g(x+y);};
57
MY_EVAL( "RESULT = h(-1, 1)" );
58
EXPECT = 1; //The base e to the power (-1 + 1), i.e. the power 0, equals 1 ....
62
"Call eval indirectly",