diff --git a/doc/api/vm.md b/doc/api/vm.md index 5b47d3872c3207..d5dd824180ce94 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -175,6 +175,15 @@ added: v0.3.1 * `timeout` {number} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] will be thrown. + * `contextName` {string} Human-readable name of the newly created context. + **Default:** `'VM Context i'`, where `i` is an ascending numerical index of + the created context. + * `contextOrigin` {string} [Origin][origin] corresponding to the newly + created context for display purposes. The origin should be formatted like a + URL, but with only the scheme, host, and port (if necessary), like the + value of the [`url.origin`][] property of a [`URL`][] object. Most notably, + this string should omit the trailing slash, as that denotes a path. + **Default:** `''`. First contextifies the given `sandbox`, runs the compiled code contained by the `vm.Script` object within the created sandbox, and returns the result. @@ -242,12 +251,18 @@ console.log(globalVar); // 1000 ``` -## vm.createContext([sandbox]) +## vm.createContext([sandbox[, options]]) * `sandbox` {Object} +* `options` {Object} + * `name` {string} Human-readable name of the newly created context. + **Default:** `'VM Context i'`, where `i` is an ascending numerical index of + the created context. + * `origin` {string} [Origin][origin] corresponding to the newly created + context for display purposes. **Default:** `''`. If given a `sandbox` object, the `vm.createContext()` method will [prepare that sandbox][contextified] so that it can be used in calls to @@ -282,6 +297,9 @@ web browser, the method can be used to create a single sandbox representing a window's global object, then run all `