2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
19 * Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
22 * SUMMARY: Testing the arguments object
24 * See http://bugzilla.mozilla.org/show_bug.cgi?id=72884
26 //-------------------------------------------------------------------------------------------------
29 var summary = 'Testing the arguments object';
31 var statusitems = [ ];
33 var actualvalues = [ ];
35 var expectedvalues = [ ];
39 status = inSection(1);
42 delete arguments.length;
47 actual = a instanceof Object;
51 actual = a instanceof Array;
61 status = inSection(2);
63 actual = a instanceof Object;
67 actual = a instanceof Array;
89 status = inSection(3);
93 * Note that only callee and length can be overridden, so deleting an indexed
94 * property and asking for it again causes it to be recreated by args_resolve:
96 * function g(){delete arguments[0]; return arguments[0]}
97 * g(42) // should this print 42?
99 * I'm not positive this violates ECMA, which allows in chapter 16 for extensions
100 * including properties (does it allow for magically reappearing properties?). The
101 * delete operator successfully deletes arguments[0] and results in true, but that
102 * is not distinguishable from the case where arguments[0] was delegated to
103 * Arguments.prototype[0], which was how the bad old code worked.
105 * I'll ponder this last detail...
107 * UPDATE: Per ECMA-262, delete on an arguments[i] should succeed
108 * and remove that property from the arguments object, leaving any get
109 * of it after the delete to evaluate to undefined.
117 expect = undefined; // not 42...
122 //-------------------------------------------------------------------------------------------------
124 //-------------------------------------------------------------------------------------------------
129 statusitems[UBound] = status;
130 actualvalues[UBound] = actual;
131 expectedvalues[UBound] = expect;
139 printBugNumber (bug);
140 printStatus (summary);
142 for (var i = 0; i < UBound; i++)
144 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);