-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
lib: support returning Safe collections from C++ #36989
lib: support returning Safe collections from C++ #36989
Conversation
ccec24a
to
e5c872f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd interesting to add a check that we're no longer using user-mutable methods:
const assert = require('assert');
const { options } = require('internal/options');
assert.notStrictEqual(options.get, Map.prototype.get);
const assert = require('assert');
const { getOptionValue } = require('internal/options');
Map.prototype.get = function get() { return 'polluted result'; };
assert.strictEqual(getOptionValue('--expose-internals'), true);
e5c872f
to
ad9b5a5
Compare
That will fail unless |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
fd622d9
to
b427d33
Compare
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Landed in 3ec7114 |
Refs: #36652
This works similarly to what’s done to support constructing
Buffer
instances from C++, but unlikeBuffer.prototype
, theSafe*
collection prototypes can be captured as soon asInitializePrimordials
has finished runninglib/internal/per_context/primordials.js
.