[inspector] Support printing RegExps with overridden `toString`
Prior to this patch, regular expression objects with a monkeypatched `toString` were printed using the `toString` result value, rather than actually representing the regular expression’s contents. const re = /./; re.toString = () => 'whoops!'; console.log(re); // → logs 'whoops!' Now that `v8::RegExp::GetSource` properly escapes special characters in the source pattern [1], just like `RegExp#toString`, there is no longer any reason to avoid it. [1]: https://chromium-review.googlesource.com/c/v8/v8/+/2900737 Bug: v8:11693 Change-Id: I9a69cdb6813f76b669bdc24e4823c6d261f2ae73 Fixed: v8:11836 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928188Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#74862}
Showing
Please
register
or
sign in
to comment