Bug 209571
Summary: | Function.length broken by Object.defineProperty and bind | ||
---|---|---|---|
Product: | WebKit | Reporter: | Andy Niccolai <andy.niccolai> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | ashvayka, fpizlo, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Mac | ||
OS: | macOS 10.15 |
Andy Niccolai
With the release of Safari 13.1 (and also verified in 13.2 Technical Preview), Function.length always returns zero after binding arguments to a function that has a custom name defined.
Repro JS Fiddle: https://jsfiddle.net/7s9yop23/
Repro code
const originalFn = (a, b) => a + b;
Object.defineProperty(originalFn, 'name', {value: 'newFunctionName'});
const renamedAndBoundFn = originalFn.bind(undefined, 1);
// expected: 1
// actual: 0
renamedAndBoundFn.length
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/60898213>
Yusuke Suzuki
(In reply to Andy Niccolai from comment #0)
> With the release of Safari 13.1 (and also verified in 13.2 Technical
> Preview), Function.length always returns zero after binding arguments to a
> function that has a custom name defined.
>
> Repro JS Fiddle: https://jsfiddle.net/7s9yop23/
>
> Repro code
>
> const originalFn = (a, b) => a + b;
> Object.defineProperty(originalFn, 'name', {value: 'newFunctionName'});
> const renamedAndBoundFn = originalFn.bind(undefined, 1);
>
> // expected: 1
> // actual: 0
> renamedAndBoundFn.length
Thanks for reporting!
This is fixed in https://bugs.webkit.org/show_bug.cgi?id=208497 :)
*** This bug has been marked as a duplicate of bug 208497 ***