Fix withCredentials on synchronous XHRs.

This commit is contained in:
Mayhem 2013-05-20 02:46:05 +02:00
parent 89a7bf5cbc
commit 388c8b9d1a
2 changed files with 9 additions and 2 deletions

View File

@ -46,7 +46,14 @@ $.ajax = (url, callbacks, opts={}) ->
r.setRequestHeader key, val r.setRequestHeader key, val
$.extend r, callbacks $.extend r, callbacks
$.extend r.upload, upCallbacks $.extend r.upload, upCallbacks
try
# Firefox throws an error if you try
# to set this on a synchronous XHR.
# Only cookies from the remote domain
# are used in a request withCredentials.
r.withCredentials = cred r.withCredentials = cred
catch err
# do nothing
r.send form r.send form
r r
$.cache = do -> $.cache = do ->