| 1 |
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */ |
| 5 |
|
| 6 |
/* |
| 7 |
* |
| 8 |
* Date: 12 Apr 2002 |
| 9 |
* SUMMARY: delete arguments[i] should break connection to local reference |
| 10 |
* |
| 11 |
* See http://bugzilla.mozilla.org/show_bug.cgi?id=137181 |
| 12 |
* |
| 13 |
*/ |
| 14 |
//----------------------------------------------------------------------------- |
| 15 |
var UBound = 0; |
| 16 |
var BUGNUMBER = 137181; |
| 17 |
var summary = 'delete arguments[i] should break connection to local reference'; |
| 18 |
var status = ''; |
| 19 |
var statusitems = []; |
| 20 |
var actual = ''; |
| 21 |
var actualvalues = []; |
| 22 |
var expect= ''; |
| 23 |
var expectedvalues = []; |
| 24 |
|
| 25 |
|
| 26 |
status = inSection(1); |
| 27 |
function f1(x) |
| 28 |
{ |
| 29 |
x = 1; |
| 30 |
delete arguments[0]; |
| 31 |
return x; |
| 32 |
} |
| 33 |
actual = f1(0); // (bug: Rhino was returning |undefined|) |
| 34 |
expect = 1; |
| 35 |
addThis(); |
| 36 |
|
| 37 |
|
| 38 |
status = inSection(2); |
| 39 |
function f2(x) |
| 40 |
{ |
| 41 |
x = 1; |
| 42 |
delete arguments[0]; |
| 43 |
arguments[0] = -1; |
| 44 |
return x; |
| 45 |
} |
| 46 |
actual = f2(0); // (bug: Rhino was returning -1) |
| 47 |
expect = 1; |
| 48 |
addThis(); |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
//----------------------------------------------------------------------------- |
| 53 |
test(); |
| 54 |
//----------------------------------------------------------------------------- |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
function addThis() |
| 59 |
{ |
| 60 |
statusitems[UBound] = status; |
| 61 |
actualvalues[UBound] = actual; |
| 62 |
expectedvalues[UBound] = expect; |
| 63 |
UBound++; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
function test() |
| 68 |
{ |
| 69 |
printBugNumber(BUGNUMBER); |
| 70 |
printStatus(summary); |
| 71 |
|
| 72 |
for (var i=0; i<UBound; i++) |
| 73 |
{ |
| 74 |
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
| 75 |
} |
| 76 |
} |