diff options
Diffstat (limited to 'lib/repl.js')
-rw-r--r-- | lib/repl.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/repl.js b/lib/repl.js index ed0c9fd420..2f82c2ca49 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -875,8 +875,11 @@ REPLServer.prototype.createContext = function() { context = vm.createContext(); }); for (const name of Object.getOwnPropertyNames(global)) { - Object.defineProperty(context, name, - Object.getOwnPropertyDescriptor(global, name)); + // Only set properties on the context that do not exist as primordial. + if (!(name in primordials)) { + Object.defineProperty(context, name, + Object.getOwnPropertyDescriptor(global, name)); + } } context.global = context; const _console = new Console(this.outputStream); |