mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
vm: allow cachedData to also be TypedArray|DataView
PR-URL: https://github.com/nodejs/node/pull/22921 Refs: https://github.com/nodejs/node/issues/1826 Refs: https://github.com/nodejs/node/pull/22921#issuecomment-422350213 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
1 parent
84e5807b1e
commit
2331181410
5 files changed
+37
-29
No files matched your search
@@ -178,18 +178,20 @@ const vm = require('vm');
|
||||
'filename': 'string',
|
||||
'columnOffset': 'number',
|
||||
'lineOffset': 'number',
|
||||
'cachedData': 'Uint8Array',
|
||||
'cachedData': 'Buffer, TypedArray, or DataView',
|
||||
'produceCachedData': 'boolean',
|
||||
};
|
||||
|
||||
for (const option in optionTypes) {
|
||||
const typeErrorMessage = `The "options.${option}" property must be ` +
|
||||
`${option === 'cachedData' ? 'one of' : 'of'} type`;
|
||||
common.expectsError(() => {
|
||||
vm.compileFunction('', undefined, { [option]: null });
|
||||
}, {
|
||||
type: TypeError,
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
message: `The "options.${option}" property must be of type ` +
|
||||
`${optionTypes[option]}. Received type object`
|
||||
message: typeErrorMessage +
|
||||
` ${optionTypes[option]}. Received type object`
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user