You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function.prototype.call.bind(someMethod) — the "uncurry-this" idiom —
returns a function that ignores its bound this and yields undefined when
called. This happens even for plain objects, so it's not a builtin-descriptor
issue.
constcall=Function.prototype.call;typeofcall// "function" ✓typeofcall.bind// Perry: undefined | Node: "function" ✗ (reading .bind as a value)constb=call.bind(x)// typeof b === "function" (the .bind(...) call form is special-cased)b(obj,"a")// undefined ✗ — the bound `this` (the target method) is never applied
So Function.prototype.call is reified as a callable, but:
reading .bindas a value off it returns undefined, and
the special-cased call.bind(target) produces a bound function that does
not invoke target with the forwarded (thisArg, ...args).
Why it's high-leverage
This is the exact shape test262's harness/propertyHelper.js uses:
verifyProperty (and verifyCallableProperty, verifyAccessorProperty)
call __hasOwnProperty(obj, name) as their first assertion, so every verifyProperty-based positive test262 case fails here before checking
anything else — independent of whether the underlying descriptor is correct.
Fixing this unblocks the entire propertyHelper.js-based slice of the suite
at once (the ~131 "name/length should be an own property" cluster from #3655
and many more).
User-function .bind works (f.bind({v:10})(5) is correct); the gap is
specifically binding the reified Function.prototype.call / .apply
native methods and reading .bind/.call/.apply off them as values.
Found while implementing #3655 (built-in name/length descriptors).
Summary
Function.prototype.call.bind(someMethod)— the "uncurry-this" idiom —returns a function that ignores its bound
thisand yieldsundefinedwhencalled. This happens even for plain objects, so it's not a builtin-descriptor
issue.
Diagnostics:
So
Function.prototype.callis reified as a callable, but:.bindas a value off it returnsundefined, andcall.bind(target)produces a bound function that doesnot invoke
targetwith the forwarded(thisArg, ...args).Why it's high-leverage
This is the exact shape test262's
harness/propertyHelper.jsuses:verifyProperty(andverifyCallableProperty,verifyAccessorProperty)call
__hasOwnProperty(obj, name)as their first assertion, so everyverifyProperty-based positive test262 case fails here before checkinganything else — independent of whether the underlying descriptor is correct.
Fixing this unblocks the entire
propertyHelper.js-based slice of the suiteat once (the ~131 "name/length should be an own property" cluster from #3655
and many more).
Repro
Notes
Object.prototype.hasOwnProperty.call(obj, k)andobj.hasOwnProperty(k)are correct. Only the
Function.prototype.call.bind(method)re-curry is broken..bindworks (f.bind({v:10})(5)is correct); the gap isspecifically binding the reified
Function.prototype.call/.applynative methods and reading
.bind/.call/.applyoff them as values.Found while implementing #3655 (built-in name/length descriptors).