Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Fix goog.result.combine when combining Result objects that have alrea…
Browse files Browse the repository at this point in the history
…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
leewilliams@google.com committed Oct 31, 2012
1 parent de01516 commit acb093a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions closure/goog/result/combine_test.html
Expand Up @@ -55,6 +55,16 @@
combinedResult = successCombinedResult = null; combinedResult = successCombinedResult = null;
} }


function testSynchronousCombine() {
resolveAllGivenResultsToSuccess();

newCombinedResult = goog.result.combine(result1, result2, result3, result4);

goog.result.wait(newCombinedResult, resultCallback);

assertSuccessCall(newCombinedResult, resultCallback);
}

function testCombineWhenAllResultsSuccess() { function testCombineWhenAllResultsSuccess() {
goog.result.wait(combinedResult, resultCallback); goog.result.wait(combinedResult, resultCallback);


Expand Down
3 changes: 2 additions & 1 deletion closure/goog/result/resultutil.js
Expand Up @@ -303,7 +303,8 @@ goog.result.combine = function(var_args) {
}; };


var checkResults = function() { 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); combinedResult.setValue(results);
} }
}; };
Expand Down

0 comments on commit acb093a

Please sign in to comment.