From 8fc713fb13b20f0f3ecd70951223f5063641aabf Mon Sep 17 00:00:00 2001 From: Felix Kling Date: Wed, 27 Feb 2013 03:40:20 +0000 Subject: [PATCH] Fixes cirular references detection in PhantomReporter.js. The logic which was in place to convert array-like objects to arrays prevented the circular reference detection to work properly for arrays and array-like objects. --- tasks/jasmine/reporters/PhantomReporter.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tasks/jasmine/reporters/PhantomReporter.js b/tasks/jasmine/reporters/PhantomReporter.js index aed699f..ebc3595 100644 --- a/tasks/jasmine/reporters/PhantomReporter.js +++ b/tasks/jasmine/reporters/PhantomReporter.js @@ -105,7 +105,7 @@ phantom.sendMessage = function() { function stringify(obj) { if (typeof obj !== 'object') return obj; - var cache = [], keyMap = [], tempArray, index; + var cache = [], keyMap = [], index; var string = JSON.stringify(obj, function(key, value) { // Let json stringify falsy values @@ -122,9 +122,6 @@ phantom.sendMessage = function() { if (typeof value === 'object' && value !== null) { - // Check to see if we have a pseudo array that can be converted - if (value.length && (tempArray = Array.prototype.slice.call(value)).length === value.length) value = tempArray; - if (index = cache.indexOf(value) !== -1) { // If we have it in cache, report the circle with the key we first found it in return '[ Circular {' + (keyMap[index] || 'root') + '} ]';