@@ -54,7 +54,7 @@ function $HttpBackendProvider() {
5454
5555function createHttpBackend ( $browser , createXhr , $browserDefer , callbacks , rawDocument ) {
5656 // TODO(vojta): fix the signature
57- return function ( method , url , post , callback , headers , timeout , withCredentials , responseType ) {
57+ return function ( method , url , post , callback , headers , timeout , withCredentials , responseType , eventHandlers ) {
5858 $browser . $$incOutstandingRequestCount ( ) ;
5959 url = url || $browser . url ( ) ;
6060
@@ -114,6 +114,20 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
114114 xhr . onerror = requestError ;
115115 xhr . onabort = requestError ;
116116
117+ if ( eventHandlers ) {
118+ forEach ( eventHandlers , function ( value , key ) {
119+ if ( key !== 'upload' ) {
120+ xhr . addEventListener ( key , value ) ;
121+ }
122+ } ) ;
123+
124+ if ( eventHandlers . upload ) {
125+ forEach ( eventHandlers . upload , function ( value , key ) {
126+ xhr . upload . addEventListener ( key , value ) ;
127+ } ) ;
128+ }
129+ }
130+
117131 if ( withCredentials ) {
118132 xhr . withCredentials = true ;
119133 }
0 commit comments