New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local Buffer variable in module.js require wrapper #8758

Merged
merged 3 commits into from Feb 24, 2017

Conversation

Projects
None yet
2 participants
@kevinsawicki
Contributor

kevinsawicki commented Feb 23, 2017

This pull request is a minor update to #8605 to use Buffer instead of global.Buffer in the module.js require wrapper.

Previously modules required from preload scripts after the loaded event fires on process would not have Buffer specified as an argument to the require wrapper since it would be deleted from the global in init.js.

Node diff:

diff --git a/lib/module.js b/lib/module.js
index 1bc27c0..c526fb0 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -565,7 +565,7 @@ Module.prototype._compile = function(content, filename) {
   }
   var dirname = path.dirname(filename);
   var require = internalModule.makeRequireFunction.call(this);
-  var args = [this.exports, require, this, filename, dirname, process, global, global.Buffer];
+  var args = [this.exports, require, this, filename, dirname, process, global, Buffer];
   var depth = internalModule.requireDepth;
   if (depth === 0) stat.cache = new Map();
   var result = compiledWrapper.apply(this.exports, args);

@kevinsawicki kevinsawicki merged commit 8e4bdec into master Feb 24, 2017

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
electron-linux-arm Build #5638341 succeeded in 66s
Details
electron-linux-ia32 Build #5638342 succeeded in 61s
Details
electron-linux-x64 Build #5638343 succeeded in 138s
Details
electron-mas-x64 Build #3497 succeeded in 8 min 9 sec
Details
electron-osx-x64 Build #3508 succeeded in 8 min 41 sec
Details
electron-win-ia32 Build #2516 succeeded in 8 min 1 sec
Details
electron-win-x64 Build #2489 succeeded in 8 min 3 sec
Details

@kevinsawicki kevinsawicki deleted the use-local-buffer branch Feb 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment