ecmascript: Fix deadlock