Bug 11579

Summary: Fix test script error when checking the correct result.
Product: WebKit Reporter: digdog
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: ap
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
patch.txt ap: review-

Description digdog 2006-11-12 00:59:48 PST
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
Comment 1 digdog 2006-11-12 01:03:28 PST
Created attachment 11492 [details]
Comment 2 digdog 2006-11-12 09:09:38 PST
Comment on attachment 11492 [details]

remove patch due non-PST timezone regression appeared (http://bugs.webkit.org/show_bug.cgi?id=4930)
Comment 3 digdog 2006-11-12 09:10:52 PST
Created attachment 11498 [details]

correct the expected results
Comment 4 Darin Adler 2006-11-18 17:44:45 PST
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.
Comment 5 digdog 2006-11-18 18:23:30 PST
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.
Comment 6 Alexey Proskuryakov 2006-11-24 12:00:02 PST
Is this the same as bug 4263? Please note the difference between this test and js1_3/Boolean/boolean-001.js.
Comment 7 digdog 2006-11-24 21:52:27 PST
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.
Comment 8 Alexey Proskuryakov 2006-11-24 23:05:13 PST
(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 ***