Destructuring assignment of function arguments object is broken

RESOLVED FIXED in mozilla46

Status

()

RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: torbasow, Unassigned)

Tracking

({regression, reproducible, testcase})

34 Branch
mozilla46
x86_64
Windows 7
regression, reproducible, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Build ID: 20141113143407

Steps to reproduce:

(function test(a, b){let [x, y]=arguments;})(1,2);


Actual results:

undefined


Expected results:

TypeError: arguments['@@iterator'] is not a function
(Reporter)

Comment 1

4 years ago
This works fine in Firefox 15, 21, 24, 25, 30, 32 and 33, although arguments was not iterable at Fx24 yet (bug 1067049). Try (function test(a, b){for(x of arguments);})(1,2). This works in Fx15 and doesn’t work in Fx24 and later.

Comment 2

4 years ago
2014-12-07-03-02-05-mozilla-central-firefox-37.0a1.ru.linux-x86_64

(function test(a, b){let [x, y]=arguments;})(1,2);
Exception: arguments[Symbol.iterator] is not a function

(function test(a, b){for(x of arguments);})(1,2)
Exception: arguments[Symbol.iterator] is not a function
QA Whiteboard: [bugday-20141208]
Jan, was this a deliberate change? I don't know enough about the spec here to know if this is supposed to work...
Component: Untriaged → JavaScript Engine
Flags: needinfo?(jdemooij)
Keywords: regression, regressionwindow-wanted, reproducible, testcase
Product: Firefox → Core
Summary: Restructuring assignment of arguments was broken → Destructuring assignment of function arguments object is broken
Problem is that `arguments` object don't have a Symbol.iterator property. In the spec I don't see @@iterator defined for arguments objects but maybe I'm missing something...
Flags: needinfo?(jdemooij) → needinfo?(jorendorff)
Per spec, "let [x, y] = foo" iterates foo twice and assigns the results to x and y.

Also per spec afaict arguments objects should be iterable, but we haven't fixed bug 1067049 yet.  Presumably we should just fix that.
Depends on: 1067049
Ah thanks Boris. Not sure how I missed that when I searched for @@iterator...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jorendorff)
Keywords: regressionwindow-wanted
Yup, this works now that bug 1067049 is fixed.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.