toBoolean should support arrays

RESOLVED INVALID

Status

Rhino
Core
RESOLVED INVALID
14 years ago
14 years ago

People

(Reporter: Justin Edelson, Assigned: Igor Bukanov)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
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
(Reporter)

Comment 1

14 years ago
Created attachment 148417 [details] [diff] [review]
proposed patch
(Assignee)

Comment 2

14 years ago
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
Last Resolved: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.