mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
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.
This commit is contained in:
@@ -699,7 +699,6 @@ function $RootScopeProvider(){
|
||||
asyncTask = asyncQueue.shift();
|
||||
asyncTask.scope.$eval(asyncTask.expression);
|
||||
} catch (e) {
|
||||
clearPhase();
|
||||
$exceptionHandler(e);
|
||||
}
|
||||
lastDirtyWatch = null;
|
||||
@@ -742,7 +741,6 @@ function $RootScopeProvider(){
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
clearPhase();
|
||||
$exceptionHandler(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,15 +176,6 @@ describe('Scope', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should clear phase if an exception interrupt $digest cycle', function() {
|
||||
inject(function($rootScope) {
|
||||
$rootScope.$watch('a', function() {throw new Error('abc');});
|
||||
$rootScope.a = 1;
|
||||
try { $rootScope.$digest(); } catch(e) { }
|
||||
expect($rootScope.$$phase).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should fire watches in order of addition', inject(function($rootScope) {
|
||||
// this is not an external guarantee, just our own sanity
|
||||
|
||||
Reference in New Issue
Block a user