Bug 140295

Summary: (function(arg1) {}.bind(window)).length results in 0
Product: WebKit Reporter: sarimarton
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: ashvayka, dbates, ggaren, mark.lam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description sarimarton 2015-01-09 10:03:37 PST
Simple as that:

(function(arg1) {}.bind(window)).length results in 0 instead of 1.
Comment 1 Radar WebKit Bug Importer 2015-01-09 11:47:05 PST
<rdar://problem/19429047>
Comment 2 Daniel Bates 2015-01-12 20:40:47 PST
What is the version of Safari/WebKit you are using? What is the platform/OS version? On Mac, you can find the Safari/WebKit and OS version information in Safari > About Safari and Apple (menu) > About this Mac, respectively.

I'm neither able to reproduce this bug using shipping Safari Version 8.0.2 (10600.2.5) on 10.10.1 (14B25) nor with the latest WebKit nightly r178255 on the same OS. I also was unable to reproduce this bug using Mac nightly r178109 (2015-01-08 15:33:34 GMT). That is, the expression "(function(arg1) {}.bind(window)).length" evaluates to 1 in Web Inspector.
Comment 3 sarimarton 2015-01-13 05:11:03 PST
I'm using PhantomJS 1.9.7 on Windows and Unix.
Comment 4 Alexey Shvayka 2020-08-21 11:49:24 PDT
(In reply to sarimarton from comment #0)
> (function(arg1) {}.bind(window)).length results in 0 instead of 1.

(In reply to sarimarton from comment #3)
> I'm using PhantomJS 1.9.7 on Windows and Unix.

At that time, PhantomJS was shipped with a rather outdated version of WebKit.
As of v2.1.1 (macOS), Function.prototype.bind returns correct "length" of 1.

Also works as expected in Safari 13.1 and r265666.