js/src/tests/ecma_3/ExecutionContexts/10.1.4-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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 }.
    14    * Eval Code
    15    Variable instantiation is performed using the calling context's
    16    variable object and using empty property attributes.
    17 */
    19 var BUGNUMBER = '(none)';
    20 var summary = '10.1.4.1 Entering An Execution Context';
    21 var actual = '';
    22 var expect = '';
    24 test();
    26 function test()
    27 {
    28   enterFunc ("test");
    29   printBugNumber(BUGNUMBER);
    30   printStatus (summary);
    32   var y;
    33   eval("var x = 1");
    35   if (delete y)
    36     reportCompare('PASS', 'FAIL', "Expected *NOT* to be able to delete y");
    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()");
    43   if (!delete x)
    44     reportCompare('PASS', 'FAIL', "Expected to be able to delete x");
    46   reportCompare('PASS', 'PASS', '10.1.4.1 Entering An Execution Context');
    48   exitFunc("test");       
    49 }

mercurial