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

+#endif
+            "process.chdir(require('path').dirname(process.mainModule.filename));"
+            "process.mainModule.paths = require('module')._nodeModulePaths(process.cwd());"
+
+            // 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..d4777c3 100644
--- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -64,6 +64,12 @@
 #include "V8PerContextData.h"
 #include "WorkerContextExecutionProxy.h"
 
+#include "base/command_line.h"
+#include "content/nw/src/shell_switches.h"
+#include "content/nw/src/nw_version.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 +303,7 @@ bool V8DOMWindowShell::initContextIfNeeded()
         return true;
 
     v8::HandleScope handleScope;
