Closed Bug 1521892 Opened 5 years ago Closed 5 years ago

console.table() throws if you pass in a non-zero indexed array

Categories

(DevTools :: Console, defect, P1)

defect

Tracking

(firefox66 fixed)

RESOLVED FIXED
Firefox 66
Tracking Status
firefox66 --- fixed

People

(Reporter: miker, Assigned: nchevobbe)

Details

Attachments

(1 file)

If you have an array starting with a non-zero index and try to use it with console.table() the console crashes.

STR

In the web console type the following:

var a = [];
a[2] = 5;
console.table(a);

The console will throw the following exception and become blank:

TypeError: data[index] is undefined ConsoleTable.js:174:11

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: -- → P1

This was throwing because we were retrieving a
property on a possible undefined value. We fix
this in this patch and add a test case to make
sure we don't regress this.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6f5c45fd0cc9
Fix console.table for holey arrays; r=miker.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: