Bug 4263 - Version bug: js1_2/version120/boolean-001.js
Summary: Version bug: js1_2/version120/boolean-001.js
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Geoffrey Garen
: 11579 (view as bug list)
Depends on:
Blocks: 4262
  Show dependency treegraph
Reported: 2005-08-01 22:40 PDT by Geoffrey Garen
Modified: 2011-06-13 17:10 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2005-08-01 22:40:55 PDT
This test fails because it expects new Boolean(false) to return false, as it did in JS 1.2.
Comment 1 Justin Haygood 2006-02-28 21:20:39 PST
Comparison to other JS engines without having a version set:

JS 1.6 (Firefox / Windows)
* Returns False

JScript 5.6 (Internet Explorer 6 SP2 / Windows)
* Returns False

Should we follow this old behavior since JScript and JS both do this?
Comment 2 Geoffrey Garen 2006-03-01 09:36:06 PST
It looks like new Boolean(false) is supposed to return false in JS 1.5: new Boolean(value)
The [[Prototype]] property of the newly constructed object is set to the original Boolean prototype object, the one that is the initial value of Boolean.prototype (

The [[Class]] property of the newly constructed Boolean object is set to "Boolean".

The [[Value]] property of the newly constructed Boolean object is set to ToBoolean(value).
Comment 3 Alexey Proskuryakov 2006-11-24 23:05:13 PST
*** Bug 11579 has been marked as a duplicate of this bug. ***
Comment 4 digdog 2006-11-26 00:50:43 PST
The real cause that failed the test was IF statement.

var variable = new Boolean(false);
if (variable == false) print("EqualityExpression == RelationalExpression will be true");
if (variable) print("RelationalExpression will apply ToBollean operator on this Boolean 'object'"); // js1.2 sample use this, and expect the result of IF statement will be 'false'

In the sample above, JSCore and other JS engines are acting the same, both these two IF statements will be true, since 'variable' is a Boolean 'object' not a 'boolean' value, so the second IF statement will apply ToBollean(Object) and return true.

If you check js1_3/Boolean/boolean-001.js, you will see they already fixed this issue. (http://bugs.webkit.org/show_bug.cgi?id=11579#c7)
Comment 5 Gavin Barraclough 2011-06-13 17:10:54 PDT
We don't support language versions in JSC (other than strict / non-strict), and al behaviour seems ES5 compliant.  I don't think we need change anything here - the test documents our deliberate non-compliance with JS1.2.