Js deadlock