r101343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101342‎ | r101343 | r101344 >
Date:09:22, 31 October 2011
Author:catrope
Status:ok
Tags:
Comment:
[RL2] Make sure that getForeignGadgetsData() and getForeignGadgetCategories() only call their error callback once.
Modified paths:
  • /branches/RL2/extensions/Gadgets/modules/ext.gadgets.api.js (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.api.js
@@ -91,7 +91,7 @@
9292 * @param error function( error ), called if one of the getter calls called its error callback
9393 */
9494 function mergeRepositoryData( getter, success, error ) {
95 - var combined = {}, successes = 0, numRepos = 0, repo;
 95+ var combined = {}, successes = 0, numRepos = 0, repo, failed = false;
9696 // Find out how many repos there are
9797 // Needs to be in a separate loop because we have to have the final number ready
9898 // before we fire the first potentially (since it could be cached) async request
@@ -109,7 +109,10 @@
110110 success( combined );
111111 }
112112 }, function( errorCode ) {
113 - error( errorCode );
 113+ if ( !failed ) {
 114+ failed = true;
 115+ error( errorCode );
 116+ }
114117 }, repoName
115118 );
116119 } );

Status & tagging log