Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded #62

Open
hosadoya opened this issue Apr 25, 2024 · 0 comments
Open

RangeError: Maximum call stack size exceeded #62

hosadoya opened this issue Apr 25, 2024 · 0 comments

Comments

@hosadoya
Copy link

hosadoya commented Apr 25, 2024

image

handling of the above exception result in this other exception:

RangeError: Maximum call stack size exceeded

"RangeError: Maximum call stack size exceeded

at newHandler.<computed> [as apply] (<anonymous>:33:38)
 at e._callFunction (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:9776)
 at e.write (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:9661)
 at e._onScriptDone (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:12531)
 at https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:11542
 at e._writeScriptToken (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:12979)
 at e._handleScriptToken (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:11508)
 at e._writeImpl (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:10120)
 at e.write (https://assets.adobedtm.com/6d2e783bbfe3/c0c47c5c96c6/launch-b2dd4b082ed7.min.js:3:9683)"

Looks like there is a scenario of some issue here:

utils.stripProxyFromErrors = (handler = {}) => {
    const newHandler = {}
    // We wrap each trap in the handler in a try/catch and modify the error stack if they throw
    const traps = Object.getOwnPropertyNames(handler)
    traps.forEach(trap => {
        newHandler[trap] = function () {
            try {
                // Forward the call to the defined proxy handler
                **return handler[trap].apply(this, arguments || [])**
            } catch (err) {
                // Stack traces differ per browser, we only support chromium based ones currently
                if (!err || !err.stack || !err.stack.includes(`at `)) {
                    throw err
                }

Here is related error:

utils.patchToString = (obj, str = '') => {
    const handler = {
        apply: function (target, ctx) {
            // This fixes e.g. `HTMLMediaElement.prototype.canPlayType.toString + ""`
            if (ctx === Function.prototype.toString) {
                return utils.makeNativeString('toString')
            }
            // `toString` targeted at our proxied Object detected
            if (ctx === obj) {
                // We either return the optional string verbatim or derive the most desired result automatically
                return str || utils.makeNativeString(obj.name)
            }
            // Check if the toString protype of the context is the same as the global prototype,
            // if not indicates that we are doing a check across different windows., e.g. the iframeWithdirect` test case
            const hasSameProto = Object.getPrototypeOf(
                Function.prototype.toString
            ).isPrototypeOf(ctx.toString) // eslint-disable-line no-prototype-builtins
            if (!hasSameProto) {
                // Pass the call on to the local Function.prototype.toString instead
                return ctx.toString()
            }
            return target.call(ctx)
        }
    }

    const toStringProxy = new Proxy(
        Function.prototype.toString,
        utils.stripProxyFromErrors(handler)
    )
    utils.replaceProperty(Function.prototype, 'toString', {
        value: toStringProxy
    })
}

TypeError: Function.prototype.toString requires that 'this' be a Function

return target.call(ctx)
calls stripProxyFromErrors
and stripProxyFromErrors calls apply{ ... return target.call(ctx)}

apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:279)
newHandler.<computed> (VM3346:33)
apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:279)
newHandler.<computed> (VM3346:33)
apply (VM3346:279)
newHandler.<computed> (VM3346:33)
apply (VM3346:222)
newHandler.<computed> (VM3346:33)
apply (VM3346:279)
newHandler.<computed> (VM3346:33)
YJp (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
Promise.then (async)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
K0 (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
d9p (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
cL (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
Gnp (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
Pgp (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
setTimeout (async)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
load (async)
Ggp (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
Pf (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
Xr (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
UnTNAMGVbS (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)
(anonymous) (YbAHU?v=342b8c91-4f0b-8fb7-150a-0fbaa379172c:1)

Page where this happens:
https://www.kohls.com/catalog/lego-toys.jsp?CN=Brand:LEGO+Department:Toys&spa=3&sks=true

this was working day ago, and today (without any changes on my part) this error started happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant