Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit bf1a57a

Browse files
committed
fix(Scope): don't clear the phase when an exception is thrown from asyncQueue or watch
If we clear it here, then any other watch or async task could start a new digest.
1 parent ece6ef4 commit bf1a57a

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

src/ng/rootScope.js

-2
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ function $RootScopeProvider(){
699699
asyncTask = asyncQueue.shift();
700700
asyncTask.scope.$eval(asyncTask.expression);
701701
} catch (e) {
702-
clearPhase();
703702
$exceptionHandler(e);
704703
}
705704
lastDirtyWatch = null;
@@ -742,7 +741,6 @@ function $RootScopeProvider(){
742741
}
743742
}
744743
} catch (e) {
745-
clearPhase();
746744
$exceptionHandler(e);
747745
}
748746
}

test/ng/rootScopeSpec.js

-9
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,6 @@ describe('Scope', function() {
176176
});
177177
});
178178

179-
it('should clear phase if an exception interrupt $digest cycle', function() {
180-
inject(function($rootScope) {
181-
$rootScope.$watch('a', function() {throw new Error('abc');});
182-
$rootScope.a = 1;
183-
try { $rootScope.$digest(); } catch(e) { }
184-
expect($rootScope.$$phase).toBeNull();
185-
});
186-
});
187-
188179

189180
it('should fire watches in order of addition', inject(function($rootScope) {
190181
// this is not an external guarantee, just our own sanity

0 commit comments

Comments
 (0)