From 2cd09c9f0e7766bcd191662841b7b1ffc3b6dc3f Mon Sep 17 00:00:00 2001 From: Noam Lewis Date: Mon, 30 Dec 2013 20:10:23 -0500 Subject: fix($rootScope): prevent infinite $digest by checking if asyncQueue is empty when decrementing ttl An infinite $digest loop can be caused by expressions that invoke a promise. The problem is that $digest does not decrement ttl unless it finds dirty changes; it should check also if asyncQueue is empty. Generally the condition for decrementing ttl should be the same as the condition for terminating the $digest loop. Fixes #2622 --- src/ng/rootScope.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ng/rootScope.js') diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 8259bf88..bbf290b2 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -632,7 +632,7 @@ function $RootScopeProvider(){ // `break traverseScopesLoop;` takes us to here - if(dirty && !(ttl--)) { + if((dirty || asyncQueue.length) && !(ttl--)) { clearPhase(); throw $rootScopeMinErr('infdig', '{0} $digest() iterations reached. Aborting!\n' + -- cgit v1.2.3