Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-12-22 06:08:36 +0300
committerRich Trott <rtrott@gmail.com>2019-12-25 03:14:05 +0300
commit9c566e6289fe11b4bc78717941dae09bea2b4e6e (patch)
tree51ccb92f73fe2df34c8870c7c57ff207fab4cb63 /lib
parente23bf8f771aa0bd60e25ff079985fc29b5846403 (diff)
doc,vm,test: remove _sandbox_ from vm documentation
The vm documentation uses the word _sandbox_ but has a significant disclaimer about how that should not be interpreted to connote security guarantees. Remove the term "sandbox" from documentation. As a result, some code and tests also need to change. PR-URL: https://github.com/nodejs/node/pull/31057 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/vm.js61
1 files changed, 31 insertions, 30 deletions
diff --git a/lib/vm.js b/lib/vm.js
index a4b5b37e83c..211755b9728 100644
--- a/lib/vm.js
+++ b/lib/vm.js
@@ -121,30 +121,31 @@ class Script extends ContextifyScript {
}
}
- runInContext(contextifiedSandbox, options) {
- validateContext(contextifiedSandbox);
+ runInContext(contextifiedObject, options) {
+ validateContext(contextifiedObject);
const { breakOnSigint, args } = getRunInContextArgs(options);
if (breakOnSigint && process.listenerCount('SIGINT') > 0) {
return sigintHandlersWrap(super.runInContext, this,
- [contextifiedSandbox, ...args]);
+ [contextifiedObject, ...args]);
} else {
- return super.runInContext(contextifiedSandbox, ...args);
+ return super.runInContext(contextifiedObject, ...args);
}
}
- runInNewContext(sandbox, options) {
- const context = createContext(sandbox, getContextOptions(options));
+ runInNewContext(contextObject, options) {
+ const context = createContext(contextObject, getContextOptions(options));
return this.runInContext(context, options);
}
}
-function validateContext(sandbox) {
- if (typeof sandbox !== 'object' || sandbox === null) {
- throw new ERR_INVALID_ARG_TYPE('contextifiedSandbox', 'Object', sandbox);
+function validateContext(contextifiedObject) {
+ if (typeof contextifiedObject !== 'object' || contextifiedObject === null) {
+ throw new ERR_INVALID_ARG_TYPE('contextifiedObject', 'Object',
+ contextifiedObject);
}
- if (!_isContext(sandbox)) {
- throw new ERR_INVALID_ARG_TYPE('contextifiedSandbox', 'vm.Context',
- sandbox);
+ if (!_isContext(contextifiedObject)) {
+ throw new ERR_INVALID_ARG_TYPE('contextifiedObject', 'vm.Context',
+ contextifiedObject);
}
}
@@ -218,17 +219,17 @@ function getContextOptions(options) {
return {};
}
-function isContext(sandbox) {
- if (typeof sandbox !== 'object' || sandbox === null) {
- throw new ERR_INVALID_ARG_TYPE('sandbox', 'Object', sandbox);
+function isContext(object) {
+ if (typeof object !== 'object' || object === null) {
+ throw new ERR_INVALID_ARG_TYPE('object', 'Object', object);
}
- return _isContext(sandbox);
+ return _isContext(object);
}
let defaultContextNameIndex = 1;
-function createContext(sandbox = {}, options = {}) {
- if (isContext(sandbox)) {
- return sandbox;
+function createContext(contextObject = {}, options = {}) {
+ if (isContext(contextObject)) {
+ return contextObject;
}
if (typeof options !== 'object' || options === null) {
@@ -254,8 +255,8 @@ function createContext(sandbox = {}, options = {}) {
validateBool(wasm, 'options.codeGeneration.wasm');
}
- makeContext(sandbox, name, origin, strings, wasm);
- return sandbox;
+ makeContext(contextObject, name, origin, strings, wasm);
+ return contextObject;
}
function createScript(code, options) {
@@ -280,27 +281,27 @@ function sigintHandlersWrap(fn, thisArg, argsArray) {
}
}
-function runInContext(code, contextifiedSandbox, options) {
- validateContext(contextifiedSandbox);
+function runInContext(code, contextifiedObject, options) {
+ validateContext(contextifiedObject);
if (typeof options === 'string') {
options = {
filename: options,
- [kParsingContext]: contextifiedSandbox
+ [kParsingContext]: contextifiedObject
};
} else {
- options = { ...options, [kParsingContext]: contextifiedSandbox };
+ options = { ...options, [kParsingContext]: contextifiedObject };
}
return createScript(code, options)
- .runInContext(contextifiedSandbox, options);
+ .runInContext(contextifiedObject, options);
}
-function runInNewContext(code, sandbox, options) {
+function runInNewContext(code, contextObject, options) {
if (typeof options === 'string') {
options = { filename: options };
}
- sandbox = createContext(sandbox, getContextOptions(options));
- options = { ...options, [kParsingContext]: sandbox };
- return createScript(code, options).runInNewContext(sandbox, options);
+ contextObject = createContext(contextObject, getContextOptions(options));
+ options = { ...options, [kParsingContext]: contextObject };
+ return createScript(code, options).runInNewContext(contextObject, options);
}
function runInThisContext(code, options) {