From 0430380de14efda9d8fa991809cf2639c712740b Mon Sep 17 00:00:00 2001 From: James Ide Date: Tue, 10 Jan 2017 19:29:22 -0800 Subject: [PATCH] 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"` --- spec/fixtures/module/declare-global.js | 2 ++ spec/fixtures/module/declare-process.js | 2 ++ spec/modules-spec.js | 22 ++++++++++++++++++++++ vendor/node | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/module/declare-global.js create mode 100644 spec/fixtures/module/declare-process.js diff --git a/spec/fixtures/module/declare-global.js b/spec/fixtures/module/declare-global.js new file mode 100644 index 00000000000..d19b1c2a9db --- /dev/null +++ b/spec/fixtures/module/declare-global.js @@ -0,0 +1,2 @@ +const global = {__global: true} +module.exports = global diff --git a/spec/fixtures/module/declare-process.js b/spec/fixtures/module/declare-process.js new file mode 100644 index 00000000000..9108e277789 --- /dev/null +++ b/spec/fixtures/module/declare-process.js @@ -0,0 +1,2 @@ +const process = require('process') +module.exports = process diff --git a/spec/modules-spec.js b/spec/modules-spec.js index 601e40d050b..458e573381e 100644 --- a/spec/modules-spec.js +++ b/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 () { diff --git a/vendor/node b/vendor/node index 494083b7409..0bf9958c91e 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit 494083b740949caa93aca64ce75fe75c31e2034e +Subproject commit 0bf9958c91e7aed26d5d474b4ca59d3dce3e5e05