Bug - Fixed Debug log printed with arrays containing nulls (or undefined)

Ryo_Sangnoir

Developer
Staff member
I hit this while passing a function with an invalid return -- e.g. "[1].map(x => x.key)" would output [undefined], but trying to print this on the GCLI crashes.

Code:
> js null
Returned: null

>    js undefined
Returned:    org.mozilla.javascript.Undefined@7fadecaf

> js    [null]
Unexpected error, debug log printed.

>    js [1, null]
Returned: aggregate float [2]
0 => 1.0
Unexpected error, debug log printed.

> js dump(null)
Script    exception: Could not coerce argument to valid ASH value. (command line#1)
Returned:    null

> js dump(undefined)
org.mozilla.javascript.Undefined@7fadecaf
Returned:    null

> js [1,,]
Returned: aggregate float    [2]
0 => 1.0
Unexpected error, debug log printed.

>    js [,1,]
Unexpected error, debug log printed.

I'm not sure what the right behaviour is here: printing null and the class name seem the most useful, but raising the exception is probably correct. Any thoughts?
 
Top