js/src/tests/js1_5/Regress/regress-68498-001.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/Regress/regress-68498-001.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * Date: 15 Feb 2001
    1.11 + *
    1.12 + * SUMMARY: var self = global JS object, outside any eval, is DontDelete
    1.13 + *
    1.14 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
    1.15 + * See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
    1.16 + *
    1.17 + * Brendan:
    1.18 + *
    1.19 + * "Demonstrate that variable statement outside any eval creates a
    1.20 + *   DontDelete property of the global object"
    1.21 + */
    1.22 +//-----------------------------------------------------------------------------
    1.23 +var BUGNUMBER = 68498;
    1.24 +var summary ='Testing that variable statement outside any eval creates'  +
    1.25 +  ' a DontDelete property of the global object';
    1.26 +
    1.27 +
    1.28 +// To be pedantic, use a variable named 'self' to capture the global object -
    1.29 +// conflicts with window.self in browsers
    1.30 +var _self = this;
    1.31 +var actual = (delete _self);
    1.32 +var expect =false;
    1.33 +
    1.34 +
    1.35 +//-----------------------------------------------------------------------------
    1.36 +test();
    1.37 +//-----------------------------------------------------------------------------
    1.38 +
    1.39 +
    1.40 +function test()
    1.41 +{
    1.42 +  enterFunc ('test');
    1.43 +  printBugNumber(BUGNUMBER);
    1.44 +  printStatus (summary); 
    1.45 +  reportCompare(expect, actual, summary);
    1.46 +  exitFunc ('test');
    1.47 +}

mercurial