Closed Bug 458192 Opened 16 years ago Closed 16 years ago

ToBoolean incorrect for NativeBoolean, NativeString and NativeNumber

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mguillemot, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092510 Ubuntu/8.04 (hardy) Firefox/3.0.3 Build Identifier: ex: if (new Boolean(false)) throw "error" throws an error with Rhino. Reproducible: Always Steps to Reproduce: ECMA 9.2 specifies rules for Boolean, Number and String (as JS types) but Rhino implements these rules only for Boolean, Double and String (as Java types) but not for NativeBoolean, NativeNumber and NativeString what leads to wrong conversions. Provided patch includes unit tests and fix.
Makes ScriptRuntime.toBoolean behave as specified by ECMA 9.2
Oops, I've wrongly understood ECMA 9.2: current behaviour is OK according to it. BUT: we need a way to say that we don't want to be ECMA compliant here in order to behave like browsers do. Currently toBoolean does if (Context.getContext().isVersionECMA1()) { // pure ECMA return true; } what is not helpful at all.
Can a committer close this issue as invalid? I'll open a new one with a better title as enhancement.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: