[Bug] RangeError: Maximum call stack size exceeded
because of hacks to Function.prototype.toString
in puppeteer-extra-plugin-stealth
#890
Labels
Describe the bug
With
puppeteer-extra-plugin-stealth
plugin applied,open any page in the internet archive, for example https://web.archive.org/web/20240513040624/https://www.google.com/
Then go to the terminal, you will see
RangeError: Maximum call stack size exceeded
triggered for.toString()
calls to any function.I've looked into the code a bit and found the plugin making a lot of hacks to Function.prototype in some util function and the util function is used in many other places.
It might be the way-back-machine also hacking the browser environment a bit and some how it created a loop.
TBH I didn't quite get the purpose of the hacking and why it's always applied globally to
Function.prototype
.But it might be time to consider refactoring this hack to use some constant
WeakMap
instead of chaining functions.Code Snippet
The text was updated successfully, but these errors were encountered: