@@ -45,12 +45,14 @@ BufferedSender.prototype.send_schedule = function() {
45
45
var that = this ;
46
46
if ( that . send_buffer . length > 0 ) {
47
47
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
+ } ) ;
54
56
that . send_buffer = [ ] ;
55
57
}
56
58
} ;
@@ -113,7 +115,9 @@ var jsonPGenericSender = function(url, payload, callback) {
113
115
iframe = null ;
114
116
} ) ;
115
117
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 ) ;
117
121
} ;
118
122
iframe . onerror = iframe . onload = completed ;
119
123
iframe . onreadystatechange = function ( e ) {
@@ -126,10 +130,11 @@ var createAjaxSender = function(AjaxObject) {
126
130
return function ( url , payload , callback ) {
127
131
var xo = new AjaxObject ( 'POST' , url + '/xhr_send' , payload ) ;
128
132
xo . onfinish = function ( status , text ) {
129
- callback ( status ) ;
133
+ callback ( status === 200 || status === 204 ,
134
+ 'http status ' + status ) ;
130
135
} ;
131
136
return function ( abort_reason ) {
132
- callback ( 0 , abort_reason ) ;
137
+ callback ( false , abort_reason ) ;
133
138
} ;
134
139
} ;
135
140
} ;
0 commit comments