diff --git a/BUILDING.md b/BUILDING.md index 5a8d93356a7150..4f46acd6fbfe65 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -199,9 +199,11 @@ Prerequisites: * [Visual Studio 2015 Update 3](https://www.visualstudio.com/), all editions including the Community edition (remember to select "Common Tools for Visual C++ 2015" feature during installation). - * [Visual Studio 2017](https://www.visualstudio.com/downloads/), any edition (including the Build Tools SKU). - **Required Components:** "MSbuild", "VC++ 2017 v141 toolset" and at least one of the Windows SDKs. - *Note*: For "Windows 10 SDK (10.0.15063.0)" only the "Desktop C++ x86 and x64" flavor is required. + * The "Desktop development with C++" workload from + [Visual Studio 2017](https://www.visualstudio.com/downloads/) or the + "Visual C++ build tools" workload from the + [Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017), + with the default optional components. * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. diff --git a/CHANGELOG.md b/CHANGELOG.md index c7fc83819273eb..76d5b50a934dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,8 @@ release. -8.9.1
+8.9.2
+8.9.1
8.9.0
8.8.1
8.8.0
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index acbd3fa9b5d8c0..c61aad6e7d4f31 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -371,25 +371,11 @@ The TSC should serve as the final arbiter where required. * If more than one author has contributed to the PR, keep the most recent author when squashing. -Always modify the original commit message to include additional meta -information regarding the change process: - -- A `PR-URL:` line that references the *full* GitHub URL of the original - pull request being merged so it's easy to trace a commit back to the - conversation that led up to that change. -- A `Fixes: X` line, where _X_ either includes the *full* GitHub URL - for an issue, and/or the hash and commit message if the commit fixes - a bug in a previous commit. Multiple `Fixes:` lines may be added if - appropriate. -- A `Refs:` line referencing a URL for any relevant background. -- A `Reviewed-By: Name ` line for yourself and any - other Collaborators who have reviewed the change. - - Useful for @mentions / contact list if something goes wrong in the PR. - - Protects against the assumption that GitHub will be around forever. - Review the commit message to ensure that it adheres to the guidelines outlined in the [contributing](./CONTRIBUTING.md#commit-message-guidelines) guide. +Add all necessary [metadata](#metadata) to commit messages before landing. + See the commit log for examples such as [this one](https://github.com/nodejs/node/commit/b636ba8186) if unsure exactly how to format your commit messages. @@ -397,34 +383,33 @@ exactly how to format your commit messages. Additionally: - Double check PRs to make sure the person's _full name_ and email address are correct before merging. -- Except when updating dependencies, all commits should be self - contained (meaning every commit should pass all tests). This makes - it much easier when bisecting to find a breaking change. +- All commits should be self-contained (meaning every commit should pass all + tests). This makes it much easier when bisecting to find a breaking change. ### Technical HOWTO -Clear any `am`/`rebase` that may already be underway. +Clear any `am`/`rebase` that may already be underway: ```text $ git am --abort $ git rebase --abort ``` -Checkout proper target branch +Checkout proper target branch: ```text $ git checkout master ``` Update the tree (assumes your repo is set up as detailed in -[CONTRIBUTING.md](CONTRIBUTING.md#step-1-fork)) +[CONTRIBUTING.md](CONTRIBUTING.md#step-1-fork)): ```text $ git fetch upstream $ git merge --ff-only upstream/master ``` -Apply external patches +Apply external patches: ```text $ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix @@ -442,21 +427,19 @@ against the original PR carefully and build/test on at least one platform before landing. If the 3-way merge fails, then it is most likely that a conflicting PR has landed since the CI run and you will have to ask the author to rebase. -Check and re-review the changes +Check and re-review the changes: ```text $ git diff upstream/master ``` -Check number of commits and commit messages +Check number of commits and commit messages: ```text $ git log upstream/master...master ``` -If there are multiple commits that relate to the same feature or -one with a feature and separate with a test for that feature, -you'll need to use `squash` or `fixup`: +Squash commits and add metadata: ```text $ git rebase -i upstream/master @@ -512,9 +495,28 @@ Save the file and close the editor. You'll be asked to enter a new commit message for that commit. This is a good moment to fix incorrect commit logs, ensure that they are properly formatted, and add `Reviewed-By` lines. + * The commit message text must conform to the [commit message guidelines](./CONTRIBUTING.md#commit-message-guidelines). + +* Modify the original commit message to include additional metadata regarding + the change process. ([`node-core-utils`][] fetches the metadata for you.) + + * Required: A `PR-URL:` line that references the *full* GitHub URL of the + original pull request being merged so it's easy to trace a commit back to + the conversation that led up to that change. + * Optional: A `Fixes: X` line, where _X_ either includes the *full* GitHub URL + for an issue, and/or the hash and commit message if the commit fixes + a bug in a previous commit. Multiple `Fixes:` lines may be added if + appropriate. + * Optional: One or more `Refs:` lines referencing a URL for any relevant + background. + * Required: A `Reviewed-By: Name ` line for yourself and any + other Collaborators who have reviewed the change. + * Useful for @mentions / contact list if something goes wrong in the PR. + * Protects against the assumption that GitHub will be around forever. + Run tests (`make -j4 test` or `vcbuild test`). Even though there was a successful continuous integration run, other changes may have landed on master since then, so running the tests one last time locally is a good practice. @@ -678,3 +680,4 @@ LTS working group and the Release team. [Stability Index]: doc/api/documentation.md#stability-index [Enhancement Proposal]: https://github.com/nodejs/node-eps [git-username]: https://help.github.com/articles/setting-your-username-in-git/ +[`node-core-utils`]: https://github.com/nodejs/node-core-utils diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99278a843af683..b234f9354883cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -334,6 +334,14 @@ use `Refs:`. - `Refs: http://eslint.org/docs/rules/space-in-parens.html` - `Refs: https://github.com/nodejs/node/pull/3615` +5. If your commit introduces a breaking change (`semver-major`), it should +contain an explanation about the reason of the breaking change, which +situation would trigger the breaking change and what is the exact change. + +Breaking changes will be listed in the wiki with the aim to make upgrading +easier. Please have a look at [Breaking Changes](https://github.com/nodejs/node/wiki/Breaking-changes-between-v4-LTS-and-v6-LTS) +for the level of detail that's suitable. + Sample complete commit message: ```txt @@ -625,6 +633,7 @@ Focus first on the most significant aspects of the change: 1. Does this change make sense for Node.js? 2. Does this change make Node.js better, even if only incrementally? 3. Are there clear bugs or larger scale issues that need attending to? +4. Is the commit message readable and correct? If it contains a breaking change is it clear enough? When changes are necessary, *request* them, do not *demand* them, and do not assume that the submitter already knows how to add a test or run a benchmark. diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3e7319c1f8e8f7..3bea5bb107586f 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -127,6 +127,21 @@ class FancyContainer { What it says in the title. +## Do not include `*.h` if `*-inl.h` has already been included + +Do + +```cpp +#include "util-inl.h" // already includes util.h +``` + +instead of + +```cpp +#include "util.h" +#include "util-inl.h" +``` + ## Avoid throwing JavaScript errors in nested C++ methods If you need to throw JavaScript errors from a C++ binding method, try to do it diff --git a/LICENSE b/LICENSE index c75bf1669883ba..cb37cd1b961ab3 100644 --- a/LICENSE +++ b/LICENSE @@ -1146,3 +1146,26 @@ The externally maintained libraries used by Node.js are: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ + +- node-inspect, located at deps/node-inspect, is licensed as follows: + """ + Copyright Node.js contributors. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + """ diff --git a/Makefile b/Makefile index c2f872daed698c..b2facee41a8442 100644 --- a/Makefile +++ b/Makefile @@ -974,17 +974,41 @@ bench-ci: bench lint-md-clean: $(RM) -r tools/remark-cli/node_modules $(RM) -r tools/remark-preset-lint-node/node_modules + $(RM) tools/.*mdlintstamp lint-md-build: - if [ ! -d tools/remark-cli/node_modules ]; then \ + @if [ ! -d tools/remark-cli/node_modules ]; then \ + echo "Markdown linter: installing remark-cli into tools/"; \ cd tools/remark-cli && ../../$(NODE) ../../$(NPM) install; fi - if [ ! -d tools/remark-preset-lint-node/node_modules ]; then \ + @if [ ! -d tools/remark-preset-lint-node/node_modules ]; then \ + echo "Markdown linter: installing remark-preset-lint-node into tools/"; \ cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi -lint-md: lint-md-build - @echo "Running Markdown linter..." - $(NODE) tools/remark-cli/cli.js -q -f \ - ./*.md doc src lib benchmark tools/doc/ tools/icu/ +ifneq ("","$(wildcard tools/remark-cli/node_modules/)") +LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu +LINT_MD_ROOT_DOCS := $(wildcard *.md) +LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ + -not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS) +LINT_DOC_MD_FILES = $(shell ls doc/**/*.md) + +tools/.docmdlintstamp: $(LINT_DOC_MD_FILES) + @echo "Running Markdown linter on docs..." + @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_DOC_MD_FILES) + @touch $@ + +tools/.miscmdlintstamp: $(LINT_MD_FILES) + @echo "Running Markdown linter on misc docs..." + @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_MD_FILES) + @touch $@ + +tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp + +lint-md: | tools/.mdlintstamp +else +lint-md: + @echo "The markdown linter is not installed." + @echo "To install (requires internet access) run: $ make lint-md-build" +endif LINT_JS_TARGETS = benchmark doc lib test tools LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \ @@ -1046,10 +1070,13 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ # and the actual filename is generated so it won't match header guards ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard -lint-cpp: +lint-cpp: tools/.cpplintstamp + +tools/.cpplintstamp: $(LINT_CPP_FILES) @echo "Running C++ linter..." - @$(PYTHON) tools/cpplint.py $(LINT_CPP_FILES) + @$(PYTHON) tools/cpplint.py $? @$(PYTHON) tools/check-imports.py + @touch $@ lint-addon-docs: test/addons/.docbuildstamp @echo "Running C++ linter on addon docs..." @@ -1085,6 +1112,10 @@ lint: lint-ci: lint endif +lint-clean: + $(RM) tools/.*lintstamp + $(RM) .eslintcache + .PHONY: $(TARBALL)-headers \ all \ bench \ @@ -1125,6 +1156,7 @@ endif install-bin \ install-includes \ lint \ + lint-clean \ lint-ci \ lint-cpp \ lint-js \ diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index f9359b13d5e9e4..54b7481afaa817 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -91,11 +91,9 @@ class TestDoubleBenchmarker { create(options) { const child = child_process.fork(this.executable, { silent: true, - env: { - duration: options.duration, - connections: options.connections, - path: `http://127.0.0.1:${options.port}${options.path}` - } + env: Object.assign({}, process.env, { + test_url: `http://127.0.0.1:${options.port}${options.path}` + }) }); return child; } diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js index 0a8c5f9264efc8..8c2f744fbf6e9f 100644 --- a/benchmark/_test-double-benchmarker.js +++ b/benchmark/_test-double-benchmarker.js @@ -2,6 +2,6 @@ const http = require('http'); -http.get(process.env.path, function() { +http.get(process.env.test_url, function() { console.log(JSON.stringify({ throughput: 1 })); }); diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index d3c3a2b76c13ff..f7395e3d6f3c9c 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 1 #define V8_BUILD_NUMBER 534 -#define V8_PATCH_LEVEL 47 +#define V8_PATCH_LEVEL 48 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/test/message/testcfg.py b/deps/v8/test/message/testcfg.py index 0576458af24a4e..1bbb2b16d83472 100644 --- a/deps/v8/test/message/testcfg.py +++ b/deps/v8/test/message/testcfg.py @@ -107,7 +107,7 @@ def IsFailureOutput(self, testcase): expected_lines, actual_lines, fillvalue=''): pattern = re.escape(expected.rstrip() % env) pattern = pattern.replace("\\*", ".*") - pattern = pattern.replace("\\{NUMBER\\}", "\d(?:\.\d*)?") + pattern = pattern.replace("\\{NUMBER\\}", "\d+(?:\.\d*)?") pattern = "^%s$" % pattern if not re.match(pattern, actual): return True diff --git a/doc/api/assert.md b/doc/api/assert.md index ca110ecbfc44dc..962097c67ef63e 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -299,7 +299,7 @@ assert.fail(1, 2, 'whoops', '>'); // AssertionError [ERR_ASSERTION]: whoops ``` -*Note*: Is the last two cases `actual`, `expected`, and `operator` have no +*Note*: In the last two cases `actual`, `expected`, and `operator` have no influence on the error message. ```js diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 547a42aef56075..6d27c1447ad36a 100755 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -264,6 +264,8 @@ changes: * `gid` {number} Sets the group identity of the process (see setgid(2)). * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} @@ -338,6 +340,8 @@ changes: When this option is provided, it overrides `silent`. If the array variant is used, it must contain exactly one item with value `'ipc'` or an error will be thrown. For instance `[0, 1, 2, 'ipc']`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `uid` {number} Sets the user identity of the process (see setuid(2)). * `gid` {number} Sets the group identity of the process (see setgid(2)). * Returns: {ChildProcess} @@ -404,6 +408,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {ChildProcess} @@ -813,6 +820,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {Object} @@ -1038,10 +1048,11 @@ added: v0.5.10 --> * {boolean} Set to `true` after `subprocess.kill()` is used to successfully - terminate the child process. + send a signal to the child process. -The `subprocess.killed` property indicates whether the child process was -successfully terminated using `subprocess.kill()`. +The `subprocess.killed` property indicates whether the child process +successfully received a signal from `subprocess.kill()`. The `killed` property +does not indicate that the child process has been terminated. ### subprocess.pid diff --git a/doc/api/console.md b/doc/api/console.md index 6c832fece6a226..2cc16bdc8fc4f1 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -216,7 +216,7 @@ undefined > ``` -### console.countReset([label = 'default']) +### console.countReset([label='default']) @@ -293,7 +293,7 @@ values are concatenated. See [`util.format()`][] for more information. added: v8.5.0 --> -* `label` {any} +* `...label` {any} Increases indentation of subsequent lines by two spaces. diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 79c4ffdd406ea4..6edf11f704fa5f 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1848,6 +1848,7 @@ added: v6.6.0 - `a` {Buffer | TypedArray | DataView} - `b` {Buffer | TypedArray | DataView} +This function is based on a constant-time algorithm. Returns true if `a` is equal to `b`, without leaking timing information that would allow an attacker to guess one of the values. This is suitable for comparing HMAC digests or secret values like authentication cookies or diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 6b301e01eb3cac..6da72219a95dc2 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -118,7 +118,7 @@ to the `constants` property exposed by the relevant module. For instance, Type: End-of-life Use of the [`crypto.pbkdf2()`][] API without specifying a digest was deprecated -in Node.js 6.0 because the method defaulted to using the non-recommendend +in Node.js 6.0 because the method defaulted to using the non-recommended `'SHA1'` digest. Previously, a deprecation warning was printed. Starting in Node.js 8.0.0, calling `crypto.pbkdf2()` or `crypto.pbkdf2Sync()` with an undefined `digest` will throw a `TypeError`. diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 980537640f6e8d..4e57142888b8d3 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -455,7 +455,7 @@ On IPv4, if `multicastInterface` is a valid address but does not match any interface, or if the address does not match the family then a [`System Error`][] such as `EADDRNOTAVAIL` or `EPROTONOSUP` is thrown. -On IPv6, most errors with specifying or omiting scope will result in the socket +On IPv6, most errors with specifying or omitting scope will result in the socket continuing to use (or returning to) the system's default interface selection. A socket's address family's ANY address (IPv4 `'0.0.0.0'` or IPv6 `'::'`) can be @@ -629,7 +629,7 @@ and `udp6` sockets). The bound address and port can be retrieved using [`socket.address().address`]: #dgram_socket_address [`socket.address().port`]: #dgram_socket_address [`socket.bind()`]: #dgram_socket_bind_port_address_callback -[`System Error`]: errors.html#errors_class_system_error +[`System Error`]: errors.html#errors_class_systemerror [byte length]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding [IPv6 Zone Indices]: https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices [RFC 4007]: https://tools.ietf.org/html/rfc4007 diff --git a/doc/api/errors.md b/doc/api/errors.md index 6a9568952a846c..4d28d4f1d13028 100755 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -711,7 +711,7 @@ requests and responses. ### ERR_HTTP2_INVALID_HEADER_VALUE -Used to indicate that an invalid HTTP/2 header value has been specified. +Used to indicate that an invalid HTTP2 header value has been specified. ### ERR_HTTP2_INVALID_INFO_STATUS diff --git a/doc/api/http2.md b/doc/api/http2.md index 2a958c30c3fa15..2f8296270f4c36 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -821,7 +821,7 @@ Shortcut for `http2stream.rstStream()` using error code `0x02` (Internal Error). added: v8.4.0 --> -* Value: {Http2Sesssion} +* Value: {Http2Session} A reference to the `Http2Session` instance that owns this `Http2Stream`. The value will be `undefined` after the `Http2Stream` instance is destroyed. @@ -1781,7 +1781,7 @@ All additional properties on the settings object are ignored. ### Using `options.selectPadding` When `options.paddingStrategy` is equal to -`http2.constants.PADDING_STRATEGY_CALLBACK`, the the HTTP/2 implementation will +`http2.constants.PADDING_STRATEGY_CALLBACK`, the HTTP/2 implementation will consult the `options.selectPadding` callback function, if provided, to determine the specific amount of padding to use per HEADERS and DATA frame. diff --git a/doc/api/process.md b/doc/api/process.md index 7a005503c9b2e2..ddc6d94acf31ca 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1240,7 +1240,13 @@ Will generate: `heapTotal` and `heapUsed` refer to V8's memory usage. `external` refers to the memory usage of C++ objects bound to JavaScript -objects managed by V8. +objects managed by V8. `rss`, Resident Set Size, is the amount of space +occupied in the main memory device (that is a subset of the total allocated +memory) for the process, which includes the _heap_, _code segment_ and _stack_. + +The _heap_ is where objects, strings and closures are stored. Variables are +stored in the _stack_ and the actual JavaScript code resides in the +_code segment_. ## process.nextTick(callback[, ...args]) + +A `boolean` that is always `true`. + ### readStream.setRawMode(mode) + +A `boolean` that is always `true`. + ### writeStream.rows The `vm` module provides APIs for compiling and running code within V8 Virtual -Machine contexts. It can be accessed using: +Machine contexts. + +JavaScript code can be compiled and run immediately or +compiled, saved, and run later. + +A common use case is to run the code in a sandboxed environment. +The sandboxed code uses a different V8 Context, meaning that +it has a different global object than the rest of the code. + +One can provide the context by ["contextifying"][contextified] a sandbox +object. The sandboxed code treats any property on the sandbox like a +global variable. Any changes on global variables caused by the sandboxed +code are reflected in the sandbox object. ```js const vm = require('vm'); -``` -JavaScript code can be compiled and run immediately or compiled, saved, and run -later. +const x = 1; + +const sandbox = { x: 2 }; +vm.createContext(sandbox); // Contextify the sandbox. + +const code = 'x += 40; var y = 17;'; +// x and y are global variables in the sandboxed environment. +// Initially, x has the value 2 because that is the value of sandbox.x. +vm.runInContext(code, sandbox); + +console.log(sandbox.x); // 42 +console.log(sandbox.y); // 17 + +console.log(x); // 1; y is not defined. +``` *Note*: The vm module is not a security mechanism. **Do not use it to run untrusted code**. diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 180ae431c21873..0513699fb04252 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -406,6 +406,13 @@ The `zlib.bytesRead` property specifies the number of bytes read by the engine before the bytes are processed (compressed or decompressed, as appropriate for the derived class). +### zlib.close([callback]) + + +Close the underlying handle. + ### zlib.flush([kind], callback) \n` + - inc + `\n\n`; - input = input.split(include + '\n').join(includeData[fname] + '\n'); + `${inc}\n\n`; + input = input.split(`${include}\n`).join(`${includeData[fname]}\n`); if (incCount === 0) { return cb(null, input); } diff --git a/tools/eslint-rules/crypto-check.js b/tools/eslint-rules/crypto-check.js index b1b2a03f50e3b6..9d24d3355dce7f 100644 --- a/tools/eslint-rules/crypto-check.js +++ b/tools/eslint-rules/crypto-check.js @@ -54,7 +54,7 @@ module.exports = function(context) { } } - function reportIfMissingCheck(node) { + function reportIfMissingCheck() { if (hasSkipCall) { return; } diff --git a/tools/eslint-rules/inspector-check.js b/tools/eslint-rules/inspector-check.js index f225b34cb6b0ca..bb40a98183250c 100644 --- a/tools/eslint-rules/inspector-check.js +++ b/tools/eslint-rules/inspector-check.js @@ -14,12 +14,12 @@ const msg = 'Please add a skipIfInspectorDisabled() call to allow this ' + 'test to be skippped when Node is built \'--without-inspector\'.'; module.exports = function(context) { - var usesInspector = false; + const missingCheckNodes = []; var hasInspectorCheck = false; function testInspectorUsage(context, node) { if (utils.isRequired(node, ['inspector'])) { - usesInspector = true; + missingCheckNodes.push(node); } } @@ -29,9 +29,11 @@ module.exports = function(context) { } } - function reportIfMissing(context, node) { - if (usesInspector && !hasInspectorCheck) { - context.report(node, msg); + function reportIfMissing(context) { + if (!hasInspectorCheck) { + missingCheckNodes.forEach((node) => { + context.report(node, msg); + }); } } diff --git a/tools/license-builder.sh b/tools/license-builder.sh index d984e85fedbc93..5cf27d86a0b9e7 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -86,4 +86,7 @@ addlicense "nghttp2" "deps/nghttp2" "$(cat ${rootdir}/deps/nghttp2/COPYING)" # remark-cli addlicense "remark-cli" "tools/remark-cli" "$(cat ${rootdir}/tools/remark-cli/LICENSE)" +# node-inspect +addlicense "node-inspect" "deps/node-inspect" "$(cat ${rootdir}/deps/node-inspect/LICENSE)" + mv $tmplicense $licensefile diff --git a/vcbuild.bat b/vcbuild.bat index 7db343d8747a21..aa6e1833c22941 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -501,8 +501,10 @@ goto exit echo %1 | findstr /c:"src\node_root_certs.h" if %errorlevel% equ 0 goto exit -@rem skip subfolders under /src -echo %1 | findstr /r /c:"src\\.*\\.*" +echo %1 | findstr /r /c:"src\\tracing\\trace_event.h" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /r /c:"src\\tracing\\trace_event_common.h" if %errorlevel% equ 0 goto exit echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h"