Browse Source

Update the Node submodule to use the new module wrapper

See the fixed issue for the context. This pulls in a vendored copy of Node that includes the described patch.

Fixes #8358

Test Plan: Built Electron and verified it loaded the sample app correctly and that the module wrapper is the new one by viewing Node's source code in the Blink Inspector.

Added specs and tested with `npm test -- --grep "global variables"`
James Ide 8 years ago
parent
commit
0430380de1

+ 2 - 0
spec/fixtures/module/declare-global.js

@@ -0,0 +1,2 @@
+const global = {__global: true}
+module.exports = global

+ 2 - 0
spec/fixtures/module/declare-process.js

@@ -0,0 +1,2 @@
+const process = require('process')
+module.exports = process

+ 22 - 0
spec/modules-spec.js

@@ -47,6 +47,28 @@ describe('third-party module', function () {
       })
     })
   })
+
+  describe('global variables', function () {
+    describe('process', function () {
+      it('can be declared in a module', function () {
+        var exportedProcess
+        assert.doesNotThrow(function () {
+          exportedProcess = require('./fixtures/module/declare-process')
+        })
+        assert.strictEqual(exportedProcess, require('process'))
+      })
+    })
+
+    describe('global', function () {
+      it('can be declared in a module', function () {
+        var exportedGlobal
+        assert.doesNotThrow(function () {
+          exportedGlobal = require('./fixtures/module/declare-global')
+        })
+        assert.deepEqual(exportedGlobal, {__global: true})
+      })
+    })
+  })
 })
 
 describe('Module._nodeModulePaths', function () {

+ 1 - 1
vendor/node

@@ -1 +1 @@
-Subproject commit 494083b740949caa93aca64ce75fe75c31e2034e
+Subproject commit 0bf9958c91e7aed26d5d474b4ca59d3dce3e5e05