Closed Bug 243524 Opened 20 years ago Closed 20 years ago

toBoolean should support arrays

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: justin.edelson, Assigned: igor)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

Currently, this line of JavaScript code throws an exception:
if (navigator.plugins)

because navigator.plugins is an array.

I'm honestly not sure if it's official or not, but I think it's generally
assumed that an array evaluates to true if it's not empty (or null)

Reproducible: Always
Steps to Reproduce:
I'm actually using Rhino through HttpUnit, so I'm not sure what specifically I
should put here.
Actual Results:  
IllegalArgumentException thrown

Expected Results:  
Parsed/exected normally
Attached patch proposed patchSplinter Review
This is HttpUnit bug in the implementation of the host object for navigator: the
host object should NOT return Java array but rather its properly JS-wrapped
implementation.
Status: NEW → RESOLVED
Closed: 20 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: