Krenair

mediawiki.api promise.abort patch

Mar 27th, 2013
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.12 KB | None | 0 0
  1. diff --git a/resources/mediawiki.api/mediawiki.api.js b/resources/mediawiki.api/mediawiki.api.js
  2. index cf7443f..d72f081 100644
  3. --- a/resources/mediawiki.api/mediawiki.api.js
  4. +++ b/resources/mediawiki.api/mediawiki.api.js
  5. @@ -147,7 +147,7 @@
  6.                         }
  7.  
  8.                         // Make the AJAX request
  9. -                       $.ajax( ajaxOptions )
  10. +                       var xhr = $.ajax( ajaxOptions )
  11.                                 // If AJAX fails, reject API call with error code 'http'
  12.                                 // and details in second argument.
  13.                                 .fail( function ( xhr, textStatus, exception ) {
  14. @@ -172,9 +172,9 @@
  15.                                 } );
  16.  
  17.                         // Return the Promise
  18. -                       return apiDeferred.promise().fail( function ( code, details ) {
  19. +                       return apiDeferred.promise( { abort: xhr.abort } ).fail( function ( code, details ) {
  20.                                 mw.log( 'mw.Api error: ', code, details );
  21. -                       });
  22. +                       } );
  23.                 }
  24.  
  25.         };
Advertisement
Add Comment
Please, Sign In to add comment