Closed Bug 815014 Opened 13 years ago Closed 6 years ago

Function#arguments should be same as the standard arguments object

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: emk, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [js:t])

Steps to reproduce: var a = function(x, y, z) { return a.arguments === arguments; }; a(1, 2, 3); Actual result: false Expected result: true
I'm not sure we actually want to fix this, given that I'm pretty sure this is the case specifically to implement various perf optimizations, and that .arguments is non-standard as well. More generally, I have serious reservations about "standardizing", or even documenting, some of the things this "JavaScript spec" wants to standardize. Except in the specific sections where there is clear agreement, I think we should ignore it, and I don't think we should file bugs on so-called "deviations" from it.
I agree with Jeff. Plus, I don't see any benefit from this "feature" and have never heard of any compat problems. WONTFIX please.
(In reply to Florian Bender from comment #2) > I don't see any benefit from this "feature" The obvious benefit would be interoperability. Most other major ECMAScript engines implement it as described here: http://javascript.spec.whatwg.org/#function.prototype.arguments Tests are available here: http://mathias.html5.org/tests/javascript/function/
If nobody (i. e. no web developers) uses it (and nobody should, it's a terrible feature which serves no real value*), there is no need for interop. * I'm open for real-life examples that make use of this feature (and cannot be solved otherwise) to revert my opinion. (In reply to Mathias Bynens from comment #3) > Most other major ECMAScript engines implement it […] Can you name them, please?
(In reply to Florian Bender from comment #4) > If nobody (i. e. no web developers) uses it (and nobody should, it's a > terrible feature which serves no real value*), there is no need for interop. Let's remove the non-standard feature if really nobody uses it. Then JavaScript spec author will gladly remove it from the spec. > (In reply to Mathias Bynens from comment #3) > > Most other major ECMAScript engines implement it […] > Can you name them, please? At least Chrome, IE10, Opera 12.10.
(In reply to Florian Bender from comment #4) > > > Most other major ECMAScript engines implement it […] > > Can you name them, please? > At least Chrome, IE10, Opera 12.10. Safari/JavaScriptCore, too.
(In reply to Masatoshi Kimura [:emk] from comment #5) > Let's remove the non-standard feature if really nobody uses it. > Then JavaScript spec author will gladly remove it from the spec. Yeah, that's the way I'd choose. So, does anybody have any real-life examples where this is necessary? Wherever a web dev uses this feature, the web site should be broken in Fx (compared to other browsers). Any links (or workaround code that is necessary in any framework/toolkit for Fx support)?
FYI, IonMonkey is in some *rare* cases unable to fully recover “a.arguments”, so it might not even be equal to “a.arguments” when called with a different stack.
Whiteboard: [js:t]
Assignee: general → nobody

(In reply to Masatoshi Kimura [:emk] from comment #0)

var a = function(x, y, z) {
return a.arguments === arguments;
};
a(1, 2, 3);

Actual result: false

That behaviour is shared by other mainstream browsers, and it is expected to be standardised that way.

Therefore, this is Working as intended per Bug 1615704.

Flags: needinfo?(evilpies)
Blocks: 1615704
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(evilpies)
Resolution: --- → WORKSFORME
Resolution: WORKSFORME → INVALID
You need to log in before you can comment on or make changes to this bug.