Bug 271946
| Summary: | Inconsistent output of Function.prototype.toString for accessor properties | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Sosuke Suzuki <aosukeke> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | ashvayka, mark.lam, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=274224 | ||
| Bug Depends on: | 274225 | ||
| Bug Blocks: | |||
Sosuke Suzuki
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Sosuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/26660
EWS
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
<rdar://problem/125739577>
Mark Lam
Reopened Bugzilla.
Breaks https://www.tax.ny.gov/online/., tracking revert in https://bugs.webkit.org/show_bug.cgi?id=274225.
Mark Lam
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
Reverted in 278825@main (see https://bugs.webkit.org/show_bug.cgi?id=274225). Please work on the fix for re-landing in https://bugs.webkit.org/show_bug.cgi?id=274224.