@@ -45,12 +45,14 @@ BufferedSender.prototype.send_schedule = function() {
4545 var that = this ;
4646 if ( that . send_buffer . length > 0 ) {
4747 var payload = '[' + that . send_buffer . join ( ',' ) + ']' ;
48- that . send_stop = that . sender ( that . trans_url ,
49- payload ,
50- function ( ) {
51- that . send_stop = null ;
52- that . send_schedule_wait ( ) ;
53- } ) ;
48+ that . send_stop = that . sender ( that . trans_url , payload , function ( success , abort_reason ) {
49+ that . send_stop = null ;
50+ if ( success === false ) {
51+ that . ri . _didClose ( 1006 , 'Sending error ' + abort_reason ) ;
52+ } else {
53+ that . send_schedule_wait ( ) ;
54+ }
55+ } ) ;
5456 that . send_buffer = [ ] ;
5557 }
5658} ;
@@ -113,7 +115,9 @@ var jsonPGenericSender = function(url, payload, callback) {
113115 iframe = null ;
114116 } ) ;
115117 area . value = '' ;
116- callback ( ) ;
118+ // It is not possible to detect if the iframe succeeded or
119+ // failed to submit our form.
120+ callback ( true ) ;
117121 } ;
118122 iframe . onerror = iframe . onload = completed ;
119123 iframe . onreadystatechange = function ( e ) {
@@ -126,10 +130,11 @@ var createAjaxSender = function(AjaxObject) {
126130 return function ( url , payload , callback ) {
127131 var xo = new AjaxObject ( 'POST' , url + '/xhr_send' , payload ) ;
128132 xo . onfinish = function ( status , text ) {
129- callback ( status ) ;
133+ callback ( status === 200 || status === 204 ,
134+ 'http status ' + status ) ;
130135 } ;
131136 return function ( abort_reason ) {
132- callback ( 0 , abort_reason ) ;
137+ callback ( false , abort_reason ) ;
133138 } ;
134139 } ;
135140} ;
0 commit comments