fix MVar infinite blocking

This commit is contained in:
Yann Esposito (Yogsototh) 2016-01-04 20:25:52 +01:00 committed by Nicolas Rolland
parent 2719a956d5
commit 59365116f3

View file

@ -62,7 +62,9 @@ performXhr xhr request = do
callback <- onReadyStateChange xhr $ do
state <- readyState xhr
case state of
4 -> putMVar waiter ()
4 -> do
toPut <- isEmptyMVar waiter
when toPut (putMVar waiter ())
_ -> return ()
openXhr xhr (cs $ method request) (toUrl request) True
setHeaders xhr (requestHeaders request)