 +#endif
 +            "process.chdir(require('path').dirname(process.mainModule.filename));"
 +            "process.mainModule.paths = require('module')._nodeModulePaths(process.cwd());"
-+
++        ));
++        script->Run();
++    }
++
++    if (use_node || is_nw_protocol) {
++        v8::Local<v8::Script> script = v8::Script::New(v8::String::New(
 +            // Use WebKit's console globally
 +            "global.console = console;"
 +

     }
     if ($interfaceName eq "HTMLDocument") {
diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
index e37b829..aeca32f 100644
--- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -64,6 +64,11 @@
 #include "V8PerContextData.h"
 #include "WorkerContextExecutionProxy.h"
 
+#include "base/command_line.h"
+#include "content/nw/src/shell_switches.h"
+#include "third_party/node/src/node.h"
+#include "third_party/node/src/req_wrap.h"
+
 #include <algorithm>
 #include <stdio.h>
 #include <utility>
@@ -297,6 +302,7 @@ bool V8DOMWindowShell::initContextIfNeeded()
         return true;
 
     v8::HandleScope handleScope;

 
     initializeV8IfNeeded();
 
@@ -328,7 +335,43 @@ bool V8DOMWindowShell::initContextIfNeeded()
 
     updateDocument();
 
