diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index df8ddcf6..d06abfc2 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -773,11 +773,11 @@ function $RootScopeProvider() { if (ttl < 5) { logIdx = 4 - ttl; if (!watchLog[logIdx]) watchLog[logIdx] = []; - logMsg = (isFunction(watch.exp)) - ? 'fn: ' + (watch.exp.name || watch.exp.toString()) - : watch.exp; - logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last); - watchLog[logIdx].push(logMsg); + watchLog[logIdx].push({ + msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, + newVal: value, + oldVal: last + }); } } else if (watch === lastDirtyWatch) { // If the most recently dirty watcher is now clean, short circuit since the remaining watchers @@ -810,7 +810,7 @@ function $RootScopeProvider() { throw $rootScopeMinErr('infdig', '{0} $digest() iterations reached. Aborting!\n' + 'Watchers fired in the last 5 iterations: {1}', - TTL, toJson(watchLog)); + TTL, watchLog); } } while (dirty || asyncQueue.length); diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js index ec9fc807..6ff240d6 100644 --- a/test/ng/rootScopeSpec.js +++ b/test/ng/rootScopeSpec.js @@ -298,11 +298,11 @@ describe('Scope', function() { $rootScope.$digest(); }).toThrowMinErr('$rootScope', 'infdig', '100 $digest() iterations reached. Aborting!\n' + 'Watchers fired in the last 5 iterations: ' + - '[["a; newVal: 96; oldVal: 95","b; newVal: 97; oldVal: 96"],' + - '["a; newVal: 97; oldVal: 96","b; newVal: 98; oldVal: 97"],' + - '["a; newVal: 98; oldVal: 97","b; newVal: 99; oldVal: 98"],' + - '["a; newVal: 99; oldVal: 98","b; newVal: 100; oldVal: 99"],' + - '["a; newVal: 100; oldVal: 99","b; newVal: 101; oldVal: 100"]]'); + '[[{"msg":"a","newVal":96,"oldVal":95},{"msg":"b","newVal":97,"oldVal":96}],' + + '[{"msg":"a","newVal":97,"oldVal":96},{"msg":"b","newVal":98,"oldVal":97}],' + + '[{"msg":"a","newVal":98,"oldVal":97},{"msg":"b","newVal":99,"oldVal":98}],' + + '[{"msg":"a","newVal":99,"oldVal":98},{"msg":"b","newVal":100,"oldVal":99}],' + + '[{"msg":"a","newVal":100,"oldVal":99},{"msg":"b","newVal":101,"oldVal":100}]]'); expect($rootScope.$$phase).toBeNull(); });