Maximum call stack size exceeded error

后端 未结 30 2540
独厮守ぢ
独厮守ぢ 2020-11-21 23:51

I am using a Direct Web Remoting (DWR) JavaScript library file and am getting an error only in Safari (desktop and iPad)

It says

Maximum call

相关标签:
30条回答
  • 2020-11-22 00:13

    you can find your recursive function in crome browser,press ctrl+shift+j and then source tab, which gives you code compilation flow and you can find using break point in code.

    0 讨论(0)
  • 2020-11-22 00:13

    In my case, I basically forget to get the value of input.

    Wrong

    let name=document.getElementById('name');
    param={"name":name}
    

    Correct

    let name=document.getElementById('name').value;
    param={"name":name}
    
    0 讨论(0)
  • 2020-11-22 00:15

    You can sometimes get this if you accidentally import/embed the same JavaScript file twice, worth checking in your resources tab of the inspector.

    0 讨论(0)
  • 2020-11-22 00:16

    There is a recursive loop somewhere in your code (i.e. a function that eventually calls itself again and again until the stack is full).

    Other browsers either have bigger stacks (so you get a timeout instead) or they swallow the error for some reason (maybe a badly placed try-catch).

    Use the debugger to check the call stack when the error happens.

    0 讨论(0)
  • 2020-11-22 00:17

    If you are working with google maps, then check if the lat lng are being passed into new google.maps.LatLng are of a proper format. In my case they were being passed as undefined.

    0 讨论(0)
  • 2020-11-22 00:17

    Have come accross the same issue, coulnd't figured out what's wrong started blaming Babel ;)

    Having code not returning any exception in browsers :

    if (typeof document.body.onpointerdown !== ('undefined' || null)) {
    

    issue was badly created || (or) part as babel creates its own type check:

    function _typeof(obj){if(typeof Symbol==="function"&&_typeof(Symbol.iterator)==="symbol")
    

    so removing

    || null
    

    made babel transpilation worked.

    0 讨论(0)
提交回复
热议问题