From 8ec31a3362d016d6209694fb70639bf3d963e48b Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 23 Aug 2011 10:39:23 -0700 Subject: [PATCH] Use Object.getPrototypeOf() on the object in the REPL tab-completion. Some people use __proto__ to augment an Object's prototype after it's been created. This patch helps make the "new" prototype properties visible if necessary. This is also more consistent with the while logic below. --- lib/repl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/repl.js b/lib/repl.js index 68fc1169918..252d52df091 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -412,8 +412,8 @@ REPLServer.prototype.complete = function(line) { memberGroups.push(Object.getOwnPropertyNames(obj)); } // works for non-objects - var p = obj.constructor ? obj.constructor.prototype : null; try { + var p = Object.getPrototypeOf(obj); var sentinel = 5; while (p !== null) { memberGroups.push(Object.getOwnPropertyNames(p));