Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d4abca5

Browse filesBrowse files
Fishrock123Myles Borins
authored andcommitted
lib: remove bootstrap global context indirection
PR-URL: #5881 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Conflicts: lib/internal/bootstrap_node.js src/node.cc
1 parent 61167c3 commit d4abca5
Copy full SHA for d4abca5

File tree

Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/bootstrap_node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap_node.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
'use strict';
99

1010
(function(process) {
11-
this.global = this;
1211

1312
function startup() {
1413
var EventEmitter = NativeModule.require('events');
@@ -200,7 +199,6 @@
200199

201200
function setupGlobalVariables() {
202201
global.process = process;
203-
global.global = global;
204202
global.GLOBAL = global;
205203
global.root = global;
206204
global.Buffer = NativeModule.require('buffer').Buffer;
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ using v8::Local;
117117
using v8::Locker;
118118
using v8::MaybeLocal;
119119
using v8::Message;
120+
using v8::Null;
120121
using v8::Number;
121122
using v8::Object;
122123
using v8::ObjectTemplate;
@@ -3257,8 +3258,12 @@ void LoadEnvironment(Environment* env) {
32573258

32583259
env->SetMethod(env->process_object(), "_rawDebug", RawDebug);
32593260

3261+
// Expose the global object as a property on itself
3262+
// (Allows you to set stuff on `global` from anywhere in JavaScript.)
3263+
global->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "global"), global);
3264+
32603265
Local<Value> arg = env->process_object();
3261-
f->Call(global, 1, &arg);
3266+
f->Call(Null(env->isolate()), 1, &arg);
32623267
}
32633268

32643269
static void PrintHelp();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.