Closed
Bug 1122944
Opened 11 years ago
Closed 11 years ago
Function.prototype.bind should create non-constructor function when applied to a non-constructor object
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: caitpotter88, Assigned: evilpies)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
1.92 KB,
patch
|
till
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150117030203
Steps to reproduce:
A simple reproduction is http://jsfiddle.net/4q75LL77/
Actual results:
When `this` is a bound non-constructor function, IsConstructor() returns true, and `this` is invoked with `new`, thus a TypeError is thrown.
If the non-constructor is unbound, it behaves correctly.
Expected results:
IsConstructor() should return false for bound non-constructor functions. In the posted example, the result of each call should be an array with the element values 1, 2 and 3.
Reporter | ||
Updated•11 years ago
|
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Assignee | ||
Comment 1•11 years ago
|
||
What a funny little test case, thank you! Till does your new implementation pass this test?
Assignee: nobody → evilpies
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8550774 -
Flags: review?(till)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #8550774 -
Attachment is obsolete: true
Attachment #8550774 -
Flags: review?(till)
Attachment #8550775 -
Flags: review?(till)
Assignee | ||
Comment 3•11 years ago
|
||
Oh, dear ...
Attachment #8550775 -
Attachment is obsolete: true
Attachment #8550775 -
Flags: review?(till)
Attachment #8550776 -
Flags: review?(till)
Assignee | ||
Updated•11 years ago
|
Summary: Array.from and Array.of should not throw TypeError if `this` is a bound non-constructor function → Function.prototype.bind should create non-constructor function when applied to a non-constructor object
Reporter | ||
Comment 4•11 years ago
|
||
That was fast, I was going to try and get my friend to work on that as a good first bug =)
Assignee | ||
Comment 5•11 years ago
|
||
Oh dammit :( I would rather your friend did it, instead of me. We have a few other good first bugs under the es6 meta bug, and there is of course http://www.joshmatthews.net/bugsahoy/?jseng=1.
Comment 6•11 years ago
|
||
Comment on attachment 8550776 [details] [diff] [review]
bound-function
Review of attachment 8550776 [details] [diff] [review]:
-----------------------------------------------------------------
Heh, funny little test indeed.
Yes, my implementation would pass this - though I wasn't even aware of this issue :)
Attachment #8550776 -
Flags: review?(till) → review+
Assignee | ||
Comment 7•11 years ago
|
||
That was quick! Any yaay for your implementation :)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=19c5dac1508a
https://hg.mozilla.org/integration/mozilla-inbound/rev/d12719615903
Comment 8•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in
before you can comment on or make changes to this bug.
Description
•