From 23df8811a1d11d188db935755127cf8ceb3cdfbf Mon Sep 17 00:00:00 2001 From: Vitaliy Slobodin Date: Thu, 12 Sep 2013 23:24:37 +0400 Subject: [PATCH] REPL returns empty object on enumerating properties on a simple JavaScript type (Number, String, Logical). We should not to do that. Issue: https://github.com/ariya/phantomjs/issues/11622 --- src/repl.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/repl.js b/src/repl.js index ee92b06f..b0053a17 100644 --- a/src/repl.js +++ b/src/repl.js @@ -109,6 +109,11 @@ REPL._expResStringifyReplacer = function (k, v) { // Get all the completions for the object we are going to pretty-print iarr = REPL._getCompletions(REPL._lastEval); + + // nothing to enumerate + if (iarr.length == 0) + return v; + for (i in iarr) { if (typeof(v[iarr[i]]) !== "undefined") { // add a reference to this "real" property into the mock object