ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

[Bug]: Missing Implementation of String.prototype.replaceAll Method

Open ayuan0828 opened this issue 9 months ago • 5 comments

ChakraCore Version

36becec

Steps to reproduce

When executing code containing the String.prototype.replaceAll method, a TypeError: Object doesn't support property or method 'replaceAll' occurs.

Proof of concept

var replaceWith = function (inputStr) {
    return inputStr.replaceAll('a', 'b');
};
var originalStr = 'Y)a,K;aC&.';
var modifiedStr = replaceWith(originalStr);
print(modifiedStr);

Exception or Error

TypeError: Object doesn't support property or method 'replaceAll'
   at replaceWith (/home/test.js:2:5)
   at Global code (/home/test.js:5:1)

Additional Context

No response

ayuan0828 avatar Feb 27 '25 02:02 ayuan0828

@ayuan0828 , works perfectly fine when I use the same code in console. Please attach a screenshot on when you are facing the issues.

Image

Owaiseimdad avatar Feb 27 '25 15:02 Owaiseimdad

Image Here's a screenshot of my execution, and I'm very confused.

ayuan0828 avatar Feb 28 '25 02:02 ayuan0828

@ayuan0828 then its might be that originalStr is not a string but an object which is getting sent.

Owaiseimdad avatar Feb 28 '25 05:02 Owaiseimdad

The function "matchAll" is the same case, maybe for the same reason?

ayuan0828 avatar Feb 28 '25 07:02 ayuan0828

@ayuan0828 Chakracore has never implemented matchAll or replace all, see https://github.com/chakra-core/ChakraCore/issues/6297 and https://github.com/chakra-core/ChakraCore/issues/6390

I think @Owaiseimdad may have been assuming this page is for bug reports for Edge? Edge stopped using chakracore some time ago, hence Microsoft discontinuing support of Chakracore.

rhuanjl avatar Oct 10 '25 21:10 rhuanjl