Browse Source

lib: remove bootstrap global context indirection

PR-URL: https://github.com/nodejs/node/pull/5881
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
process-exit-stdio-flushing
Jeremiah Senkpiel 9 years ago
parent
commit
21d66d621c
  1. 2
      lib/internal/bootstrap_node.js
  2. 7
      src/node.cc

2
lib/internal/bootstrap_node.js

@ -8,7 +8,6 @@
'use strict'; 'use strict';
(function(process) { (function(process) {
this.global = this;
function startup() { function startup() {
var EventEmitter = NativeModule.require('events'); var EventEmitter = NativeModule.require('events');
@ -211,7 +210,6 @@
function setupGlobalVariables() { function setupGlobalVariables() {
global.process = process; global.process = process;
global.global = global;
const util = NativeModule.require('util'); const util = NativeModule.require('util');
// Deprecate GLOBAL and root // Deprecate GLOBAL and root

7
src/node.cc

@ -118,6 +118,7 @@ using v8::Locker;
using v8::MaybeLocal; using v8::MaybeLocal;
using v8::Message; using v8::Message;
using v8::Name; using v8::Name;
using v8::Null;
using v8::Number; using v8::Number;
using v8::Object; using v8::Object;
using v8::ObjectTemplate; using v8::ObjectTemplate;
@ -3321,8 +3322,12 @@ void LoadEnvironment(Environment* env) {
env->SetMethod(env->process_object(), "_rawDebug", RawDebug); env->SetMethod(env->process_object(), "_rawDebug", RawDebug);
// Expose the global object as a property on itself
// (Allows you to set stuff on `global` from anywhere in JavaScript.)
global->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "global"), global);
Local<Value> arg = env->process_object(); Local<Value> arg = env->process_object();
f->Call(global, 1, &arg); f->Call(Null(env->isolate()), ARRAY_SIZE(&arg), &arg);
} }
static void PrintHelp(); static void PrintHelp();

Loading…
Cancel
Save