Skip to content
Browse files

Fix goog.result.combine when combining Result objects that have alrea…

…dy resolved.

R=vbhasin
DELTA=12  (11 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=5736


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2263 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent de01516 commit acb093a53cf720f9e6a14e7e909380bdbd903479 leewilliams@google.com committed Oct 31, 2012
Showing with 12 additions and 1 deletion.
  1. +10 −0 closure/goog/result/combine_test.html
  2. +2 −1 closure/goog/result/resultutil.js
View
10 closure/goog/result/combine_test.html
@@ -55,6 +55,16 @@
combinedResult = successCombinedResult = null;
}
+function testSynchronousCombine() {
+ resolveAllGivenResultsToSuccess();
+
+ newCombinedResult = goog.result.combine(result1, result2, result3, result4);
+
+ goog.result.wait(newCombinedResult, resultCallback);
+
+ assertSuccessCall(newCombinedResult, resultCallback);
+}
+
function testCombineWhenAllResultsSuccess() {
goog.result.wait(combinedResult, resultCallback);
View
3 closure/goog/result/resultutil.js
@@ -303,7 +303,8 @@ goog.result.combine = function(var_args) {
};
var checkResults = function() {
- if (goog.array.every(results, isResolved)) {
+ if (combinedResult.getState() == goog.result.Result.State.PENDING &&
+ goog.array.every(results, isResolved)) {
combinedResult.setValue(results);
}
};

0 comments on commit acb093a

Please sign in to comment.
Something went wrong with that request. Please try again.