Bug 485889 - Incorrect null checking/assignment? (with xpcshell test case). r=gal

This commit is contained in:
Jeff Walden 2009-03-30 17:15:42 -07:00
parent 877ebdcc1f
commit f156a254b7
2 changed files with 24 additions and 2 deletions

View File

@ -5043,8 +5043,10 @@ TraceRecorder::ifop()
bool cond;
LIns* x;
/* Objects always evaluate to true since we specialize the Null type on trace. */
if (JSVAL_TAG(v) == JSVAL_OBJECT) {
if (JSVAL_IS_NULL(v)) {
cond = false;
x = lir->insImm(0);
} else if (!JSVAL_IS_PRIMITIVE(v)) {
cond = true;
x = lir->insImm(1);
} else if (JSVAL_TAG(v) == JSVAL_BOOLEAN) {

View File

@ -4740,6 +4740,26 @@ testNewString.jitstats = {
};
test(testNewString);
function testWhileObjectOrNull()
{
try
{
for (var i = 0; i < 3; i++)
{
var o = { p: { p: null } };
while (o.p)
o = o.p;
}
return "pass";
}
catch (e)
{
return "threw exception: " + e;
}
}
testWhileObjectOrNull.expected = "pass";
test(testWhileObjectOrNull);
/*****************************************************************************
* *