Closed Bug 1665746 Opened 4 years ago Closed 4 years ago

TypeError: iterable is not iterable

Categories

(Core :: JavaScript Engine, defect, P3)

Firefox 82
defect

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: pomax, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached image screenshot.333.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

var a = new Set([1,2,3]);
var b = new Set([2,3,4]);
var c = new Set(...a, ...b);

Actual results:

This throws an error "Uncaught TypeError: iterable is not iterable", which is quite impressive

Expected results:

A TypeError that wasn't self-contraditory. The Set constructor takes a single argument, which must be an iterable, so if you call it as new Set(1) you get an error that makes sense:

"Uncaught TypeError: 1 is not iterable"

But it seems to not actually report on the true argument when deferencing: it feels like it's trying to report on the construction ...input itself, rather than on what that actually turns into (namely, single elements).

Note that this will not happen for something like new Set('a', 'b', 'c') or new Set(...['a','b','c']) as strings are iterable. You'll just get a single element Set containing just a in both cases.

it's using the following variable name for reporting
https://searchfox.org/mozilla-central/rev/5efefd3ef214ed6d3234ba245c1da3004ead94e0/js/src/builtin/Set.js#18

function SetConstructorInit(iterable) {
...
   for (var nextValue of allowContentIter(iterable))

fix would be either:

  • use more descriptive variable name there
  • do not use decompiler for self-hosted JS code
Blocks: jserror
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Severity: -- → S4
Priority: -- → P3

We already have a logic that tries to get arguments, but if it fails, it prints parameter name.
https://searchfox.org/mozilla-central/rev/5efefd3ef214ed6d3234ba245c1da3004ead94e0/js/src/vm/BytecodeUtil.cpp#1782-1808

we should instead abort decompiler for this case.

Attachment #9176594 - Attachment description: Bug 1665746 - Do not use self-hosted JS parameter name in decompiler. r?jorendorff! → Bug 1665746 - Do not use self-hosted JS parameter name in decompiler. r?evilpie!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/f50e7b70132a
Do not use self-hosted JS parameter name in decompiler. r=evilpie
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: