Closed Bug 640541 Opened 15 years ago Closed 15 years ago

(function(){}).bind().arguments throw TypeError on NOT even strict mode

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: teramako, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0b13pre) Gecko/20110303 Firefox/4.0b13pre Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b13pre) Gecko/20110303 Firefox/4.0b13pre See following code. TypeError exception is thrown at referencing "arguments" in a bound Function object on NOT even strict mode // on NOT strict mode function a() {} a.arguments; // null var b = a.bind(); b.arguments; // TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them Reproducible: Always Expected Results: on not strict mode, I think an exception should not be thrown.
Bind is a new feature, so "bad stuff" has been disallowed from the beginning. See EcmaScript 5th Editon 15.3.4.5 Step 21, notice the "throw" [[Get]] and [[Set]] method. http://people.mozilla.org/~jorendorff/es5.html#sec-15.3.4.5
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
(In reply to comment #1) > Bind is a new feature, so "bad stuff" has been disallowed from the beginning. > > See EcmaScript 5th Editon 15.3.4.5 Step 21, notice the "throw" [[Get]] and > [[Set]] method. > http://people.mozilla.org/~jorendorff/es5.html#sec-15.3.4.5 Oh very good point. I get it :) But I'm very very confused about that error message.
I would expect that comes from reusing an error code for this situation... We should consider fixing that.
Maybe we should make this a template like error: The '%prop%' property may not be accessed on %bound/strict function, arguments object.
File a bug? Easy to fix the error message to take a parameter. /be
You need to log in before you can comment on or make changes to this bug.