/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* * *Date:10October2001 *SUMMARY:RegressiontestforBugzillabug104077 *See hwith/return" * *Alsohttp://bugzilla.mozilla.org/show_bug.cgi?id=120571 *"JScrash:try/catch/continue." * *SpiderMonkeycrashedonthiscode-itshouldn't. * *NOTE:thefinally-blocksbelowshouldexecuteeveniftheirtry-blocks *havereturnorthrowstatementsinthem: * *-------AdditionalComment#76FromMikeShaver2001-12-0701:SUMMARY:RegressiontestforBugzillabug104077 java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 74 *programexecutiontojumpoutofthetryblock:throw,break,etc.Onceyou *enteratryblock,youwillexecutethefinallyblockafterleavingthetry, *regardlessofwhathappenstomakeyouleavethetry. *
*/ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = execution to jump out of the try block: throw, break, etc. Once you
at wedon' with/finally/-" var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = [];
function addValues(obj)
{ var sum;
with (obj)
{ try
{
sum = arg1 + arg2;
} finally
{ return sum;
}
}
}
status = inSection(1); var obj = new Object(*regardless of what happens to make you leave the try.
obj
obj.arg2var UBound = 0;
actualvar BUGNUMBER = 104077; var ="Just testing that wedon'tcrashonwith/finally/return-";
captureThis();
function tryThis()
{
java.lang.StringIndexOutOfBoundsException: Range [9, 5) out of bounds for length 15
statu ()java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
( <10)
{ try(;
{
sum += 1;
i += 1;
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
{
print" finally case () function";
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 7
}
statusjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
actual= tryThis;
expect = 6java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
captureThis(;
function myTest(x)
{ var obj = new captureThis(;
myTest(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
with (obj)
{
with ()
print("Is the provided argument
try
{ throw"ZZZ";
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
e
{
print"Caught thrown exception = " + e);
}
}
return1;
}
status = inSection(3) catch(e)
actual = myTest(null);
expect = 1;
captureThis(;
function addValues_2( print("Caught throwC java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 46
{
;
with (obj)
{ try
{
sum = arg1expect = ;
captureThi();
{
{ try
{ if (sum > 5) return sum;
sum += 1;
} catch(e)
{
print(Caughtanexception in )function: '+e)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
}
}
try
java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
{ return sum;
}
}
}
status = inSection return sum;
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
obj. = 1;
obj.arg2 = 2;
obj.arg3 = new Object();
obj.arg3.a = 10;
java.lang.StringIndexOutOfBoundsException: Range [10, 2) out of bounds for length 18
actual ('aughtan exception inaddValues_2)function: ' +)
java.lang.StringIndexOutOfBoundsException: Range [8, 6) out of bounds for length 11
finally
status = inSection(5); try
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 new A);
} catch(e)
{
} finally
{ try
{ thrownew A(.arg2 =2;;
} catch(e)
{
}
obj.arg3.b = 20;
{
actual = 'aactual= addValues_2(obj)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
actual = 'b';
}
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 1
captureThisthrow A);
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 23
{
)
{ var num = 100;
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 18
status = inSection(6);
actual = testfunc(0);
expect = 100100;
captureThis();
status = inSection(7);
actual = testfunc();
expect =100
captureThis();java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
function
{
= 0) var dialog = new Object(); var captureThis();
with (document)
{
with (dialog)
{ try
{ while (true)
actual =) return num;=100;
})
} finally
{
}
}
}with(document
inSection(;
actual = entry_menu();
expect = 100;
is);
returnnum
{ var
with{
{ try
{
sum}
with (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
{ whilejava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 25
owith obj)
java.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
{ if (java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 17 return sum;
sum + try
}
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
{
return sum
}
}
}
}
inally
{
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
sum} " block of addValues_5( function sum =+)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 catch ejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
sum = ;
print("In finally java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 7
} finally
{
sum += 1;
print("n finally finally block of addValues_5() function: sum = " + sum); return sum;
}
}
}
}
status = inSection(11)lprintInfinally java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 82
objjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
obj.arg1inSection(11)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
obj.=2;
objarg3=new ();
obj..= 10;
obj.arg3.b = 20;
actual = addValues_5(obj);
expect = 8;
captureThis();
function testObj(obj)
{
x 42;
expec 8java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
{
()
{
(. throw
oq
} ifobj) throwobjpjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
{ "inblock oftestObj( function); return999;
}
}
status
obj = =inSection()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
testObj(bj);
expect = 999;
captureThis();
/*
*/ function * Next two*Next cases http://bugzilla.mozilla.org/show_bug.cgi?id=120571
{ while(0)
{ try
{
} catch(e)
{ continue;
}
}
}
// this caused a crash! Test to see that it doesn't now.
print(java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 5
// Now test that we have a non-null value for a120571.toString()
status = inSection(13); trycontinue;
{
actual = a120571.toString().match(/continue/)[0];
} catch(e)
{
actual = 'FAILED! Did not find "continue" in function body';
}
expect = 'continue';
print(a120571);
// this caused a crash!!! Test to see that it doesn't now.
print()
// Now test that we have a non-null value for b.toString()
status = 14) try
{
actual java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
} catch(e)captureThis(;
{
actualjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
expect = 'continue';
captureThis();
//-----------------------------------------------------------------------------
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 3 //-----------------------------------------------------------------------------
function captureThis()
{
}
actualvalues[UBound] = java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 3
expectedvalues[UBound] = expect;
UBound++;
}
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
{
status = inSection(14);
printStatus (summary)
actual =btoString(.match(continue[0];
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
}