Closed Bug 1580727 Opened 5 years ago Closed 3 years ago

Javascript Array with empty slots are displayed as undefined in the console

Categories

(DevTools :: Console, defect, P3)

70 Branch
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: laranda, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Attached image firefox-empy-array.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

Steps to reproduce:

Create an empty array with the Array constructor.
Example :
Array(9)

Actual results:

In the console, the array is logged as :
Array(9) [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined ]

Expected results:

The array should be displayed as filled with empty values instead of undefined.
Example :
Array(9) [empty x 9]

Component: JavaScript Engine → Console
Product: Core → DevTools

Thanks laranda. We have a way to handle empty slots in our code, so something broke somehow and wasn't caught by tests. I'll investigate

Status: UNCONFIRMED → NEW
Type: enhancement → defect
Ever confirmed: true

Looks like it was regressed by Bug 1565781.

Basically we now return an "undefined" grip ({type: "undefined"}), instead of returning null (which we implicitly then use for empty slots).
I think it's a good time to fix this properly, and return an adequate grip (e.g. {type: "emptySlot"}) instead of this easy-to-miss null.

Regressed by: 1565781
Priority: -- → P3
Has Regression Range: --- → yes

looks like this has been fixed at some point

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: