buffer: move setupBufferJS to internal#16391
Conversation
|
CI: https://ci.nodejs.org/job/node-test-pull-request/10911/ And since this modifies |
lib/internal/buffer.js
Outdated
There was a problem hiding this comment.
Not blocking, and up for debate:
Since this changes global state, maybe move this to node_bootstap, or explicitly require with a comment. Otherwise AFAICT it will run as a side effect of
node/lib/internal/bootstrap_node.js
Line 295 in 02a5267
There was a problem hiding this comment.
Hmm, I'd like to keep the caching and removing of setupBufferJS in the same place. Would a comment in bootstrap_node.js clarifying that requiring buffer also removes the setupBufferJS from the binding be sufficient to clarify? Something like:
// Note that this requires `lib/internal/buffer.js`, which removes `setupBufferJS`
// from the buffer binding.
global.Buffer = NativeModule.require('buffer').Buffer;There was a problem hiding this comment.
Another viable option is to add this to bootstrap_node.js
// This require as side effect removes `setupBufferJS` from the buffer binding.
NativeModule.require('internal/buffer.js');There was a problem hiding this comment.
Cool, I'll throw a comment and explicit require in. Stay tuned.
17e4f98 to
a8aaaac
Compare
|
I've just realized the commit message is wrong. Fixing it now. |
Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals.
a8aaaac to
ecd7dc6
Compare
|
Alright here's another round of CI and CITGM, since this has changed slightly as per @refack's review. CI: https://ci.nodejs.org/job/node-test-pull-request/10955/ |
|
CI failures are unrelated |
Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals. PR-URL: #16391 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 8172f45 |
Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals. PR-URL: nodejs/node#16391 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to |
|
@gibfahn I think in order to avoid the circular dependency issue (https://github.com/nodejs/node/blob/v8.x-staging/lib/buffer.js#L1501-L1503) (not an issue on master/9.x) it may not make sense to backport this commit as it's implemented. That is, putting |
Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals. PR-URL: nodejs/node#16391 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals.
/cc @Fishrock123 @addaleax since we've previously talked about doing this.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
buffer