|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
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 |
|
7 /** |
|
8 ECMA Section: 10.1.4.1 Entering An Execution Context |
|
9 ECMA says: |
|
10 * Global Code, Function Code |
|
11 Variable instantiation is performed using the global object as the |
|
12 variable object and using property attributes { DontDelete }. |
|
13 |
|
14 * Eval Code |
|
15 Variable instantiation is performed using the calling context's |
|
16 variable object and using empty property attributes. |
|
17 */ |
|
18 |
|
19 var BUGNUMBER = '(none)'; |
|
20 var summary = '10.1.4.1 Entering An Execution Context'; |
|
21 var actual = ''; |
|
22 var expect = ''; |
|
23 |
|
24 test(); |
|
25 |
|
26 function test() |
|
27 { |
|
28 enterFunc ("test"); |
|
29 printBugNumber(BUGNUMBER); |
|
30 printStatus (summary); |
|
31 |
|
32 var y; |
|
33 eval("var x = 1"); |
|
34 |
|
35 if (delete y) |
|
36 reportCompare('PASS', 'FAIL', "Expected *NOT* to be able to delete y"); |
|
37 |
|
38 if (typeof x == "undefined") |
|
39 reportCompare('PASS', 'FAIL', "x did not remain defined after eval()"); |
|
40 else if (x != 1) |
|
41 reportCompare('PASS', 'FAIL', "x did not retain it's value after eval()"); |
|
42 |
|
43 if (!delete x) |
|
44 reportCompare('PASS', 'FAIL', "Expected to be able to delete x"); |
|
45 |
|
46 reportCompare('PASS', 'PASS', '10.1.4.1 Entering An Execution Context'); |
|
47 |
|
48 exitFunc("test"); |
|
49 } |