WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
145460
Make Function.(name|length) configurable
https://bugs.webkit.org/show_bug.cgi?id=145460
Summary
Make Function.(name|length) configurable
Yury Selivanov
Reported
2015-05-29 10:17:12 PDT
This is an important feature for OOP libraries: typically classes are emulated using functions, hence class *static* properties are properties of the function object that represents the class. Since '.name' and '.length' properties are read-only and non-configurable for functions, there is no way to have '.name' and '.length' static properties for classes. This is something that has already been fixed in Chrome and Firefox: -
https://bugzilla.mozilla.org/show_bug.cgi?id=1084019
-
https://chromium.googlesource.com/v8/v8/+/f6cd009efd7a032907b11265e74102b0d45207a1%5E!/
And InternetExplorer doesn't have any restrictions on these properties, which leaves WebKit/Safari the only browser that doesn't support this.
Attachments
Add attachment
proposed patch, testcase, etc.
Yury Selivanov
Comment 1
2015-05-29 10:23:59 PDT
In short, the following should work: function f(){}; Object.defineProperty(f, 'name', {value: 'g'});
Simon Pieters (:zcorpan)
Comment 2
2016-05-25 03:08:19 PDT
***
Bug 158062
has been marked as a duplicate of this bug. ***
Simon Pieters (:zcorpan)
Comment 3
2016-05-25 03:13:59 PDT
Test for "length" in test262 at
https://github.com/tc39/test262/blob/83b27c9beb7b3ea78b319148b5c82a5411a333b1/test/language/statements/function/13.2-15-1.js#L19
Mark Lam
Comment 4
2016-05-25 10:51:57 PDT
This is already fixed in ToT. You can verify this for yourself using Safari Technology Preview or a WebKit Nightly build (
https://webkit.org/downloads/
).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug