in tests/mozilla/js1_2/version120/boolean-001.js, the test script check the Bollean object by using RelationalExpression directly: object = new Bollean(false); if (object) { // is true } else { // is false } Though the object value is false, but the IF statement will apply ToBollean operator (ECMA 9.3) with Object, and return true always. To fix this, simply use "EqualityExpression == RelationalExpression" in the IF statement instead: object = new Bollean(false); if (object == true) { // is true } else { // is false }
Created attachment 11492 [details] patch.txt
Comment on attachment 11492 [details] patch.txt remove patch due non-PST timezone regression appeared (http://bugs.webkit.org/show_bug.cgi?id=4930)
Created attachment 11498 [details] patch.txt correct the expected results
Is this really a mistake in the test, or a bug in our engine? I'm wondering why this test passed in Spider Monkey and Rhino.
huh, I tried SpiderMonkey before, it's failed. Here's the result of SpiderMonkey (lastest cvs build) boolean-001.js new Boolean(false) should evaluate to false new Boolean(true) = true PASSED! new Boolean(false) = true FAILED! expected: false true = true PASSED! false = false PASSED! At least based on ECMA spec., the ToBoolean(Object) will always return true, and we are acting same with SpiderMonkey on this.
Is this the same as bug 4263? Please note the difference between this test and js1_3/Boolean/boolean-001.js.
Yes, same with bug 4263, but what they are talking about is not the cause, ther really cause that failed the test was the comment I described on the top. And if you check js1_3/Boolean/boolean-001.js, you will note that they were expected "new Boolean(false)" to return true when using RelationalExpression directly (js1.6 does same way): BooleanTest( "new Boolean(false)", new Boolean(false), true ); Since JavaScriptCore is not planning on support the early specification, we would suggest to ignore and disable this js1.2 test.
(In reply to comment #7) > Since JavaScriptCore is not planning on support the early specification, we > would suggest to ignore and disable this js1.2 test. OK, so I'm r-'ing the attached patch, as it does something different. *** This bug has been marked as a duplicate of 4263 ***