RESOLVED FIXED271946
Inconsistent output of Function.prototype.toString for accessor properties
https://bugs.webkit.org/show_bug.cgi?id=271946
Summary Inconsistent output of Function.prototype.toString for accessor properties
Sosuke Suzuki
Reported 2024-03-30 22:44:00 PDT
Since `RegExp.input` is an accessor property, it is expected that the result of `Function.prototype.toString` would include "get" or "set, but JSC doesn't do that[1]. ```js const regExpInputGetter = Object.getOwnPropertyDescriptor(RegExp, "input").get; print(Function.prototype.toString.call(regExpInputGetter)); // Actual: // function input() { // [native code] // } // Expected: // function get input() { // [native code] // } ``` On the other hand, it returns expected string for properties like `RegExp.prototype.unicode`: ```js const regExpPrototypeUnicodeGetter = Object.getOwnPropertyDescriptor(RegExp.prototype, "unicode").get; print(Function.prototype.toString.call(regExpPrototypeUnicodeGetter)); // function get unicode() { // [native code] // } ``` [1]: https://tc39.es/ecma262/#sec-function.prototype.tostring
Attachments
Sosuke Suzuki
Comment 1 2024-03-31 00:11:10 PDT
EWS
Comment 2 2024-04-01 14:39:58 PDT
Committed 276904@main (1ff045b365bb): <https://commits.webkit.org/276904@main> Reviewed commits have been landed. Closing PR #26660 and removing active labels.
Radar WebKit Bug Importer
Comment 3 2024-04-01 14:40:19 PDT
Mark Lam
Comment 4 2024-05-15 13:11:26 PDT
Mark Lam
Comment 5 2024-05-15 13:19:50 PDT
Instead of re-opening this old bug, let's track the re-landing of this change (along with https://bugs.webkit.org/show_bug.cgi?id=272082) in https://bugs.webkit.org/show_bug.cgi?id=274224.
Mark Lam
Comment 6 2024-05-15 13:57:36 PDT
Note You need to log in before you can comment on or make changes to this bug.