diff -Nru nodejs-6.11.2~dfsg/benchmark/arrays/var-int.js nodejs-6.11.4~dfsg/benchmark/arrays/var-int.js --- nodejs-6.11.2~dfsg/benchmark/arrays/var-int.js 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/arrays/var-int.js 2017-10-03 17:11:11.000000000 +0000 @@ -1,28 +1,26 @@ 'use strict'; -var common = require('../common.js'); +const common = require('../common.js'); -var types = [ - 'Array', - 'Buffer', - 'Int8Array', - 'Uint8Array', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array' -]; - -var bench = common.createBenchmark(main, { - type: types, +const bench = common.createBenchmark(main, { + type: [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' + ], n: [25] }); function main(conf) { - var type = conf.type; - var clazz = global[type]; - var n = +conf.n; + const type = conf.type; + const clazz = global[type]; + const n = +conf.n; bench.start(); var arr = new clazz(n * 1e6); diff -Nru nodejs-6.11.2~dfsg/benchmark/arrays/zero-float.js nodejs-6.11.4~dfsg/benchmark/arrays/zero-float.js --- nodejs-6.11.2~dfsg/benchmark/arrays/zero-float.js 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/arrays/zero-float.js 2017-10-03 17:11:11.000000000 +0000 @@ -1,28 +1,26 @@ 'use strict'; -var common = require('../common.js'); +const common = require('../common.js'); -var types = [ - 'Array', - 'Buffer', - 'Int8Array', - 'Uint8Array', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array' -]; - -var bench = common.createBenchmark(main, { - type: types, +const bench = common.createBenchmark(main, { + type: [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' + ], n: [25] }); function main(conf) { - var type = conf.type; - var clazz = global[type]; - var n = +conf.n; + const type = conf.type; + const clazz = global[type]; + const n = +conf.n; bench.start(); var arr = new clazz(n * 1e6); diff -Nru nodejs-6.11.2~dfsg/benchmark/arrays/zero-int.js nodejs-6.11.4~dfsg/benchmark/arrays/zero-int.js --- nodejs-6.11.2~dfsg/benchmark/arrays/zero-int.js 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/arrays/zero-int.js 2017-10-03 17:11:11.000000000 +0000 @@ -1,28 +1,26 @@ 'use strict'; -var common = require('../common.js'); +const common = require('../common.js'); -var types = [ - 'Array', - 'Buffer', - 'Int8Array', - 'Uint8Array', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array' -]; - -var bench = common.createBenchmark(main, { - type: types, +const bench = common.createBenchmark(main, { + type: [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' + ], n: [25] }); function main(conf) { - var type = conf.type; - var clazz = global[type]; - var n = +conf.n; + const type = conf.type; + const clazz = global[type]; + const n = +conf.n; bench.start(); var arr = new clazz(n * 1e6); diff -Nru nodejs-6.11.2~dfsg/benchmark/buffers/buffer-compare-offset.js nodejs-6.11.4~dfsg/benchmark/buffers/buffer-compare-offset.js --- nodejs-6.11.2~dfsg/benchmark/buffers/buffer-compare-offset.js 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/buffers/buffer-compare-offset.js 2017-10-03 17:11:11.000000000 +0000 @@ -50,7 +50,7 @@ const iter = (conf.millions >>> 0) * 1e6; const size = (conf.size >>> 0); const method = conf.method === 'slice' ? - compareUsingSlice : compareUsingOffset; + compareUsingSlice : compareUsingOffset; method(Buffer.alloc(size, 'a'), Buffer.alloc(size, 'b'), size >> 1, diff -Nru nodejs-6.11.2~dfsg/benchmark/child_process/child-process-read-ipc.js nodejs-6.11.4~dfsg/benchmark/child_process/child-process-read-ipc.js --- nodejs-6.11.2~dfsg/benchmark/child_process/child-process-read-ipc.js 2017-08-01 05:39:05.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/child_process/child-process-read-ipc.js 2017-10-03 17:11:11.000000000 +0000 @@ -26,7 +26,7 @@ const options = { 'stdio': ['ignore', 1, 2, 'ipc'] }; const child = spawn(process.argv[0], - [process.argv[1], 'child', len], options); + [process.argv[1], 'child', len], options); var bytes = 0; child.on('message', function(msg) { diff -Nru nodejs-6.11.2~dfsg/benchmark/dgram/bind-params.js nodejs-6.11.4~dfsg/benchmark/dgram/bind-params.js --- nodejs-6.11.2~dfsg/benchmark/dgram/bind-params.js 2017-08-01 05:39:05.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/dgram/bind-params.js 2017-10-03 17:11:11.000000000 +0000 @@ -10,6 +10,7 @@ }; const bench = common.createBenchmark(main, configs); +const noop = () => {}; function main(conf) { const n = +conf.n; @@ -19,19 +20,27 @@ if (port !== undefined && address !== undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind(port, address).unref(); + dgram.createSocket('udp4').bind(port, address) + .on('error', noop) + .unref(); } bench.end(n); } else if (port !== undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind(port).unref(); + dgram.createSocket('udp4') + .bind(port) + .on('error', noop) + .unref(); } bench.end(n); } else if (port === undefined && address === undefined) { bench.start(); for (let i = 0; i < n; i++) { - dgram.createSocket('udp4').bind().unref(); + dgram.createSocket('udp4') + .bind() + .on('error', noop) + .unref(); } bench.end(n); } diff -Nru nodejs-6.11.2~dfsg/benchmark/README.md nodejs-6.11.4~dfsg/benchmark/README.md --- nodejs-6.11.2~dfsg/benchmark/README.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/README.md 2017-10-03 17:11:11.000000000 +0000 @@ -37,15 +37,15 @@ ```js var bench = common.createBenchmark(main, { - noAssert: [false, true], - buffer: ['fast', 'slow'], - type: ['UInt8', 'UInt16LE', 'UInt16BE', - 'UInt32LE', 'UInt32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'FloatLE', 'FloatBE', - 'DoubleLE', 'DoubleBE'], - millions: [1] + noAssert: [false, true], + buffer: ['fast', 'slow'], + type: ['UInt8', 'UInt16LE', 'UInt16BE', + 'UInt32LE', 'UInt32BE', + 'Int8', 'Int16LE', 'Int16BE', + 'Int32LE', 'Int32BE', + 'FloatLE', 'FloatBE', + 'DoubleLE', 'DoubleBE'], + millions: [1] }); ``` The runner takes one item from each of the property array value to build a list diff -Nru nodejs-6.11.2~dfsg/benchmark/util/inspect-proxy.js nodejs-6.11.4~dfsg/benchmark/util/inspect-proxy.js --- nodejs-6.11.2~dfsg/benchmark/util/inspect-proxy.js 2017-08-01 05:39:05.000000000 +0000 +++ nodejs-6.11.4~dfsg/benchmark/util/inspect-proxy.js 2017-10-03 17:11:11.000000000 +0000 @@ -9,7 +9,7 @@ }); function twoDifferentProxies(n) { - // This one should be slower between we're looking up multiple proxies. + // This one should be slower because we're looking up multiple proxies. const proxyA = new Proxy({}, {get: () => {}}); const proxyB = new Proxy({}, {get: () => {}}); bench.start(); diff -Nru nodejs-6.11.2~dfsg/BUILDING.md nodejs-6.11.4~dfsg/BUILDING.md --- nodejs-6.11.2~dfsg/BUILDING.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/BUILDING.md 2017-10-03 17:11:11.000000000 +0000 @@ -94,6 +94,8 @@ * You may want to setup [firewall rules](tools/macosx-firewall.sh) to avoid popups asking to accept incoming network connections when running tests: +If the path to your build directory contains a space, the build will likely fail. + ```console $ sudo ./tools/macosx-firewall.sh ``` @@ -127,6 +129,25 @@ $ make test ``` +To run the tests and generate code coverage reports: + +```console +$ ./configure --coverage +$ make coverage +``` + +This will generate coverage reports for both JavaScript and C++ tests (if you +only want to run the JavaScript tests then you do not need to run the first +command `./configure --coverage`). + +The `make coverage` command downloads some tools to the project root directory +and overwrites the `lib/` directory. To clean up after generating the coverage +reports: + +```console +make coverage-clean +``` + To build the documentation: This will build Node.js first (if necessary) and then use it to build the docs: @@ -135,7 +156,7 @@ $ make doc ``` -If you have an existing Node.js you can build just the docs with: +If you have an existing Node.js build, you can build just the docs with: ```console $ NODE=/path/to/node make doc-only @@ -174,6 +195,8 @@ [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. +If the path to your build directory contains a space, the build will likely fail. + ```console > .\vcbuild nosign ``` diff -Nru nodejs-6.11.2~dfsg/CHANGELOG.md nodejs-6.11.4~dfsg/CHANGELOG.md --- nodejs-6.11.2~dfsg/CHANGELOG.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/CHANGELOG.md 2017-10-03 17:11:11.000000000 +0000 @@ -26,7 +26,9 @@ -6.11.2
+6.11.4
+6.11.3
+6.11.2
6.11.1
6.11.0
6.10.3
diff -Nru nodejs-6.11.2~dfsg/COLLABORATOR_GUIDE.md nodejs-6.11.4~dfsg/COLLABORATOR_GUIDE.md --- nodejs-6.11.2~dfsg/COLLABORATOR_GUIDE.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/COLLABORATOR_GUIDE.md 2017-10-03 17:11:11.000000000 +0000 @@ -8,7 +8,7 @@ - [Internal vs. Public API](#internal-vs-public-api) - [Breaking Changes](#breaking-changes) - [Deprecations](#deprecations) - - [Involving the CTC](#involving-the-ctc) + - [Involving the TSC](#involving-the-TSC) * [Landing Pull Requests](#landing-pull-requests) - [Technical HOWTO](#technical-howto) - [I Just Made a Mistake](#i-just-made-a-mistake) @@ -30,7 +30,7 @@ Collaborators should feel free to take full responsibility for managing issues and pull requests they feel qualified to handle, as long as this is done while being mindful of these guidelines, the -opinions of other Collaborators and guidance of the CTC. +opinions of other Collaborators and guidance of the TSC. Collaborators may **close** any issue or pull request they believe is not relevant for the future of the Node.js project. Where this is @@ -46,7 +46,7 @@ All modifications to the Node.js code and documentation should be performed via GitHub pull requests, including modifications by -Collaborators and CTC members. +Collaborators and TSC members. All pull requests must be reviewed and accepted by a Collaborator with sufficient expertise who is able to take full responsibility for the @@ -70,16 +70,16 @@ Collaborators, a pull request may be landed given appropriate review. Where there is discussion amongst Collaborators, consensus should be sought if possible. The lack of consensus may indicate the need to -elevate discussion to the CTC for resolution (see below). +elevate discussion to the TSC for resolution (see below). Breaking changes (that is, pull requests that require an increase in the major version number, known as `semver-major` changes) must be -elevated for review by the CTC. This does not necessarily mean that the -PR must be put onto the CTC meeting agenda. If multiple CTC members +elevated for review by the TSC. This does not necessarily mean that the +PR must be put onto the TSC meeting agenda. If multiple TSC members approve (`LGTM`) the PR and no Collaborators oppose the PR, it can be -landed. Where there is disagreement among CTC members or objections +landed. Where there is disagreement among TSC members or objections from one or more Collaborators, `semver-major` pull requests should be -put on the CTC meeting agenda. +put on the TSC meeting agenda. All bugfixes require a test case which demonstrates the defect. The test should *fail* before the change, and *pass* after the change. @@ -150,7 +150,7 @@ internal API can be demonstrated to be sufficiently relied upon by the Node.js ecosystem such that any changes would cause too much breakage. The threshold for what qualifies as "too much breakage" is to be decided on a case-by-case -basis by the CTC. +basis by the TSC. If it is determined that a currently undocumented object, property, method, argument, or event *should* be documented, then a pull request adding the @@ -171,7 +171,7 @@ must be made to determine the potential impact of the change in the ecosystem by analyzing current use and by validating such changes through ecosystem testing using the [Canary in the Goldmine](https://github.com/nodejs/citgm) -tool. If a change cannot be made without ecosystem breakage, then CTC review is +tool. If a change cannot be made without ecosystem breakage, then TSC review is required before landing the change as anything less than semver-major. If a determination is made that a particular internal API (for instance, an @@ -183,7 +183,7 @@ ### Breaking Changes Backwards-incompatible changes may land on the master branch at any time after -sufficient review by collaborators and approval of at least two CTC members. +sufficient review by collaborators and approval of at least two TSC members. Examples of breaking changes include, but are not necessarily limited to, removal or redefinition of existing API arguments, changing return values @@ -209,7 +209,7 @@ Such changes *must* be handled as semver-major changes but MAY be landed without a [Deprecation cycle](#deprecation-cycle). -From time-to-time, in particularly exceptional cases, the CTC may be asked to +From time-to-time, in particularly exceptional cases, the TSC may be asked to consider and approve additional exceptions to this rule. Purely additive changes (e.g. adding new events to EventEmitter @@ -244,7 +244,7 @@ * Resolving critical security issues. * Fixing a critical bug (e.g. fixing a memory leak) requires a breaking change. - * There is CTC consensus that the change is required. + * There is TSC consensus that the change is required. * If a breaking commit does accidentally land in a Current or LTS branch, an attempt to fix the issue will be made before the next release; If no fix is provided then the commit will be reverted. @@ -263,6 +263,32 @@ appended. Commit message rules about line length and subsystem can be ignored. A Pull Request should be raised and approved like any other change. +### Introducing New Modules + +Semver-minor commits that introduce new core modules should be treated with +extra care. + +The name of the new core module should not conflict with any existing +module in the ecosystem unless a written agreement with the owner of those +modules is reached to transfer ownership. + +If the new module name is free, a Collaborator should register a placeholder +in the module registry as soon as possible, linking to the pull request that +introduces the new core module. + +Pull requests introducing new core modules: + +* Must be left open for at least one week for review. +* Must be labeled using the `ctc-review` label. +* Must have signoff from at least two CTC members. + +New core modules must be landed with a [Stability Index][] of Experimental, +and must remain Experimental until a semver-major release. + +For new modules that involve significant effort, non-trivial additions to +Node.js or significant new capabilities, an [Enhancement Proposal][] is +recommended but not required. + ### Deprecations Deprecation refers to the identification of Public APIs that should no longer @@ -294,7 +320,7 @@ changes. Runtime Deprecations and End-of-life APIs (internal or public) *must* be -handled as semver-major changes unless there is CTC consensus to land the +handled as semver-major changes unless there is TSC consensus to land the deprecation as a semver-minor. All Documentation-Only and Runtime deprecations will be assigned a unique @@ -320,10 +346,10 @@ a Node.js release should be listed prominently in the "Notable Changes" section of the release notes. -### Involving the CTC +### Involving the TSC -Collaborators may opt to elevate pull requests or issues to the CTC for -discussion by assigning the `ctc-review` label. This should be done +Collaborators may opt to elevate pull requests or issues to the TSC for +discussion by assigning the `tsc-review` label. This should be done where a pull request: - has a significant impact on the codebase, @@ -331,7 +357,7 @@ - has failed to reach consensus amongst the Collaborators who are actively participating in the discussion. -The CTC should serve as the final arbiter where required. +The TSC should serve as the final arbiter where required. ## Landing Pull Requests @@ -512,9 +538,36 @@ add the "Landed in .." comment if you added multiple commits. +### Troubleshooting + +Sometimes, when running `git push upstream master`, you may get an error message +like this: + +```console +To https://github.com/nodejs/node + ! [rejected] master -> master (fetch first) +error: failed to push some refs to 'https://github.com/nodejs/node' +hint: Updates were rejected because the remote contains work that you do +hint: not have locally. This is usually caused by another repository pushing +hint: to the same ref. You may want to first integrate the remote changes +hint: (e.g., 'git pull ...') before pushing again. +hint: See the 'Note about fast-forwards' in 'git push --help' for details. +``` + +That means a commit has landed since your last rebase against `upstream/master`. +To fix this, fetch, rebase, run the tests again (to make sure no interactions +between your changes and the new changes cause any problems), and push again: + +```sh +git fetch upstream +git rebase upstream/master +make -j4 test +git push upstream master +``` + ### I Just Made a Mistake -* Ping a CTC member. +* Ping a TSC member. * `#node-dev` on freenode * With `git`, there's a way to override remote trees by force pushing (`git push -f`). This should generally be seen as forbidden (since @@ -543,9 +596,9 @@ fixes, security updates, possible npm updates, documentation updates, and certain performance improvements that can be demonstrated to not break existing applications. Semver-minor changes are only permitted if required for bug fixes -and then only on a case-by-case basis with LTS WG and possibly Core Technical -Committee (CTC) review. Semver-major changes are permitted only if required for -security related fixes. +and then only on a case-by-case basis with LTS WG and possibly Technical +Steering Committee (TSC) review. Semver-major changes are permitted only if +required for security related fixes. Once a Current branch moves into Maintenance mode, only **critical** bugs, **critical** security fixes, and documentation updates will be permitted. @@ -553,7 +606,7 @@ #### Landing semver-minor commits in LTS The default policy is to not land semver-minor or higher commits in any LTS -branch. However, the LTS WG or CTC can evaluate any individual semver-minor +branch. However, the LTS WG or TSC can evaluate any individual semver-minor commit and decide whether a special exception ought to be made. It is expected that such exceptions would be evaluated, in part, on the scope and impact of the changes on the code, the risk to ecosystem stability @@ -563,7 +616,7 @@ Any collaborator who feels a semver-minor commit should be landed in an LTS branch should attach the `lts-agenda` label to the pull request. The LTS WG will discuss the issue and, if necessary, will escalate the issue up to the -CTC for further discussion. +TSC for further discussion. #### How are LTS Branches Managed? @@ -615,3 +668,5 @@ LTS working group and the Release team. [backporting guide]: doc/guides/backporting-to-release-lines.md +[Stability Index]: https://github.com/nodejs/node/pull/doc/api/documentation.md#stability-index +[Enhancement Proposal]: https://github.com/nodejs/node-eps diff -Nru nodejs-6.11.2~dfsg/configure nodejs-6.11.4~dfsg/configure --- nodejs-6.11.2~dfsg/configure 2017-08-01 05:39:05.000000000 +0000 +++ nodejs-6.11.4~dfsg/configure 2017-10-03 17:11:11.000000000 +0000 @@ -1,4 +1,15 @@ -#!/usr/bin/env python +#!/bin/sh + +# Locate python2 interpreter and re-execute the script. Note that the +# mix of single and double quotes is intentional, as is the fact that +# the ] goes on a new line. +_=[ 'exec' '/bin/sh' '-c' ''' +which python2.7 >/dev/null && exec python2.7 "$0" "$@" +which python2 >/dev/null && exec python2 "$0" "$@" +exec python "$0" "$@" +''' "$0" "$@" +] +del _ import sys if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7): @@ -40,6 +51,7 @@ # imports in tools/ sys.path.insert(0, os.path.join(root_dir, 'tools')) import getmoduleversion +from gyp_node import run_gyp # parse our options parser = optparse.OptionParser() @@ -419,12 +431,12 @@ # Dummy option for backwards compatibility parser.add_option('--with-snapshot', action='store_true', - dest='with_snapshot', + dest='unused_with_snapshot', help=optparse.SUPPRESS_HELP) parser.add_option('--without-snapshot', action='store_true', - dest='unused_without_snapshot', + dest='without_snapshot', help=optparse.SUPPRESS_HELP) parser.add_option('--without-ssl', @@ -802,7 +814,7 @@ cross_compiling = (options.cross_compiling if options.cross_compiling is not None else target_arch != host_arch) - want_snapshots = 1 if options.with_snapshot else 0 + want_snapshots = not options.without_snapshot o['variables']['want_separate_host_toolset'] = int( cross_compiling and want_snapshots) @@ -946,7 +958,7 @@ o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs. o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds. o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables. - o['variables']['v8_use_snapshot'] = b(options.with_snapshot) + o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true' o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) o['variables']['force_dynamic_crt'] = 1 if options.shared else 0 @@ -967,12 +979,18 @@ o['variables']['openssl_fips'] = options.openssl_fips fips_dir = os.path.join(root_dir, 'deps', 'openssl', 'fips') fips_ld = os.path.abspath(os.path.join(fips_dir, 'fipsld')) + # LINK is for Makefiles, LD/LDXX is for ninja o['make_fips_settings'] = [ ['LINK', fips_ld + ' <(openssl_fips)/bin/fipsld'], + ['LD', fips_ld + ' <(openssl_fips)/bin/fipsld'], + ['LDXX', fips_ld + ' <(openssl_fips)/bin/fipsld'], ] else: o['variables']['openssl_fips'] = '' - + try: + os.remove('config_fips.gypi') + except OSError: + pass if options.without_ssl: def without_ssl_error(option): @@ -1370,7 +1388,7 @@ write('config.mk', do_not_edit + config) -gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel'] +gyp_args = ['--no-parallel'] if options.use_xcode: gyp_args += ['-f', 'xcode'] @@ -1389,4 +1407,4 @@ if warn.warned: warn('warnings were emitted in the configure phase') -sys.exit(subprocess.call(gyp_args)) +run_gyp(gyp_args) diff -Nru nodejs-6.11.2~dfsg/CONTRIBUTING.md nodejs-6.11.4~dfsg/CONTRIBUTING.md --- nodejs-6.11.2~dfsg/CONTRIBUTING.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/CONTRIBUTING.md 2017-10-03 17:11:11.000000000 +0000 @@ -176,7 +176,8 @@ more tests fail. If you want to run the linter without running tests, use -`make lint`/`vcbuild lint`. +`make lint`/`vcbuild lint`. It will run both JavaScript linting and +C++ linting. If you are updating tests and just want to run a single test to check it, you can use this syntax to run it exactly as the test harness would: diff -Nru nodejs-6.11.2~dfsg/debian/changelog nodejs-6.11.4~dfsg/debian/changelog --- nodejs-6.11.2~dfsg/debian/changelog 2017-08-29 23:16:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/changelog 2017-10-06 21:30:03.000000000 +0000 @@ -1,3 +1,42 @@ +nodejs (6.11.4~dfsg-1ubuntu1) artful; urgency=medium + + * Merge from Debian Sid. Remaining changes: + - Revert upstream's fix for openssl 1.0.2h, since we still have + 1.0.2g in Ubuntu. + - Add debian/patches/openssl/fix_sslv3_test.patch: properly handle how + SSLv3 was disabled in openssl. + + -- Simon Quigley Fri, 06 Oct 2017 16:30:03 -0500 + +nodejs (6.11.4~dfsg-1) unstable; urgency=medium + + * New upstream version 6.11.4~dfsg + * Testsuite field is no longer needed + * Standards-Version 4.1.1 + + -- Jérémy Lal Wed, 04 Oct 2017 13:33:00 +0200 + +nodejs (6.11.3~dfsg-1) unstable; urgency=medium + + * New upstream version 6.11.3~dfsg + + -- Jérémy Lal Wed, 06 Sep 2017 02:21:08 +0200 + +nodejs (6.11.2~dfsg-5) unstable; urgency=medium + + * Section javascript instead of web + * Mark parallel/test-debug-args as flaky on mips64el + + -- Jérémy Lal Mon, 04 Sep 2017 17:26:56 +0200 + +nodejs (6.11.2~dfsg-4) unstable; urgency=medium + + * Revert "Switch to g++-6, work around FTBFS on mips64el", + it got an Extra-Depends on a fixed gcc version. + * Explain what about node / nodejs in README.Debian + + -- Jérémy Lal Sat, 02 Sep 2017 10:10:58 +0200 + nodejs (6.11.2~dfsg-3ubuntu1) artful; urgency=low * Merge from Debian Sid. Remaining changes: @@ -44,8 +83,8 @@ * Inherit Priority from source * Drop nodejs-dbg, b-d debhelper 9.20160114 to get dbgsym * Drop kfreebsd patch, it did not build anyway - * Restore /usr/bin/node following CTTE #862051 - Let's try to drop /usr/bin/nodejs before buster. + * Restore /usr/bin/node following CTTE #862051. + Keep /usr/bin/nodejs symlink indefinitely. Replaces and Conflicts nodejs-legacy. Closes: #754462. * Skip test-zlib-failed-init.js for it relies on zlib 1.2.11 @@ -1145,6 +1184,7 @@ -- Jérémy Lal Sun, 08 Jan 2012 12:00:02 +0100 + nodejs (0.4.12-2) unstable; urgency=low * Port to libv8 3.5 branch and depend on it. @@ -1459,4 +1499,3 @@ * Initial release (Closes: #553514) -- Jérémy Lal Sun, 07 Feb 2010 01:16:07 +0100 - diff -Nru nodejs-6.11.2~dfsg/debian/control nodejs-6.11.4~dfsg/debian/control --- nodejs-6.11.2~dfsg/debian/control 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/control 2017-10-06 21:29:03.000000000 +0000 @@ -21,17 +21,15 @@ libkvm-dev [kfreebsd-any], gyp (>= 0.1~svn1773), ca-certificates, - g++-6, python, libssl1.0-dev (>= 1.0.2), libuv1-dev Build-Depends-Indep: node-yamlish, node-marked -Standards-Version: 4.0.0 +Standards-Version: 4.1.1 Homepage: http://nodejs.org/ Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/nodejs.git Vcs-Git: https://anonscm.debian.org/git/collab-maint/nodejs.git -Testsuite: autopkgtest Package: nodejs-dev Section: devel diff -Nru nodejs-6.11.2~dfsg/debian/control.in nodejs-6.11.4~dfsg/debian/control.in --- nodejs-6.11.2~dfsg/debian/control.in 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/control.in 2017-10-06 21:29:03.000000000 +0000 @@ -1,5 +1,5 @@ Source: nodejs -Section: web +Section: javascript Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Javascript Maintainers @@ -8,11 +8,10 @@ Build-Depends: @cdbs@ Build-Depends-Indep: node-yamlish, node-marked -Standards-Version: 4.0.0 +Standards-Version: 4.1.1 Homepage: http://nodejs.org/ Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/nodejs.git Vcs-Git: https://anonscm.debian.org/git/collab-maint/nodejs.git -Testsuite: autopkgtest Package: nodejs-dev Section: devel diff -Nru nodejs-6.11.2~dfsg/debian/patches/doctool-yaml.patch nodejs-6.11.4~dfsg/debian/patches/doctool-yaml.patch --- nodejs-6.11.2~dfsg/debian/patches/doctool-yaml.patch 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/doctool-yaml.patch 2017-10-04 10:48:28.000000000 +0000 @@ -24,7 +24,7 @@ if (added) { --- a/tools/doc/html.js +++ b/tools/doc/html.js -@@ -383,10 +383,7 @@ +@@ -439,10 +439,7 @@ } if (tok.type !== 'heading') return; diff -Nru nodejs-6.11.2~dfsg/debian/patches/openssl/fix_sslv3_test.patch nodejs-6.11.4~dfsg/debian/patches/openssl/fix_sslv3_test.patch --- nodejs-6.11.2~dfsg/debian/patches/openssl/fix_sslv3_test.patch 2017-08-16 22:07:44.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/openssl/fix_sslv3_test.patch 2017-10-06 21:30:03.000000000 +0000 @@ -5,12 +5,12 @@ --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js -@@ -49,6 +49,8 @@ server.on('tlsClientError', (err) => err +@@ -44,6 +44,8 @@ server.on('tlsClientError', (err) => err process.on('exit', function() { if (/unknown option -ssl3/.test(stderr)) { - common.skip('`openssl s_client -ssl3` not supported.'); + common.printSkipMessage('`openssl s_client -ssl3` not supported.'); + } else if (/null ssl method passed/.test(stderr)) { -+ common.skip('1..0 # Skipped: `openssl s_client -ssl3` is disabled.'); ++ common.printSkipMessage('1..0 # Skipped: `openssl s_client -ssl3` is disabled.'); } else { assert.strictEqual(errors.length, 1); assert(/:wrong version number/.test(errors[0].message)); diff -Nru nodejs-6.11.2~dfsg/debian/patches/openssl/s_client_1.1.patch nodejs-6.11.4~dfsg/debian/patches/openssl/s_client_1.1.patch --- nodejs-6.11.2~dfsg/debian/patches/openssl/s_client_1.1.patch 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/openssl/s_client_1.1.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -Description: pass tests with openssl 1.1 cli - Use more robust, supported ciphers -Origin: https://github.com/nodejs/node/pull/8491 -Last-Update: 2016-12-19 - ---- a/test/parallel/test-tls-set-ciphers.js -+++ b/test/parallel/test-tls-set-ciphers.js -@@ -19,7 +19,7 @@ - const options = { - key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`), -- ciphers: 'DES-CBC3-SHA' -+ ciphers: 'AES256-SHA' - }; - - const reply = 'I AM THE WALRUS'; // something recognizable ---- a/test/parallel/test-tls-ecdh-disable.js -+++ b/test/parallel/test-tls-ecdh-disable.js -@@ -20,7 +20,7 @@ - const options = { - key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`), -- ciphers: 'ECDHE-RSA-RC4-SHA', -+ ciphers: 'ECDHE-RSA-AES128-SHA', - ecdhCurve: false - }; - diff -Nru nodejs-6.11.2~dfsg/debian/patches/openssl/s_client_tls12.patch nodejs-6.11.4~dfsg/debian/patches/openssl/s_client_tls12.patch --- nodejs-6.11.2~dfsg/debian/patches/openssl/s_client_tls12.patch 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/openssl/s_client_tls12.patch 2017-10-04 10:48:16.000000000 +0000 @@ -5,9 +5,9 @@ Author: Jérémy Lal --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status -@@ -6,6 +6,8 @@ - +@@ -7,6 +7,8 @@ [true] # This section applies to all platforms + test-fs-read-buffer-tostring-fail : PASS,FLAKY +test-tls-alert: SKIP + @@ -16,7 +16,7 @@ [$system==linux] --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js -@@ -74,7 +74,6 @@ +@@ -71,7 +71,6 @@ server.listen(0, function() { const args = [ 's_client', diff -Nru nodejs-6.11.2~dfsg/debian/patches/revert_openssl1.0.2h_fix.patch nodejs-6.11.4~dfsg/debian/patches/revert_openssl1.0.2h_fix.patch --- nodejs-6.11.2~dfsg/debian/patches/revert_openssl1.0.2h_fix.patch 2017-08-16 22:02:44.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/revert_openssl1.0.2h_fix.patch 2017-10-06 21:30:03.000000000 +0000 @@ -6,7 +6,7 @@ Last-Update: 2017-04-24 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js -@@ -99,8 +99,8 @@ +@@ -96,8 +96,8 @@ function Test1() { client: {ALPN: 'b', NPN: undefined}}); // nothing is selected by ALPN checkResults(results[2], @@ -17,7 +17,7 @@ // execute next test Test2(); }); -@@ -132,8 +132,8 @@ +@@ -129,8 +129,8 @@ function Test2() { client: {ALPN: 'b', NPN: undefined}}); // nothing is selected by ALPN checkResults(results[2], @@ -28,7 +28,7 @@ // execute next test Test3(); }); -@@ -224,9 +224,8 @@ +@@ -221,9 +221,8 @@ function Test5() { checkResults(results[1], {server: {ALPN: 'b', NPN: false}, client: {ALPN: 'b', NPN: undefined}}); // nothing is selected by ALPN @@ -40,7 +40,7 @@ // execute next test Test6(); }); -@@ -254,8 +253,8 @@ +@@ -251,8 +250,8 @@ function Test6() { checkResults(results[1], {server: {ALPN: 'b', NPN: false}, client: {ALPN: 'b', NPN: undefined}}); // nothing is selected by ALPN diff -Nru nodejs-6.11.2~dfsg/debian/patches/series nodejs-6.11.4~dfsg/debian/patches/series --- nodejs-6.11.2~dfsg/debian/patches/series 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/series 2017-10-06 21:29:03.000000000 +0000 @@ -1,4 +1,3 @@ -openssl/s_client_1.1.patch openssl/s_client_tls12.patch use_system_node_gyp.patch privacy_breach.patch diff -Nru nodejs-6.11.2~dfsg/debian/patches/test_ci_buildd.patch nodejs-6.11.4~dfsg/debian/patches/test_ci_buildd.patch --- nodejs-6.11.2~dfsg/debian/patches/test_ci_buildd.patch 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/patches/test_ci_buildd.patch 2017-10-04 10:48:24.000000000 +0000 @@ -41,10 +41,10 @@ # Clean up any leftover processes, error if found. --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status -@@ -5,6 +5,21 @@ - # sample-test : PASS,FLAKY - +@@ -7,6 +7,22 @@ [true] # This section applies to all platforms + test-fs-read-buffer-tostring-fail : PASS,FLAKY + +test-process-config : PASS,FLAKY +test-regress-GH-746 : PASS,FLAKY +test-stdout-close-unref : PASS,FLAKY @@ -60,16 +60,21 @@ + +# only works with zlib >= 1.2.11 +test-zlib-failed-init: SKIP - ++ test-tls-alert: SKIP -@@ -26,4 +41,4 @@ + [$system==win32] +@@ -26,4 +42,8 @@ [$system==aix] #covered by https://github.com/nodejs/node/issues/3796 # but more frequent on AIX ? -test-debug-signal-cluster : PASS, FLAKY \ No newline at end of file +test-debug-signal-cluster : PASS, FLAKY ++ ++[$arch==mips64el] ++# the debug flag is for hacking v8 internals ++test-debug-args: PASS,FLAKY --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -5,6 +5,8 @@ @@ -153,7 +158,7 @@ +// } --- a/test/common/index.js +++ b/test/common/index.js -@@ -280,24 +280,7 @@ +@@ -274,24 +274,7 @@ }; exports.platformTimeout = function(ms) { diff -Nru nodejs-6.11.2~dfsg/debian/README.Debian nodejs-6.11.4~dfsg/debian/README.Debian --- nodejs-6.11.2~dfsg/debian/README.Debian 2017-08-18 20:54:07.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/README.Debian 2017-10-04 10:43:08.000000000 +0000 @@ -1,3 +1,15 @@ +/usr/bin/node, /usr/bin/nodejs +============================== + +"node" binary name is not available in stretch, +and is replaced by "nodejs". +"node" binary name is available in buster, and +"nodejs" is kept to avoid breaking old scripts. + +However, the preferred name is "node" since it is +the upstream binary name. + + Supported architectures ======================= diff -Nru nodejs-6.11.2~dfsg/debian/rules nodejs-6.11.4~dfsg/debian/rules --- nodejs-6.11.2~dfsg/debian/rules 2017-08-29 14:23:49.000000000 +0000 +++ nodejs-6.11.4~dfsg/debian/rules 2017-10-04 10:43:08.000000000 +0000 @@ -24,10 +24,6 @@ bdeps +=, libkvm-dev [kfreebsd-any], gyp (>= 0.1~svn1773) # Needed for tests bdeps +=, ca-certificates -# build using gcc6 to work around mips64el gcc7 bug (#871514) -export CC = gcc-6 -export CXX = g++-6 -bdeps +=, g++-6 # Needed by upstream build and binary development package deps = python, libssl1.0-dev (>= $(ssl-minver)) diff -Nru nodejs-6.11.2~dfsg/deps/cares/src/ares_parse_naptr_reply.c nodejs-6.11.4~dfsg/deps/cares/src/ares_parse_naptr_reply.c --- nodejs-6.11.2~dfsg/deps/cares/src/ares_parse_naptr_reply.c 2017-08-01 05:39:05.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/cares/src/ares_parse_naptr_reply.c 2017-10-03 17:11:11.000000000 +0000 @@ -110,18 +110,19 @@ status = ARES_EBADRESP; break; } - /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ - if (rr_len < 7) - { - status = ARES_EBADRESP; - break; - } /* Check if we are really looking at a NAPTR record */ if (rr_class == C_IN && rr_type == T_NAPTR) { /* parse the NAPTR record itself */ + /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ + if (rr_len < 7) + { + status = ARES_EBADRESP; + break; + } + /* Allocate storage for this NAPTR answer appending it to the list */ naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); if (!naptr_curr) diff -Nru nodejs-6.11.2~dfsg/deps/v8/include/v8.h nodejs-6.11.4~dfsg/deps/v8/include/v8.h --- nodejs-6.11.2~dfsg/deps/v8/include/v8.h 2017-08-01 05:39:09.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/include/v8.h 2017-10-03 17:11:16.000000000 +0000 @@ -6870,6 +6870,11 @@ void SetVerbose(bool value); /** + * Returns true if verbosity is enabled. + */ + bool IsVerbose() const; + + /** * Set whether or not this TryCatch should capture a Message object * which holds source information about where the exception * occurred. True by default. diff -Nru nodejs-6.11.2~dfsg/deps/v8/include/v8-version.h nodejs-6.11.4~dfsg/deps/v8/include/v8-version.h --- nodejs-6.11.2~dfsg/deps/v8/include/v8-version.h 2017-08-01 05:39:09.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/include/v8-version.h 2017-10-03 17:11:16.000000000 +0000 @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 5 #define V8_MINOR_VERSION 1 #define V8_BUILD_NUMBER 281 -#define V8_PATCH_LEVEL 103 +#define V8_PATCH_LEVEL 108 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/api.cc nodejs-6.11.4~dfsg/deps/v8/src/api.cc --- nodejs-6.11.2~dfsg/deps/v8/src/api.cc 2017-08-01 05:39:09.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/api.cc 2017-10-03 17:11:16.000000000 +0000 @@ -391,6 +391,9 @@ i::Isolate* internal_isolate = reinterpret_cast(isolate); + // We might rehash strings and re-sort descriptors. Clear the lookup cache. + internal_isolate->descriptor_lookup_cache()->Clear(); + // If we don't do this then we end up with a stray root pointing at the // context even after we have disposed of the context. internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); @@ -428,6 +431,9 @@ context_ser.Serialize(&raw_context); ser.SerializeWeakReferencesAndDeferred(); + metadata.set_can_rehash(ser.can_be_rehashed() && + context_ser.can_be_rehashed()); + return i::Snapshot::CreateSnapshotBlob(ser, context_ser, metadata); } @@ -2389,6 +2395,10 @@ is_verbose_ = value; } +bool v8::TryCatch::IsVerbose() const { + return is_verbose_; +} + void v8::TryCatch::SetCaptureMessage(bool value) { capture_message_ = value; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/bootstrapper.cc nodejs-6.11.4~dfsg/deps/v8/src/bootstrapper.cc --- nodejs-6.11.2~dfsg/deps/v8/src/bootstrapper.cc 2017-08-01 05:39:09.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/bootstrapper.cc 2017-10-03 17:11:16.000000000 +0000 @@ -655,6 +655,8 @@ DCHECK(false); } + JSObject::MigrateSlowToFast(function, 0, "Bootstrapping"); + return function; } @@ -1133,6 +1135,8 @@ sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); strict_function_map_writable_prototype_->SetConstructor(*function_fun); + + JSObject::MigrateSlowToFast(function_fun, 0, "Bootstrapping"); } { // --- A r r a y --- diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/debug/debug.js nodejs-6.11.4~dfsg/deps/v8/src/debug/debug.js --- nodejs-6.11.2~dfsg/deps/v8/src/debug/debug.js 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/debug/debug.js 2017-10-03 17:11:17.000000000 +0000 @@ -864,6 +864,7 @@ }; Debug.MakeMirror = MakeMirror; +Debug.MakeMirrorSerializer = MakeMirrorSerializer; function MakeExecutionState(break_id) { return new ExecutionState(break_id); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/debug/debug-scopes.cc nodejs-6.11.4~dfsg/deps/v8/src/debug/debug-scopes.cc --- nodejs-6.11.2~dfsg/deps/v8/src/debug/debug-scopes.cc 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/debug/debug-scopes.cc 2017-10-03 17:11:17.000000000 +0000 @@ -842,6 +842,12 @@ void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope, int position) { + if (scope->is_function_scope()) { + // Do not collect scopes of nested inner functions inside the current one. + Handle function = + Handle::cast(frame_inspector_->GetFunction()); + if (scope->end_position() < function->shared()->end_position()) return; + } if (!scope->is_eval_scope()) { nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate), scope->start_position(), diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/debug/mirrors.js nodejs-6.11.4~dfsg/deps/v8/src/debug/mirrors.js --- nodejs-6.11.2~dfsg/deps/v8/src/debug/mirrors.js 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/debug/mirrors.js 2017-10-03 17:11:17.000000000 +0000 @@ -60,6 +60,7 @@ // - FrameMirror // - ScriptMirror // - ScopeMirror +// - ProxyMirror // Type names of the different mirrors. var MirrorType = { @@ -84,6 +85,7 @@ SET_TYPE : 'set', ITERATOR_TYPE : 'iterator', GENERATOR_TYPE : 'generator', + PROXY_TYPE : 'proxy', } @@ -157,6 +159,8 @@ mirror = new StringMirror(value); } else if (IS_SYMBOL(value)) { mirror = new SymbolMirror(value); + } else if (IS_PROXY(value)) { + mirror = new ProxyMirror(value); } else if (IS_ARRAY(value)) { mirror = new ArrayMirror(value); } else if (IS_DATE(value)) { @@ -343,6 +347,15 @@ /** + * Check whether the mirror reflects a proxy object. + * @returns {boolean} True if the mirror reflects a proxy object. + */ +Mirror.prototype.isProxy = function() { + return this instanceof ProxyMirror; +}; + + +/** * Check whether the mirror reflects an object. * @returns {boolean} True if the mirror reflects an object */ @@ -2439,6 +2452,29 @@ }; +/** + * Mirror object for proxies. + * @param {value} value The value reflected by this mirror. + * @constructor + * @extends Mirror + */ +function ProxyMirror(value) { + %_Call(Mirror, this, MirrorType.PROXY_TYPE); + this.value_ = value; +} +inherits(ProxyMirror, Mirror); + + +ProxyMirror.prototype.value = function() { + return this.value_; +}; + + +ProxyMirror.prototype.toText = function() { + return '#'; +}; + + /** * Returns a mirror serializer * diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/flag-definitions.h nodejs-6.11.4~dfsg/deps/v8/src/flag-definitions.h --- nodejs-6.11.2~dfsg/deps/v8/src/flag-definitions.h 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/flag-definitions.h 2017-10-03 17:11:17.000000000 +0000 @@ -830,6 +830,8 @@ DEFINE_BOOL(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions " "(with snapshots this option cannot override the baked-in seed)") +DEFINE_BOOL(rehash_snapshot, true, + "rehash strings from the snapshot to override the baked-in seed") DEFINE_INT(hash_seed, 0, "Fixed seed to use to hash property keys (0 means random)" "(with snapshots this option cannot override the baked-in seed)") diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/heap/heap.cc nodejs-6.11.4~dfsg/deps/v8/src/heap/heap.cc --- nodejs-6.11.2~dfsg/deps/v8/src/heap/heap.cc 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/heap/heap.cc 2017-10-03 17:11:17.000000000 +0000 @@ -5348,14 +5348,7 @@ // Set up the seed that is used to randomize the string hash function. DCHECK(hash_seed() == 0); - if (FLAG_randomize_hashes) { - if (FLAG_hash_seed == 0) { - int rnd = isolate()->random_number_generator()->NextInt(); - set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); - } else { - set_hash_seed(Smi::FromInt(FLAG_hash_seed)); - } - } + if (FLAG_randomize_hashes) InitializeHashSeed(); for (int i = 0; i < static_cast(v8::Isolate::kUseCounterFeatureCount); i++) { @@ -5393,6 +5386,14 @@ return true; } +void Heap::InitializeHashSeed() { + if (FLAG_hash_seed == 0) { + int rnd = isolate()->random_number_generator()->NextInt(); + set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); + } else { + set_hash_seed(Smi::FromInt(FLAG_hash_seed)); + } +} bool Heap::CreateHeapObjects() { // Create initial maps. diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/heap/heap.h nodejs-6.11.4~dfsg/deps/v8/src/heap/heap.h --- nodejs-6.11.2~dfsg/deps/v8/src/heap/heap.h 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/heap/heap.h 2017-10-03 17:11:17.000000000 +0000 @@ -864,6 +864,9 @@ // without actually creating any objects. bool SetUp(); + // (Re-)Initialize hash seed from flag or RNG. + void InitializeHashSeed(); + // Bootstraps the object heap with the core set of objects required to run. // Returns whether it succeeded. bool CreateHeapObjects(); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/js/array.js nodejs-6.11.4~dfsg/deps/v8/src/js/array.js --- nodejs-6.11.2~dfsg/deps/v8/src/js/array.js 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/js/array.js 2017-10-03 17:11:18.000000000 +0000 @@ -1831,6 +1831,8 @@ keys: true, }; +%ToFastProperties(unscopables); + %AddNamedProperty(GlobalArray.prototype, unscopablesSymbol, unscopables, DONT_ENUM | READ_ONLY); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/objects.cc nodejs-6.11.4~dfsg/deps/v8/src/objects.cc --- nodejs-6.11.2~dfsg/deps/v8/src/objects.cc 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/objects.cc 2017-10-03 17:11:18.000000000 +0000 @@ -9469,6 +9469,12 @@ void Map::ConnectTransition(Handle parent, Handle child, Handle name, SimpleTransitionFlag flag) { + // Do not track transitions during bootstrap except for element transitions. + Isolate* isolate = parent->GetIsolate(); + if (isolate->bootstrapper()->IsActive() && + !name.is_identical_to(isolate->factory()->elements_transition_symbol())) { + return; + } if (!parent->GetBackPointer()->IsUndefined()) { parent->set_owns_descriptors(false); } else { @@ -17520,6 +17526,12 @@ UnseededNumberDictionaryShape, uint32_t>; +template void +HashTable >::Rehash(Handle key); + +template void +HashTable >::Rehash(Handle key); + template Handle Dictionary:: New(Isolate*, int at_least_space_for, PretenureFlag pretenure); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/regexp/jsregexp.cc nodejs-6.11.4~dfsg/deps/v8/src/regexp/jsregexp.cc --- nodejs-6.11.2~dfsg/deps/v8/src/regexp/jsregexp.cc 2017-08-01 05:39:10.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/regexp/jsregexp.cc 2017-10-03 17:11:19.000000000 +0000 @@ -1131,7 +1131,7 @@ Handle code = macro_assembler_->GetCode(pattern); heap->IncreaseTotalRegexpCodeGenerated(code->Size()); work_list_ = NULL; -#ifdef ENABLE_DISASSEMBLER +#if defined(ENABLE_DISASSEMBLER) && !defined(V8_INTERPRETED_REGEXP) if (FLAG_print_code) { CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer()); OFStream os(trace_scope.file()); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/deserializer.cc nodejs-6.11.4~dfsg/deps/v8/src/snapshot/deserializer.cc --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/deserializer.cc 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/deserializer.cc 2017-10-03 17:11:19.000000000 +0000 @@ -109,6 +109,8 @@ LOG_CODE_EVENT(isolate_, LogCodeObjects()); LOG_CODE_EVENT(isolate_, LogBytecodeHandlers()); LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); + + if (FLAG_rehash_snapshot && can_rehash_) Rehash(); } MaybeHandle Deserializer::DeserializePartial( @@ -138,6 +140,9 @@ // changed and logging should be added to notify the profiler et al of the // new code, which also has to be flushed from instruction cache. CHECK_EQ(start_address, code_space->top()); + + if (FLAG_rehash_snapshot && can_rehash_) RehashContext(Context::cast(root)); + return Handle(root, isolate); } @@ -164,6 +169,64 @@ } } +// We only really just need HashForObject here. +class StringRehashKey : public HashTableKey { + public: + uint32_t HashForObject(Object* other) override { + return String::cast(other)->Hash(); + } + + static uint32_t StringHash(Object* obj) { + UNREACHABLE(); + return String::cast(obj)->Hash(); + } + + bool IsMatch(Object* string) override { + UNREACHABLE(); + return false; + } + + uint32_t Hash() override { + UNREACHABLE(); + return 0; + } + + Handle AsHandle(Isolate* isolate) override { + UNREACHABLE(); + return isolate->factory()->empty_string(); + } +}; + +void Deserializer::Rehash() { + DCHECK(can_rehash_); + isolate_->heap()->InitializeHashSeed(); + if (FLAG_profile_deserialization) { + PrintF("Re-initializing hash seed to %x\n", + isolate_->heap()->hash_seed()->value()); + } + StringRehashKey string_rehash_key; + isolate_->heap()->string_table()->Rehash(&string_rehash_key); + isolate_->heap()->intrinsic_function_names()->Rehash( + isolate_->factory()->empty_string()); + SortMapDescriptors(); +} + +void Deserializer::RehashContext(Context* context) { + DCHECK(can_rehash_); + for (const auto& array : transition_arrays_) array->Sort(); + Handle dummy = isolate_->factory()->empty_string(); + context->global_object()->global_dictionary()->Rehash(dummy); + SortMapDescriptors(); +} + +void Deserializer::SortMapDescriptors() { + for (const auto& map : maps_) { + if (map->instance_descriptors()->number_of_descriptors() > 1) { + map->instance_descriptors()->Sort(); + } + } +} + Deserializer::~Deserializer() { // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed. // DCHECK(source_.AtEOF()); @@ -288,6 +351,18 @@ new_code_objects_.Add(Code::cast(obj)); } } + if (FLAG_rehash_snapshot && can_rehash_ && !deserializing_user_code()) { + if (obj->IsString()) { + // Uninitialize hash field as we are going to reinitialize the hash seed. + String* string = String::cast(obj); + string->set_hash_field(String::kEmptyHashField); + } else if (obj->IsTransitionArray() && + TransitionArray::cast(obj)->number_of_entries() > 1) { + transition_arrays_.Add(TransitionArray::cast(obj)); + } else if (obj->IsMap()) { + maps_.Add(Map::cast(obj)); + } + } // Check alignment. DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment())); return obj; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/deserializer.h nodejs-6.11.4~dfsg/deps/v8/src/snapshot/deserializer.h --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/deserializer.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/deserializer.h 2017-10-03 17:11:19.000000000 +0000 @@ -37,7 +37,8 @@ external_reference_table_(NULL), deserialized_large_objects_(0), deserializing_user_code_(false), - next_alignment_(kWordAligned) { + next_alignment_(kWordAligned), + can_rehash_(false) { DecodeReservation(data->Reservations()); } @@ -59,6 +60,8 @@ attached_objects_ = attached_objects; } + void SetRehashability(bool v) { can_rehash_ = v; } + private: void VisitPointers(Object** start, Object** end) override; @@ -113,6 +116,15 @@ Object** CopyInNativesSource(Vector source_vector, Object** current); + // Rehash after deserializing an isolate. + void Rehash(); + + // Rehash after deserializing a context. + void RehashContext(Context* context); + + // Sort descriptors of deserialized maps using new string hashes. + void SortMapDescriptors(); + // Cached current isolate. Isolate* isolate_; @@ -136,11 +148,16 @@ List new_code_objects_; List > new_internalized_strings_; List > new_scripts_; + List maps_; + List transition_arrays_; bool deserializing_user_code_; AllocationAlignment next_alignment_; + // TODO(6593): generalize rehashing, and remove this flag. + bool can_rehash_; + DISALLOW_COPY_AND_ASSIGN(Deserializer); }; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/partial-serializer.cc nodejs-6.11.4~dfsg/deps/v8/src/snapshot/partial-serializer.cc --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/partial-serializer.cc 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/partial-serializer.cc 2017-10-03 17:11:19.000000000 +0000 @@ -15,7 +15,9 @@ : Serializer(isolate, sink), startup_serializer_(startup_snapshot_serializer), global_object_(NULL), - next_partial_cache_index_(0) { + next_partial_cache_index_(0), + rehashable_context_(nullptr), + can_be_rehashed_(true) { InitializeCodeAddressMap(); } @@ -24,7 +26,7 @@ } void PartialSerializer::Serialize(Object** o) { - if ((*o)->IsContext()) { + if ((*o)->IsNativeContext()) { Context* context = Context::cast(*o); global_object_ = context->global_object(); back_reference_map()->AddGlobalProxy(context->global_proxy()); @@ -33,11 +35,14 @@ // and it's next context pointer may point to the code-stub context. Clear // it before serializing, it will get re-added to the context list // explicitly when it's loaded. - if (context->IsNativeContext()) { - context->set(Context::NEXT_CONTEXT_LINK, - isolate_->heap()->undefined_value()); - DCHECK(!context->global_object()->IsUndefined()); - } + context->set(Context::NEXT_CONTEXT_LINK, + isolate_->heap()->undefined_value()); + DCHECK(!context->global_object()->IsUndefined()); + DCHECK_NULL(rehashable_context_); + rehashable_context_ = context; + } else { + // We only do rehashing for native contexts. + can_be_rehashed_ = false; } VisitPointer(o); SerializeDeferredObjects(); @@ -89,6 +94,8 @@ for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); } + if (obj->IsHashTable()) CheckRehashability(obj); + // Object has not yet been serialized. Serialize it here. ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); serializer.Serialize(); @@ -119,5 +126,17 @@ startup_serializer_->isolate()->heap()->fixed_cow_array_map(); } +void PartialSerializer::CheckRehashability(HeapObject* table) { + DCHECK(table->IsHashTable()); + if (!can_be_rehashed_) return; + // We can only correctly rehash if the global dictionary is the only hash + // table that we deserialize. + if (table == rehashable_context_->global_object()->global_dictionary()) { + return; + } + if (table == rehashable_context_->template_instantiations_cache()) return; + can_be_rehashed_ = false; +} + } // namespace internal } // namespace v8 diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/partial-serializer.h nodejs-6.11.4~dfsg/deps/v8/src/snapshot/partial-serializer.h --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/partial-serializer.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/partial-serializer.h 2017-10-03 17:11:19.000000000 +0000 @@ -21,6 +21,8 @@ // Serialize the objects reachable from a single object pointer. void Serialize(Object** o); + bool can_be_rehashed() const { return can_be_rehashed_; } + private: class PartialCacheIndexMap : public AddressMapBase { public: @@ -49,10 +51,16 @@ int PartialSnapshotCacheIndex(HeapObject* o); bool ShouldBeInThePartialSnapshotCache(HeapObject* o); + void CheckRehashability(HeapObject* table); + Serializer* startup_serializer_; Object* global_object_; PartialCacheIndexMap partial_cache_index_map_; int next_partial_cache_index_; + Context* rehashable_context_; + // Indicates whether we only serialized hash tables that we can rehash. + // TODO(yangguo): generalize rehashing, and remove this flag. + bool can_be_rehashed_; DISALLOW_COPY_AND_ASSIGN(PartialSerializer); }; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/snapshot-common.cc nodejs-6.11.4~dfsg/deps/v8/src/snapshot/snapshot-common.cc --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/snapshot-common.cc 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/snapshot-common.cc 2017-10-03 17:11:19.000000000 +0000 @@ -58,6 +58,7 @@ Vector startup_data = ExtractStartupData(blob); SnapshotData snapshot_data(startup_data); Deserializer deserializer(&snapshot_data); + deserializer.SetRehashability(ExtractMetadata(blob).can_rehash()); bool success = isolate->Init(&deserializer); if (FLAG_profile_deserialization) { double ms = timer.Elapsed().InMillisecondsF(); @@ -78,6 +79,7 @@ Vector context_data = ExtractContextData(blob); SnapshotData snapshot_data(context_data); Deserializer deserializer(&snapshot_data); + deserializer.SetRehashability(ExtractMetadata(blob).can_rehash()); MaybeHandle maybe_context = deserializer.DeserializePartial(isolate, global_proxy); diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/snapshot.h nodejs-6.11.4~dfsg/deps/v8/src/snapshot/snapshot.h --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/snapshot.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/snapshot.h 2017-10-03 17:11:19.000000000 +0000 @@ -26,10 +26,16 @@ data_ = EmbedsScriptBits::update(data_, v); } + bool can_rehash() { return RehashabilityBits::decode(data_); } + void set_can_rehash(bool v) { + data_ = RehashabilityBits::update(data_, v); + } + uint32_t& RawValue() { return data_; } private: class EmbedsScriptBits : public BitField {}; + class RehashabilityBits : public BitField {}; uint32_t data_; }; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/startup-serializer.cc nodejs-6.11.4~dfsg/deps/v8/src/snapshot/startup-serializer.cc --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/startup-serializer.cc 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/startup-serializer.cc 2017-10-03 17:11:19.000000000 +0000 @@ -15,7 +15,8 @@ FunctionCodeHandling function_code_handling) : Serializer(isolate, sink), function_code_handling_(function_code_handling), - serializing_builtins_(false) { + serializing_builtins_(false), + can_be_rehashed_(true) { InitializeCodeAddressMap(); } @@ -63,6 +64,8 @@ FlushSkip(skip); + if (obj->IsHashTable()) CheckRehashability(obj); + // Object has not yet been serialized. Serialize it here. ObjectSerializer object_serializer(this, obj, sink_, how_to_code, where_to_point); @@ -163,5 +166,20 @@ serializing_immortal_immovables_roots_; } +void StartupSerializer::CheckRehashability(HeapObject* table) { + DCHECK(table->IsHashTable()); + if (!can_be_rehashed_) return; + // We can only correctly rehash if the four hash tables below are the only + // ones that we deserialize. + if (table == isolate_->heap()->code_stubs()) return; + if (table == isolate_->heap()->non_monomorphic_cache()) return; + if (table == isolate_->heap()->empty_slow_element_dictionary()) return; + if (table == isolate_->heap()->empty_properties_dictionary()) return; + if (table == isolate_->heap()->weak_object_to_code_table()) return; + if (table == isolate_->heap()->intrinsic_function_names()) return; + if (table == isolate_->heap()->string_table()) return; + can_be_rehashed_ = false; +} + } // namespace internal } // namespace v8 diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/snapshot/startup-serializer.h nodejs-6.11.4~dfsg/deps/v8/src/snapshot/startup-serializer.h --- nodejs-6.11.2~dfsg/deps/v8/src/snapshot/startup-serializer.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/snapshot/startup-serializer.h 2017-10-03 17:11:19.000000000 +0000 @@ -28,6 +28,8 @@ void SerializeStrongReferences(); void SerializeWeakReferencesAndDeferred(); + bool can_be_rehashed() const { return can_be_rehashed_; } + private: // The StartupSerializer has to serialize the root array, which is slightly // different. @@ -42,10 +44,17 @@ // roots. In the second pass, we serialize the rest. bool RootShouldBeSkipped(int root_index); + void CheckRehashability(HeapObject* hashtable); + FunctionCodeHandling function_code_handling_; bool serializing_builtins_; bool serializing_immortal_immovables_roots_; std::bitset root_has_been_serialized_; + + // Indicates whether we only serialized hash tables that we can rehash. + // TODO(yangguo): generalize rehashing, and remove this flag. + bool can_be_rehashed_; + DISALLOW_COPY_AND_ASSIGN(StartupSerializer); }; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/transitions.cc nodejs-6.11.4~dfsg/deps/v8/src/transitions.cc --- nodejs-6.11.2~dfsg/deps/v8/src/transitions.cc 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/transitions.cc 2017-10-03 17:11:19.000000000 +0000 @@ -549,5 +549,47 @@ if (transition == kNotFound) return kNotFound; return SearchDetails(transition, kind, attributes, out_insertion_index); } + +void TransitionArray::Sort() { + DisallowHeapAllocation no_gc; + // In-place insertion sort. + int length = number_of_transitions(); + for (int i = 1; i < length; i++) { + Name* key = GetKey(i); + Map* target = GetTarget(i); + PropertyKind kind = kData; + PropertyAttributes attributes = NONE; + if (!IsSpecialTransition(key)) { + PropertyDetails details = GetTargetDetails(key, target); + kind = details.kind(); + attributes = details.attributes(); + } + int j; + for (j = i - 1; j >= 0; j--) { + Name* temp_key = GetKey(j); + Map* temp_target = GetTarget(j); + PropertyKind temp_kind = kData; + PropertyAttributes temp_attributes = NONE; + if (!IsSpecialTransition(temp_key)) { + PropertyDetails details = GetTargetDetails(temp_key, temp_target); + temp_kind = details.kind(); + temp_attributes = details.attributes(); + } + int cmp = + CompareKeys(temp_key, temp_key->Hash(), temp_kind, temp_attributes, + key, key->Hash(), kind, attributes); + if (cmp > 0) { + SetKey(j + 1, temp_key); + SetTarget(j + 1, temp_target); + } else { + break; + } + } + SetKey(j + 1, key); + SetTarget(j + 1, target); + } + DCHECK(IsSortedNoDuplicates()); +} + } // namespace internal } // namespace v8 diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/transitions.h nodejs-6.11.4~dfsg/deps/v8/src/transitions.h --- nodejs-6.11.2~dfsg/deps/v8/src/transitions.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/transitions.h 2017-10-03 17:11:19.000000000 +0000 @@ -189,15 +189,17 @@ void TransitionArrayVerify(); #endif + void Sort(); + #ifdef DEBUG bool IsSortedNoDuplicates(int valid_entries = -1); static bool IsSortedNoDuplicates(Map* map); static bool IsConsistentWithBackPointers(Map* map); +#endif // Returns true for a non-property transitions like elements kind, observed // or frozen transitions. static inline bool IsSpecialTransition(Name* name); -#endif // Constant for denoting key was not found. static const int kNotFound = -1; diff -Nru nodejs-6.11.2~dfsg/deps/v8/src/transitions-inl.h nodejs-6.11.4~dfsg/deps/v8/src/transitions-inl.h --- nodejs-6.11.2~dfsg/deps/v8/src/transitions-inl.h 2017-08-01 05:39:11.000000000 +0000 +++ nodejs-6.11.4~dfsg/deps/v8/src/transitions-inl.h 2017-10-03 17:11:19.000000000 +0000 @@ -106,7 +106,6 @@ } -#ifdef DEBUG bool TransitionArray::IsSpecialTransition(Name* name) { if (!name->IsSymbol()) return false; Heap* heap = name->GetHeap(); @@ -116,7 +115,6 @@ name == heap->strict_function_transition_symbol() || name == heap->observed_symbol(); } -#endif int TransitionArray::CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1, diff -Nru nodejs-6.11.2~dfsg/doc/api/addons.html nodejs-6.11.4~dfsg/doc/api/addons.html --- nodejs-6.11.2~dfsg/doc/api/addons.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/addons.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - C/C++ Addons | Node.js v6.11.2 Documentation + C/C++ Addons | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
  • Globals
  • HTTP
  • HTTPS
  • +
  • Internationalization
  • Modules
  • Net
  • OS
  • @@ -72,13 +73,31 @@
    -

    Node.js v6.11.2 Documentation

    +

    Node.js v6.11.4 Documentation


    @@ -116,6 +135,7 @@

    C/C++ Addons#

    +

    Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the require() function, and used just as if they were an ordinary Node.js module. They are used primarily to @@ -1031,7 +1051,6 @@

    Callbacks are run in last-in first-out order.

    The following addon.cc implements AtExit:

    // addon.cc
    -#undef NDEBUG
     #include <assert.h>
     #include <stdlib.h>
     #include <node.h>
    @@ -1068,10 +1087,10 @@
     }
     
     void init(Local<Object> exports) {
    -  AtExit(sanity_check);
       AtExit(at_exit_cb2, cookie);
       AtExit(at_exit_cb2, cookie);
       AtExit(at_exit_cb1, exports->GetIsolate());
    +  AtExit(sanity_check);
     }
     
     NODE_MODULE(addon, init)
    @@ -1080,7 +1099,7 @@
     

    Test in JavaScript by running:

    // test.js
    -const addon = require('./build/Release/addon');
    +require('./build/Release/addon');
     
    diff -Nru nodejs-6.11.2~dfsg/doc/api/addons.json nodejs-6.11.4~dfsg/doc/api/addons.json --- nodejs-6.11.2~dfsg/doc/api/addons.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/addons.json 2017-10-03 17:11:38.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "C/C++ Addons", "name": "c/c++_addons", + "introduced_in": "v0.10.0", "desc": "

    Node.js Addons are dynamically-linked shared objects, written in C or C++, that\ncan be loaded into Node.js using the require() function, and used\njust as if they were an ordinary Node.js module. They are used primarily to\nprovide an interface between JavaScript running in Node.js and C/C++ libraries.

    \n

    At the moment, the method for implementing Addons is rather complicated,\ninvolving knowledge of several components and APIs :

    \n
      \n
    • V8: the C++ library Node.js currently uses to provide the\nJavaScript implementation. V8 provides the mechanisms for creating objects,\ncalling functions, etc. V8's API is documented mostly in the\nv8.h header file (deps/v8/include/v8.h in the Node.js source\ntree), which is also available online.

      \n
    • \n
    • libuv: The C library that implements the Node.js event loop, its worker\nthreads and all of the asynchronous behaviors of the platform. It also\nserves as a cross-platform abstraction library, giving easy, POSIX-like\naccess across all major operating systems to many common system tasks, such\nas interacting with the filesystem, sockets, timers and system events. libuv\nalso provides a pthreads-like threading abstraction that may be used to\npower more sophisticated asynchronous Addons that need to move beyond the\nstandard event loop. Addon authors are encouraged to think about how to\navoid blocking the event loop with I/O or other time-intensive tasks by\noff-loading work via libuv to non-blocking system operations, worker threads\nor a custom use of libuv's threads.

      \n
    • \n
    • Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs\nthat Addons can use — the most important of which is the\nnode::ObjectWrap class.

      \n
    • \n
    • Node.js includes a number of other statically linked libraries including\nOpenSSL. These other libraries are located in the deps/ directory in the\nNode.js source tree. Only the V8 and OpenSSL symbols are purposefully\nre-exported by Node.js and may be used to various extents by Addons.\nSee Linking to Node.js' own dependencies for additional information.

      \n
    • \n
    \n

    All of the following examples are available for download and may\nbe used as a starting-point for your own Addon.

    \n", "modules": [ { @@ -98,7 +99,7 @@ { "textRaw": "void AtExit(callback, args)", "name": "void_atexit(callback,_args)", - "desc": "
      \n
    • callback: void (*)(void*) - A pointer to the function to call at exit.
    • \n
    • args: void* - A pointer to pass to the callback at exit.
    • \n
    \n

    Registers exit hooks that run after the event loop has ended but before the VM\nis killed.

    \n

    AtExit takes two parameters: a pointer to a callback function to run at exit,\nand a pointer to untyped context data to be passed to that callback.

    \n

    Callbacks are run in last-in first-out order.

    \n

    The following addon.cc implements AtExit:

    \n
    // addon.cc\n#undef NDEBUG\n#include <assert.h>\n#include <stdlib.h>\n#include <node.h>\n\nnamespace demo {\n\nusing node::AtExit;\nusing v8::HandleScope;\nusing v8::Isolate;\nusing v8::Local;\nusing v8::Object;\n\nstatic char cookie[] = "yum yum";\nstatic int at_exit_cb1_called = 0;\nstatic int at_exit_cb2_called = 0;\n\nstatic void at_exit_cb1(void* arg) {\n  Isolate* isolate = static_cast<Isolate*>(arg);\n  HandleScope scope(isolate);\n  Local<Object> obj = Object::New(isolate);\n  assert(!obj.IsEmpty()); // assert VM is still alive\n  assert(obj->IsObject());\n  at_exit_cb1_called++;\n}\n\nstatic void at_exit_cb2(void* arg) {\n  assert(arg == static_cast<void*>(cookie));\n  at_exit_cb2_called++;\n}\n\nstatic void sanity_check(void*) {\n  assert(at_exit_cb1_called == 1);\n  assert(at_exit_cb2_called == 2);\n}\n\nvoid init(Local<Object> exports) {\n  AtExit(sanity_check);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb1, exports->GetIsolate());\n}\n\nNODE_MODULE(addon, init)\n\n}  // namespace demo\n
    \n

    Test in JavaScript by running:

    \n
    // test.js\nconst addon = require('./build/Release/addon');\n
    \n", + "desc": "
      \n
    • callback: void (*)(void*) - A pointer to the function to call at exit.
    • \n
    • args: void* - A pointer to pass to the callback at exit.
    • \n
    \n

    Registers exit hooks that run after the event loop has ended but before the VM\nis killed.

    \n

    AtExit takes two parameters: a pointer to a callback function to run at exit,\nand a pointer to untyped context data to be passed to that callback.

    \n

    Callbacks are run in last-in first-out order.

    \n

    The following addon.cc implements AtExit:

    \n
    // addon.cc\n#include <assert.h>\n#include <stdlib.h>\n#include <node.h>\n\nnamespace demo {\n\nusing node::AtExit;\nusing v8::HandleScope;\nusing v8::Isolate;\nusing v8::Local;\nusing v8::Object;\n\nstatic char cookie[] = "yum yum";\nstatic int at_exit_cb1_called = 0;\nstatic int at_exit_cb2_called = 0;\n\nstatic void at_exit_cb1(void* arg) {\n  Isolate* isolate = static_cast<Isolate*>(arg);\n  HandleScope scope(isolate);\n  Local<Object> obj = Object::New(isolate);\n  assert(!obj.IsEmpty()); // assert VM is still alive\n  assert(obj->IsObject());\n  at_exit_cb1_called++;\n}\n\nstatic void at_exit_cb2(void* arg) {\n  assert(arg == static_cast<void*>(cookie));\n  at_exit_cb2_called++;\n}\n\nstatic void sanity_check(void*) {\n  assert(at_exit_cb1_called == 1);\n  assert(at_exit_cb2_called == 2);\n}\n\nvoid init(Local<Object> exports) {\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb1, exports->GetIsolate());\n  AtExit(sanity_check);\n}\n\nNODE_MODULE(addon, init)\n\n}  // namespace demo\n
    \n

    Test in JavaScript by running:

    \n
    // test.js\nrequire('./build/Release/addon');\n
    \n", "type": "module", "displayName": "void AtExit(callback, args)" } diff -Nru nodejs-6.11.2~dfsg/doc/api/addons.md nodejs-6.11.4~dfsg/doc/api/addons.md --- nodejs-6.11.2~dfsg/doc/api/addons.md 2017-08-01 05:39:13.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/addons.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # C/C++ Addons + + Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the [`require()`][require] function, and used just as if they were an ordinary Node.js module. They are used primarily to @@ -1053,7 +1055,6 @@ ```cpp // addon.cc -#undef NDEBUG #include #include #include @@ -1090,10 +1091,10 @@ } void init(Local exports) { - AtExit(sanity_check); AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); } NODE_MODULE(addon, init) @@ -1105,7 +1106,7 @@ ```js // test.js -const addon = require('./build/Release/addon'); +require('./build/Release/addon'); ``` [bindings]: https://github.com/TooTallNate/node-bindings diff -Nru nodejs-6.11.2~dfsg/doc/api/all.html nodejs-6.11.4~dfsg/doc/api/all.html --- nodejs-6.11.2~dfsg/doc/api/all.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/all.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - About this Documentation | Node.js v6.11.2 Documentation + About this Documentation | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
  • Globals
  • HTTP
  • HTTPS
  • +
  • Internationalization
  • Modules
  • Net
  • OS
  • @@ -72,13 +73,31 @@
    -

    Node.js v6.11.2 Documentation

    +

    Node.js v6.11.4 Documentation


    @@ -126,7 +145,7 @@
  • assert.deepStrictEqual(actual, expected[, message])
  • assert.doesNotThrow(block[, error][, message])
  • assert.equal(actual, expected[, message])
  • -
  • assert.fail(actual, expected, message, operator)
  • +
  • assert.fail(actual, expected[, message[, operator[, stackStartFunction]]])
  • assert.ifError(value)
  • assert.notDeepEqual(actual, expected[, message])
  • assert.notDeepStrictEqual(actual, expected[, message])
  • @@ -256,19 +275,20 @@
  • Event: 'error'
  • Event: 'exit'
  • Event: 'message'
  • -
  • child.connected
  • -
  • child.disconnect()
  • -
  • child.kill([signal])
  • -
  • child.pid
  • -
  • child.send(message[, sendHandle[, options]][, callback])
  • maxBuffer and Unicode
  • @@ -899,6 +919,20 @@
  • https.request(options[, callback])
  • +
  • Internationalization Support +
  • Modules
  • @@ -1552,19 +1587,20 @@

    About this Documentation#

    +

    The goal of this documentation is to comprehensively explain the Node.js -API, both from a reference as well as a conceptual point of view. Each +API, both from a reference as well as a conceptual point of view. Each section describes a built-in module or high-level concept.

    Where appropriate, property types, method arguments, and the arguments provided to event handlers are detailed in a list underneath the topic heading.

    Every .html document has a corresponding .json document presenting -the same information in a structured manner. This feature is +the same information in a structured manner. This feature is experimental, and added for the benefit of IDEs and other utilities that wish to do programmatic things with the documentation.

    Every .html and .json file is generated based on the corresponding -.md file in the doc/api/ folder in Node.js's source tree. The +.md file in the doc/api/ folder in Node.js's source tree. The documentation is generated using the tools/doc/generate.js program. The HTML template is located at doc/template.html.

    If you find an error in this documentation, please submit an issue @@ -1578,16 +1614,25 @@ all. Others are brand new and experimental, or known to be hazardous and in the process of being redesigned.

    The stability indices are as follows:

    -
    Stability: 0 - Deprecated This feature is known to be problematic, and changes are planned.  Do not rely on it.  Use of the feature may cause warnings.  Backwards compatibility should not be expected.
    Stability: 1 - Experimental This feature is subject to change, and is gated by a command line flag. It may change or be removed in future versions.
    Stability: 2 - Stable The API has proven satisfactory. Compatibility with the npm ecosystem is a high priority, and will not be broken unless absolutely necessary.

    JSON Output#

    -
    Stability: 1 - Experimental

    Every HTML file in the markdown has a corresponding JSON file with the +

    Stability: 0 - Deprecated This feature is known to be problematic, and changes may be planned. Do not rely on it. Use of the feature may cause warnings to be emitted. Backwards compatibility across major versions should not be expected.
    Stability: 1 - Experimental This feature is still under active development and subject to non-backwards compatible changes, or even removal, in any future version. Use of the feature is not recommended in production environments. Experimental features are not subject to the Node.js Semantic Versioning model.

    Note: Caution must be used when making use of Experimental features, +particularly within modules that may be used as dependencies (or dependencies +of dependencies) within a Node.js application. End users may not be aware that +experimental features are being used, and therefore may experience unexpected +failures or behavioral changes when changes occur. To help avoid such surprises, +Experimental features may require a command-line flag to explicitly enable +them, or may cause a process warning to be emitted. By default, such warnings +are printed to stderr and may be handled by attaching a listener to the +process.on('warning') event.

    +
    Stability: 2 - Stable The API has proven satisfactory. Compatibility with the npm ecosystem is a high priority, and will not be broken unless absolutely necessary.

    JSON Output#

    +
    Stability: 1 - Experimental

    Every HTML file in the markdown has a corresponding JSON file with the same data.

    -

    This feature was added in Node.js v0.6.12. It is experimental.

    +

    This feature was added in Node.js v0.6.12. It is experimental.

    Syscalls and man pages#

    System calls like open(2) and read(2) define the interface between user programs and the underlying operating system. Node functions which simply wrap a syscall, like fs.open(), will document that. The docs link to the corresponding man pages (short for manual pages) which describe how the syscalls work.

    -

    Caveat: some syscalls, like lchown(2), are BSD-specific. That means, for +

    Note: some syscalls, like lchown(2), are BSD-specific. That means, for example, that fs.lchown() only works on macOS and other BSD-derived systems, and is not available on Linux.

    Most Unix syscalls have Windows equivalents, but behavior may differ on Windows @@ -1597,6 +1642,7 @@

    Usage#

    +

    node [options] [v8 options] [script.js | -e "script"] [arguments]

    Please see the Command Line Options document for information about @@ -1628,6 +1674,7 @@

    C/C++ Addons#

    +

    Node.js Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the require() function, and used just as if they were an ordinary Node.js module. They are used primarily to @@ -2543,7 +2590,6 @@

    Callbacks are run in last-in first-out order.

    The following addon.cc implements AtExit:

    // addon.cc
    -#undef NDEBUG
     #include <assert.h>
     #include <stdlib.h>
     #include <node.h>
    @@ -2580,10 +2626,10 @@
     }
     
     void init(Local<Object> exports) {
    -  AtExit(sanity_check);
       AtExit(at_exit_cb2, cookie);
       AtExit(at_exit_cb2, cookie);
       AtExit(at_exit_cb1, exports->GetIsolate());
    +  AtExit(sanity_check);
     }
     
     NODE_MODULE(addon, init)
    @@ -2592,12 +2638,13 @@
     

    Test in JavaScript by running:

    // test.js
    -const addon = require('./build/Release/addon');
    +require('./build/Release/addon');
     

    Assert#

    -
    Stability: 2 - Stable

    The assert module provides a simple set of assertion tests that can be used to + +

    Stability: 2 - Stable

    The assert module provides a simple set of assertion tests that can be used to test invariants.

    assert(value[, message])#

    Stability: 0 - Deprecated: Use Buffer.from(buffer) instead.
    • buffer <Buffer> An existing Buffer to copy data from

    Copies the passed buffer data onto a new Buffer instance.

    @@ -3294,7 +3358,7 @@

    new Buffer(arrayBuffer[, byteOffset [, length]])#

    Stability: 0 - Deprecated: Use Buffer.from(arrayBuffer[, byteOffset [, length]]) instead.
      +
    Stability: 0 - Deprecated: Use Buffer.alloc() instead (also see Buffer.allocUnsafe()).
    • size <integer> The desired length of the new Buffer

    Allocates a new Buffer of size bytes. The size must be less than or equal @@ -3352,7 +3416,7 @@

    new Buffer(string[, encoding])#

    Stability: 0 - Deprecated: Use Buffer.from(string[, encoding]) instead.
      +
      • string <string> String to encode
      • encoding <string> The encoding of string. Default: 'utf8'
      @@ -3675,7 +3739,7 @@ // Prints: this is a tést console.log(buf2.toString());
      -

      A TypeError will be thrown if str is not a string.

      +

      A TypeError will be thrown if string is not a string.

      Class Method: Buffer.isBuffer(obj)#

      Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.

      Returns an un-pooled Buffer.

      In order to avoid the garbage collection overhead of creating many individually allocated Buffer instances, by default allocations under 4KB are sliced from a single larger allocated object. This approach improves both performance and memory @@ -5017,7 +5081,7 @@

      new SlowBuffer(size)#

      Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.
        +
        Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.
        • size <integer> The desired length of the new SlowBuffer

        Allocates a new SlowBuffer of size bytes. The size must be less than @@ -5042,7 +5106,8 @@

        Child Process#

        -
        Stability: 2 - Stable

        The child_process module provides the ability to spawn child processes in + +

        Stability: 2 - Stable

        The child_process module provides the ability to spawn child processes in a manner that is similar, but not identical, to popen(3). This capability is primarily provided by the child_process.spawn() function:

        const spawn = require('child_process').spawn;
        @@ -5295,7 +5360,7 @@
         Like child_process.spawn(), a ChildProcess object is returned. The returned
         ChildProcess will have an additional communication channel built-in that
         allows messages to be passed back and forth between the parent and child. See
        -child.send() for details.

        +subprocess.send() for details.

        It is important to keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel that is established between the two. Each process has its own memory, with @@ -5404,12 +5469,12 @@ } });

        -

        Example of checking for failed exec:

        +

        Example of checking for failed spawn:

        const spawn = require('child_process').spawn;
        -const child = spawn('bad_command');
        +const subprocess = spawn('bad_command');
         
        -child.on('error', (err) => {
        -  console.log('Failed to start child process.');
        +subprocess.on('error', (err) => {
        +  console.log('Failed to start subprocess.');
         });
         

        Note: Certain platforms (macOS, Linux) will use the value of argv[0] for the @@ -5430,10 +5495,10 @@ child processes may continue running after the parent exits regardless of whether they are detached or not. See setsid(2) for more information.

        By default, the parent will wait for the detached child to exit. To prevent -the parent from waiting for a given child, use the child.unref() method. -Doing so will cause the parent's event loop to not include the child in its -reference count, allowing the parent to exit independently of the child, unless -there is an established IPC channel between the child and parent.

        +the parent from waiting for a given subprocess, use the subprocess.unref() +method. Doing so will cause the parent's event loop to not include the child in +its reference count, allowing the parent to exit independently of the child, +unless there is an established IPC channel between the child and parent.

        When using the detached option to start a long-running process, the process will not stay running in the background after the parent exits unless it is provided with a stdio configuration that is not connected to the parent. @@ -5443,12 +5508,12 @@ stdio file descriptors, in order to ignore the parent's termination:

        const spawn = require('child_process').spawn;
         
        -const child = spawn(process.argv[0], ['child_program.js'], {
        +const subprocess = spawn(process.argv[0], ['child_program.js'], {
           detached: true,
           stdio: 'ignore'
         });
         
        -child.unref();
        +subprocess.unref();
         

        Alternatively one can redirect the child process' output into files:

        const fs = require('fs');
        @@ -5456,21 +5521,22 @@
         const out = fs.openSync('./out.log', 'a');
         const err = fs.openSync('./out.log', 'a');
         
        -const child = spawn('prg', [], {
        +const subprocess = spawn('prg', [], {
           detached: true,
           stdio: [ 'ignore', out, err ]
         });
         
        -child.unref();
        +subprocess.unref();
         

        options.stdio#

        The options.stdio option is used to configure the pipes that are established between the parent and child process. By default, the child's stdin, stdout, -and stderr are redirected to corresponding child.stdin, child.stdout, and -child.stderr streams on the ChildProcess object. This is equivalent to -setting the options.stdio equal to ['pipe', 'pipe', 'pipe'].

        +and stderr are redirected to corresponding subprocess.stdin, +subprocess.stdout, and subprocess.stderr streams on the +ChildProcess object. This is equivalent to setting the options.stdio +equal to ['pipe', 'pipe', 'pipe'].

        For convenience, options.stdio may be one of the following strings:

        • 'pipe' - equivalent to ['pipe', 'pipe', 'pipe'] (the default)
        • @@ -5485,17 +5551,18 @@
          1. 'pipe' - Create a pipe between the child process and the parent process. The parent end of the pipe is exposed to the parent as a property on the -child_process object as child.stdio[fd]. Pipes created for -fds 0 - 2 are also available as child.stdin, child.stdout -and child.stderr, respectively.
          2. +child_process object as subprocess.stdio[fd]. Pipes created +for fds 0 - 2 are also available as subprocess.stdin, +subprocess.stdout and subprocess.stderr, respectively.
          3. 'ipc' - Create an IPC channel for passing messages/file descriptors between parent and child. A ChildProcess may have at most one IPC stdio -file descriptor. Setting this option enables the child.send() method. -If the child writes JSON messages to this file descriptor, the -child.on('message') event handler will be triggered in the parent. -If the child is a Node.js process, the presence of an IPC channel will enable -process.send(), process.disconnect(), process.on('disconnect'), and -process.on('message') within the child.
          4. +file descriptor. Setting this option enables the subprocess.send() +method. If the child writes JSON messages to this file descriptor, the +subprocess.on('message') event handler will be triggered in +the parent. If the child is a Node.js process, the presence of an IPC channel +will enable process.send(), process.disconnect(), +process.on('disconnect'), and process.on('message') within the +child.
          5. 'ignore' - Instructs Node.js to ignore the fd in the child. While Node.js will always open fds 0 - 2 for the processes it spawns, setting the fd to 'ignore' will cause Node.js to open /dev/null and attach it to the @@ -5581,8 +5648,8 @@ the SIGTERM signal and does not exit, the parent process will still wait until the child process has exited.

            If the process times out, or has a non-zero exit code, this method will -throw. The Error object will contain the entire result from -child_process.spawnSync()

            +throw an Error that will include the full result of the underlying +child_process.spawnSync().

            child_process.execSync(command[, options])#

            Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with ./configure -\-\-openssl\-fips.

            +--openssl-fips.

            If the --openssl-config command line option is used, the environment variable is ignored.

            SSL_CERT_DIR=dir#

            @@ -6943,7 +7033,8 @@

            Console#

            -
            Stability: 2 - Stable

            The console module provides a simple debugging console that is similar to the + +

            Stability: 2 - Stable

            The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

            The module exports two specific components:

              @@ -7121,9 +7212,7 @@ console.log('count:', count); // Prints: count: 5, to stdout -

              If formatting elements (e.g. %d) are not found in the first string then -util.inspect() is called on each argument and the resulting string -values are concatenated. See util.format() for more information.

              +

              See util.format() for more information.

              console.time(label)#

              Stability: 0 - Deprecated: Use tls.createSecureContext() instead.

              The crypto.createCredentials() method is a deprecated function for creating @@ -8323,7 +8415,8 @@ console.log( `${buf.length} bytes of random data: ${buf.toString('hex')}`); -

              The crypto.randomBytes() method will block until there is sufficient entropy. +

              The crypto.randomBytes() method will not complete until there is +sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.

              @@ -8697,7 +8790,8 @@

              Debugger#

              -
              Stability: 2 - Stable
              + +
              Stability: 2 - Stable

              Node.js includes an out-of-process debugging utility accessible via a TCP-based protocol and built-in debugging client. To use it, start Node.js with the debug argument followed by the path to the script to debug; a prompt @@ -8876,7 +8970,8 @@

              UDP / Datagram Sockets#

              -
              Stability: 2 - Stable
              + +
              Stability: 2 - Stable

              The dgram module provides an implementation of UDP Datagram sockets.

              const dgram = require('dgram');
               const server = dgram.createSocket('udp4');
              @@ -9263,7 +9358,8 @@
               
               
               

              DNS#

              -
              Stability: 2 - Stable

              The dns module contains functions belonging to two different categories:

              + +
              Stability: 2 - Stable

              The dns module contains functions belonging to two different categories:

              1) Functions that use the underlying operating system facilities to perform name resolution, and that do not necessarily perform any network communication. This category contains only one function: dns.lookup(). Developers @@ -9705,7 +9801,8 @@

              Domain#

              -
              Stability: 0 - Deprecated

              This module is pending deprecation. Once a replacement API has been + +

              Stability: 0 - Deprecated

              This module is pending deprecation. Once a replacement API has been finalized, this module will be fully deprecated. Most end users should not have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being @@ -10074,12 +10171,13 @@

              If the domain on which exit is called has been disposed, exit will return without exiting the domain.

              domain.dispose()#

              -
              Stability: 0 - Deprecated.  Please recover from failed IO actions explicitly via error event handlers set on the domain.

              Once dispose has been called, the domain will no longer be used by callbacks +

              Stability: 0 - Deprecated. Please recover from failed IO actions explicitly via error event handlers set on the domain.

              Once dispose has been called, the domain will no longer be used by callbacks bound into the domain via run, bind, or intercept, and a 'dispose' event is emitted.

              Errors#

              +

              Applications running in Node.js will generally experience four categories of errors:

              @@ -10346,20 +10444,20 @@ } makeFaster(); // will throw: - // /home/gbusey/file.js:6 - // throw new Error('oh no!'); - // ^ - // Error: oh no! - // at speedy (/home/gbusey/file.js:6:11) - // at makeFaster (/home/gbusey/file.js:5:3) - // at Object.<anonymous> (/home/gbusey/file.js:10:1) - // at Module._compile (module.js:456:26) - // at Object.Module._extensions..js (module.js:474:10) - // at Module.load (module.js:356:32) - // at Function.Module._load (module.js:312:12) - // at Function.Module.runMain (module.js:497:10) - // at startup (node.js:119:16) - // at node.js:906:3 +// /home/gbusey/file.js:6 +// throw new Error('oh no!'); +// ^ +// Error: oh no! +// at speedy (/home/gbusey/file.js:6:11) +// at makeFaster (/home/gbusey/file.js:5:3) +// at Object.<anonymous> (/home/gbusey/file.js:10:1) +// at Module._compile (module.js:456:26) +// at Object.Module._extensions..js (module.js:474:10) +// at Module.load (module.js:356:32) +// at Function.Module._load (module.js:312:12) +// at Function.Module.runMain (module.js:497:10) +// at startup (node.js:119:16) +// at node.js:906:3

              The location information will be one of:

                @@ -10382,7 +10480,7 @@ range, or outside the set of options for a given function parameter.

                For example:

                require('net').connect(-1);
                -  // throws "RangeError: "port" option should be >= 0 and < 65536: -1"
                +// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
                 

                Node.js will generate and throw RangeError instances immediately as a form of argument validation.

                @@ -10393,7 +10491,7 @@

                While client code may generate and propagate these errors, in practice, only V8 will do so.

                doesNotExist;
                -  // throws ReferenceError, doesNotExist is not a variable in this program.
                +// throws ReferenceError, doesNotExist is not a variable in this program.
                 

                Unless an application is dynamically generating and running code, ReferenceError instances should always be considered a bug in the code @@ -10417,7 +10515,7 @@ allowable type. For example, passing a function to a parameter which expects a string would be considered a TypeError.

                require('url').parse(() => { });
                -  // throws TypeError, since it expected a string
                +// throws TypeError, since it expected a string
                 

                Node.js will generate and throw TypeError instances immediately as a form of argument validation.

                @@ -10543,7 +10641,8 @@

                Events#

                -
                Stability: 2 - Stable
                + +
                Stability: 2 - Stable

                Much of the Node.js core API is built around an idiomatic asynchronous event-driven architecture in which certain kinds of objects (called "emitters") periodically emit named events that cause Function objects ("listeners") to be @@ -10723,7 +10822,7 @@

                Stability: 0 - Deprecated: Use emitter.listenerCount() instead.

                A class method that returns the number of listeners for the given eventName +

                Stability: 0 - Deprecated: Use emitter.listenerCount() instead.

                A class method that returns the number of listeners for the given eventName registered on the given emitter.

                const myEmitter = new MyEmitter();
                 myEmitter.on('event', () => {});
                @@ -10971,7 +11070,8 @@
                 
                 
                 

                File System#

                -
                Stability: 2 - Stable
                + +
                Stability: 2 - Stable

                File I/O is provided by simple wrappers around standard POSIX functions. To use this module do require('fs'). All the methods have asynchronous and synchronous forms.

                @@ -11072,7 +11172,7 @@ fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => { if (filename) console.log(filename); - // Prints: <Buffer ...> + // Prints: <Buffer ...> });

                Event: 'error'#

                @@ -11510,7 +11610,7 @@
                Stability: 0 - Deprecated: Use fs.stat() or fs.access() instead.

                Change the file timestamps of a file referenced by the supplied file descriptor.

                +

                Note: This function does not work on AIX versions before 7.1, it will return +the error UV_ENOSYS.

                fs.futimesSync(fd, atime, mtime)#

              Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

              +

              Note: Using fs.rmdir() on a file (not a directory) results in an ENOENT +error on Windows and an ENOTDIR error on POSIX.

              fs.rmdirSync(path)#

            Synchronous rmdir(2). Returns undefined.

            +

            Note: Using fs.rmdirSync() on a file (not a directory) results in an ENOENT +error on Windows and an ENOTDIR error on POSIX.

            fs.stat(path, callback)#

            Stability: 0 - Deprecated

            Instruct require on how to handle certain file extensions.

            @@ -12996,7 +13111,8 @@

            HTTP#

            -
            Stability: 2 - Stable

            To use the HTTP server and client one must require('http').

            + +
            Stability: 2 - Stable

            To use the HTTP server and client one must require('http').

            The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is @@ -13383,7 +13499,7 @@ unsent, it will flush them to the stream. If the request is chunked, this will send the terminating '0\r\n\r\n'.

            If data is specified, it is equivalent to calling -response.write(data, encoding) followed by request.end(callback).

            +request.write(data, encoding) followed by request.end(callback).

            If callback is specified, it will be called when the request stream is finished.

            request.flushHeaders()#

            @@ -14120,7 +14236,7 @@
            Stability: 0 - Deprecated: Use http.request() instead.

            Constructs a new HTTP client. port and host refer to the server to be +

            Stability: 0 - Deprecated: Use http.request() instead.

            Constructs a new HTTP client. port and host refer to the server to be connected to.

            http.createServer([requestListener])#

        Returns an object containing commonly used operating system specific constants for error codes, process signals, and so on. The specific constants currently -defined are described in OS Constants.

        +defined are described in OS Constants.

        os.cpus()#

      The process.umask() method sets or returns the Node.js process's file mode -creation mask. Child processes inherit the mask from the parent process. The old -mask is return if the mask argument is given, otherwise returns the current -mask.

      +creation mask. Child processes inherit the mask from the parent process. Invoked +without an argument, the current mask is returned, otherwise the umask is set to +the argument value and the previous mask is returned.

      const newmask = 0o022;
       const oldmask = process.umask(newmask);
       console.log(
      @@ -18574,7 +18898,8 @@
       
       
       

      Punycode#

      -
      Stability: 0 - Deprecated

      The version of the punycode module bundled in Node.js is being deprecated. + +

      Stability: 0 - Deprecated

      The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js this module will be removed. Users currently depending on the punycode module should switch to using the userland-provided Punycode.js module instead.

      @@ -18678,7 +19003,8 @@

      Query String#

      -
      Stability: 2 - Stable
      + +
      Stability: 2 - Stable

      The querystring module provides utilities for parsing and formatting URL query strings. It can be accessed using:

      const querystring = require('querystring');
      @@ -18734,7 +19060,7 @@
       
      // Assuming gbkDecodeURIComponent function already exists...
       
       querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
      -  { decodeURIComponent: gbkDecodeURIComponent });
      +                  { decodeURIComponent: gbkDecodeURIComponent });
       

      querystring.stringify(obj[, sep[, eq[, options]]])#

      Stability: 0 - Deprecated: Use console.error() instead.
      • ...strings <string> The message to print to stderr

      Deprecated predecessor of console.error.

      @@ -23057,7 +23418,7 @@
      Stability: 0 - Deprecated
        +
        Stability: 0 - Deprecated
        • object <any>

        Internal alias for Array.isArray.

        @@ -23075,7 +23436,7 @@
        Stability: 0 - Deprecated
          +
          Stability: 0 - Deprecated
          • object <any>

          Returns true if the given object is a Boolean. Otherwise, returns false.

          @@ -23092,7 +23453,7 @@
          Stability: 0 - Deprecated: Use Buffer.isBuffer() instead.
            +
            Stability: 0 - Deprecated: Use Buffer.isBuffer() instead.
            • object <any>

            Returns true if the given object is a Buffer. Otherwise, returns false.

            @@ -23109,7 +23470,7 @@
            Stability: 0 - Deprecated
              +
              Stability: 0 - Deprecated
              • object <any>

              Returns true if the given object is a Date. Otherwise, returns false.

              @@ -23126,7 +23487,7 @@
              Stability: 0 - Deprecated
                +
                Stability: 0 - Deprecated
                • object <any>

                Returns true if the given object is an Error. Otherwise, returns @@ -23156,7 +23517,7 @@

                Stability: 0 - Deprecated
                  +
                  Stability: 0 - Deprecated
                  • object <any>

                  Returns true if the given object is a Function. Otherwise, returns @@ -23177,7 +23538,7 @@

                  Stability: 0 - Deprecated
                    +
                    Stability: 0 - Deprecated
                    • object <any>

                    Returns true if the given object is strictly null. Otherwise, returns @@ -23195,7 +23556,7 @@

                    Stability: 0 - Deprecated
                      +
                      Stability: 0 - Deprecated
                      • object <any>

                      Returns true if the given object is null or undefined. Otherwise, @@ -23213,7 +23574,7 @@

                      Stability: 0 - Deprecated
                        +
                        Stability: 0 - Deprecated
                        • object <any>

                        Returns true if the given object is a Number. Otherwise, returns false.

                        @@ -23232,7 +23593,7 @@
                        Stability: 0 - Deprecated
                          +
                          Stability: 0 - Deprecated
                          • object <any>

                          Returns true if the given object is strictly an Object and not a @@ -23252,7 +23613,7 @@

                          Stability: 0 - Deprecated
                            +
                            Stability: 0 - Deprecated
                            • object <any>

                            Returns true if the given object is a primitive type. Otherwise, returns @@ -23282,7 +23643,7 @@

                            Stability: 0 - Deprecated
                              +
                              Stability: 0 - Deprecated
                              • object <any>

                              Returns true if the given object is a RegExp. Otherwise, returns false.

                              @@ -23299,7 +23660,7 @@
                              Stability: 0 - Deprecated
                                +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is a string. Otherwise, returns false.

                                @@ -23318,7 +23679,7 @@
                                Stability: 0 - Deprecated
                                  +
                                  Stability: 0 - Deprecated
                                  • object <any>

                                  Returns true if the given object is a Symbol. Otherwise, returns false.

                                  @@ -23335,7 +23696,7 @@
                                  Stability: 0 - Deprecated
                                    +
                                    Stability: 0 - Deprecated
                                    • object <any>

                                    Returns true if the given object is undefined. Otherwise, returns false.

                                    @@ -23353,7 +23714,7 @@
                                    Stability: 0 - Deprecated: Use a third party module instead.
                                      +
                                      Stability: 0 - Deprecated: Use a third party module instead.

                                      The util.log() method prints the given string to stdout with an included @@ -23366,23 +23727,24 @@

                                      Stability: 0 - Deprecated: Use console.log() instead.

                                      Deprecated predecessor of console.log.

                                      +
                                      Stability: 0 - Deprecated: Use console.log() instead.

                                      Deprecated predecessor of console.log.

                                      util.puts([...strings])#

                                      Stability: 0 - Deprecated: Use console.log() instead.

                                      Deprecated predecessor of console.log.

                                      +
                                      Stability: 0 - Deprecated: Use console.log() instead.

                                      Deprecated predecessor of console.log.

                                      util._extend(target, source)#

                                      Stability: 0 - Deprecated: Use Object.assign() instead.

                                      The util._extend() method was never intended to be used outside of internal +

                                      Stability: 0 - Deprecated: Use Object.assign() instead.

                                      The util._extend() method was never intended to be used outside of internal Node.js modules. The community found and used it anyway.

                                      It is deprecated and should not be used in new code. JavaScript comes with very similar built-in functionality through Object.assign().

                                      V8#

                                      +

                                      The v8 module exposes APIs that are specific to the version of V8 built into the Node.js binary. It can be accessed using:

                                      const v8 = require('v8');
                                      @@ -23417,7 +23779,7 @@
                                       

                                      Returns statistics about the V8 heap spaces, i.e. the segments which make up the V8 heap. Neither the ordering of heap spaces, nor the availability of a heap space can be guaranteed as the statistics are provided via the V8 -GetHeapSpaceStatistics function and may change from one V8 version to the +GetHeapSpaceStatistics function and may change from one V8 version to the next.

                                      The value returned is an array of objects containing the following properties:

                                        @@ -23485,7 +23847,8 @@

                                        VM (Executing JavaScript)#

                                        -
                                        Stability: 2 - Stable
                                        + +
                                        Stability: 2 - Stable

                                        The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts. It can be accessed using:

                                        const vm = require('vm');
                                        @@ -23903,7 +24266,8 @@
                                         
                                         
                                         

                                        Zlib#

                                        -
                                        Stability: 2 - Stable

                                        The zlib module provides compression functionality implemented using Gzip and + +

                                        Stability: 2 - Stable

                                        The zlib module provides compression functionality implemented using Gzip and Deflate/Inflate. It can be accessed using:

                                        const zlib = require('zlib');
                                         
                                        diff -Nru nodejs-6.11.2~dfsg/doc/api/all.json nodejs-6.11.4~dfsg/doc/api/all.json --- nodejs-6.11.2~dfsg/doc/api/all.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/all.json 2017-10-03 17:11:38.000000000 +0000 @@ -7,32 +7,34 @@ "text": "\n" } ], + "introduced_in": "v0.10.0", "miscs": [ { "textRaw": "About this Documentation", "name": "About this Documentation", + "introduced_in": "v0.10.0", "type": "misc", - "desc": "

                                        The goal of this documentation is to comprehensively explain the Node.js\nAPI, both from a reference as well as a conceptual point of view. Each\nsection describes a built-in module or high-level concept.

                                        \n

                                        Where appropriate, property types, method arguments, and the arguments\nprovided to event handlers are detailed in a list underneath the topic\nheading.

                                        \n

                                        Every .html document has a corresponding .json document presenting\nthe same information in a structured manner. This feature is\nexperimental, and added for the benefit of IDEs and other utilities that\nwish to do programmatic things with the documentation.

                                        \n

                                        Every .html and .json file is generated based on the corresponding\n.md file in the doc/api/ folder in Node.js's source tree. The\ndocumentation is generated using the tools/doc/generate.js program.\nThe HTML template is located at doc/template.html.

                                        \n

                                        If you find an error in this documentation, please submit an issue\nor see the contributing guide for directions on how to submit a patch.

                                        \n", + "desc": "

                                        The goal of this documentation is to comprehensively explain the Node.js\nAPI, both from a reference as well as a conceptual point of view. Each\nsection describes a built-in module or high-level concept.

                                        \n

                                        Where appropriate, property types, method arguments, and the arguments\nprovided to event handlers are detailed in a list underneath the topic\nheading.

                                        \n

                                        Every .html document has a corresponding .json document presenting\nthe same information in a structured manner. This feature is\nexperimental, and added for the benefit of IDEs and other utilities that\nwish to do programmatic things with the documentation.

                                        \n

                                        Every .html and .json file is generated based on the corresponding\n.md file in the doc/api/ folder in Node.js's source tree. The\ndocumentation is generated using the tools/doc/generate.js program.\nThe HTML template is located at doc/template.html.

                                        \n

                                        If you find an error in this documentation, please submit an issue\nor see the contributing guide for directions on how to submit a patch.

                                        \n", "miscs": [ { "textRaw": "Stability Index", "name": "Stability Index", "type": "misc", - "desc": "

                                        Throughout the documentation, you will see indications of a section's\nstability. The Node.js API is still somewhat changing, and as it\nmatures, certain parts are more reliable than others. Some are so\nproven, and so relied upon, that they are unlikely to ever change at\nall. Others are brand new and experimental, or known to be hazardous\nand in the process of being redesigned.

                                        \n

                                        The stability indices are as follows:

                                        \n
                                        Stability: 0 - Deprecated\nThis feature is known to be problematic, and changes are\nplanned.  Do not rely on it.  Use of the feature may cause warnings.  Backwards\ncompatibility should not be expected.\n
                                        \n
                                        Stability: 1 - Experimental\nThis feature is subject to change, and is gated by a command line flag.\nIt may change or be removed in future versions.\n
                                        \n
                                        Stability: 2 - Stable\nThe API has proven satisfactory. Compatibility with the npm ecosystem\nis a high priority, and will not be broken unless absolutely necessary.\n
                                        \n" + "desc": "

                                        Throughout the documentation, you will see indications of a section's\nstability. The Node.js API is still somewhat changing, and as it\nmatures, certain parts are more reliable than others. Some are so\nproven, and so relied upon, that they are unlikely to ever change at\nall. Others are brand new and experimental, or known to be hazardous\nand in the process of being redesigned.

                                        \n

                                        The stability indices are as follows:

                                        \n
                                        Stability: 0 - Deprecated\nThis feature is known to be problematic, and changes may be planned. Do\nnot rely on it. Use of the feature may cause warnings to be emitted.\nBackwards compatibility across major versions should not be expected.\n
                                        \n
                                        Stability: 1 - Experimental\nThis feature is still under active development and subject to non-backwards\ncompatible changes, or even removal, in any future version. Use of the feature\nis not recommended in production environments. Experimental features are not\nsubject to the Node.js Semantic Versioning model.\n
                                        \n

                                        Note: Caution must be used when making use of Experimental features,\nparticularly within modules that may be used as dependencies (or dependencies\nof dependencies) within a Node.js application. End users may not be aware that\nexperimental features are being used, and therefore may experience unexpected\nfailures or behavioral changes when changes occur. To help avoid such surprises,\nExperimental features may require a command-line flag to explicitly enable\nthem, or may cause a process warning to be emitted. By default, such warnings\nare printed to stderr and may be handled by attaching a listener to the\nprocess.on('warning') event.

                                        \n
                                        Stability: 2 - Stable\nThe API has proven satisfactory. Compatibility with the npm ecosystem\nis a high priority, and will not be broken unless absolutely necessary.\n
                                        \n" }, { "textRaw": "JSON Output", "name": "json_output", "stability": 1, "stabilityText": "Experimental", - "desc": "

                                        Every HTML file in the markdown has a corresponding JSON file with the\nsame data.

                                        \n

                                        This feature was added in Node.js v0.6.12. It is experimental.

                                        \n", + "desc": "

                                        Every HTML file in the markdown has a corresponding JSON file with the\nsame data.

                                        \n

                                        This feature was added in Node.js v0.6.12. It is experimental.

                                        \n", "type": "misc", "displayName": "JSON Output" }, { "textRaw": "Syscalls and man pages", "name": "syscalls_and_man_pages", - "desc": "

                                        System calls like open(2) and read(2) define the interface between user programs\nand the underlying operating system. Node functions which simply wrap a syscall,\nlike fs.open(), will document that. The docs link to the corresponding man\npages (short for manual pages) which describe how the syscalls work.

                                        \n

                                        Caveat: some syscalls, like lchown(2), are BSD-specific. That means, for\nexample, that fs.lchown() only works on macOS and other BSD-derived systems,\nand is not available on Linux.

                                        \n

                                        Most Unix syscalls have Windows equivalents, but behavior may differ on Windows\nrelative to Linux and macOS. For an example of the subtle ways in which it's\nsometimes impossible to replace Unix syscall semantics on Windows, see Node\nissue 4760.

                                        \n\n\n", + "desc": "

                                        System calls like open(2) and read(2) define the interface between user programs\nand the underlying operating system. Node functions which simply wrap a syscall,\nlike fs.open(), will document that. The docs link to the corresponding man\npages (short for manual pages) which describe how the syscalls work.

                                        \n

                                        Note: some syscalls, like lchown(2), are BSD-specific. That means, for\nexample, that fs.lchown() only works on macOS and other BSD-derived systems,\nand is not available on Linux.

                                        \n

                                        Most Unix syscalls have Windows equivalents, but behavior may differ on Windows\nrelative to Linux and macOS. For an example of the subtle ways in which it's\nsometimes impossible to replace Unix syscall semantics on Windows, see Node\nissue 4760.

                                        \n\n\n", "type": "misc", "displayName": "Syscalls and man pages" } @@ -41,12 +43,14 @@ { "textRaw": "Usage", "name": "Usage", + "introduced_in": "v0.10.0", "type": "misc", "desc": "

                                        node [options] [v8 options] [script.js | -e "script"] [arguments]

                                        \n

                                        Please see the Command Line Options document for information about\ndifferent options and ways to run scripts with Node.js.

                                        \n

                                        Example

                                        \n

                                        An example of a web server written with Node.js which responds with\n'Hello World':

                                        \n
                                        const http = require('http');\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\nconst server = http.createServer((req, res) => {\n  res.statusCode = 200;\n  res.setHeader('Content-Type', 'text/plain');\n  res.end('Hello World\\n');\n});\n\nserver.listen(port, hostname, () => {\n  console.log(`Server running at http://${hostname}:${port}/`);\n});\n
                                        \n

                                        To run the server, put the code into a file called example.js and execute\nit with Node.js:

                                        \n
                                        $ node example.js\nServer running at http://127.0.0.1:3000/\n
                                        \n

                                        All of the examples in the documentation can be run similarly.

                                        \n\n\n" }, { "textRaw": "Command Line Options", "name": "Command Line Options", + "introduced_in": "v5.9.1", "type": "misc", "desc": "

                                        Node.js comes with a variety of CLI options. These options expose built-in\ndebugging, multiple ways to execute scripts, and other helpful runtime options.

                                        \n

                                        To view this documentation as a manual page in your terminal, run man node.

                                        \n", "miscs": [ @@ -333,7 +337,7 @@ "v6.11.0" ] }, - "desc": "

                                        Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by\ncurrent NodeJS version. The default store is selectable at build-time.

                                        \n

                                        Using OpenSSL store allows for external modifications of the store. For most\nLinux and BSD distributions, this store is maintained by the distribution\nmaintainers and system administrators. OpenSSL CA store location is dependent on\nconfiguration of the OpenSSL library but this can be altered at runtime using\nenvironmental variables.

                                        \n

                                        The bundled CA store, as supplied by NodeJS, is a snapshot of Mozilla CA store\nthat is fixed at release time. It is identical on all supported platforms.

                                        \n

                                        See SSL_CERT_DIR and SSL_CERT_FILE.

                                        \n", + "desc": "

                                        Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by\ncurrent Node.js version. The default store is selectable at build-time.

                                        \n

                                        Using OpenSSL store allows for external modifications of the store. For most\nLinux and BSD distributions, this store is maintained by the distribution\nmaintainers and system administrators. OpenSSL CA store location is dependent on\nconfiguration of the OpenSSL library but this can be altered at runtime using\nenvironment variables.

                                        \n

                                        The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store\nthat is fixed at release time. It is identical on all supported platforms.

                                        \n

                                        See SSL_CERT_DIR and SSL_CERT_FILE.

                                        \n", "type": "module", "displayName": "`--use-openssl-ca`, `--use-bundled-ca`" }, @@ -468,7 +472,7 @@ "v6.11.0" ] }, - "desc": "

                                        Load an OpenSSL configuration file on startup. Among other uses, this can be\nused to enable FIPS-compliant crypto if Node.js is built with ./configure\n\\-\\-openssl\\-fips.

                                        \n

                                        If the --openssl-config command line option is used, the environment\nvariable is ignored.

                                        \n", + "desc": "

                                        Load an OpenSSL configuration file on startup. Among other uses, this can be\nused to enable FIPS-compliant crypto if Node.js is built with ./configure\n--openssl-fips.

                                        \n

                                        If the --openssl-config command line option is used, the environment\nvariable is ignored.

                                        \n", "type": "module", "displayName": "`OPENSSL_CONF=file`" }, @@ -495,6 +499,7 @@ { "textRaw": "Debugger", "name": "Debugger", + "introduced_in": "v0.9.12", "stability": 2, "stabilityText": "Stable", "type": "misc", @@ -562,6 +567,7 @@ { "textRaw": "Errors", "name": "Errors", + "introduced_in": "v4.0.0", "type": "misc", "desc": "

                                        Applications running in Node.js will generally experience four categories of\nerrors:

                                        \n
                                          \n
                                        • Standard JavaScript errors such as:
                                            \n
                                          • {EvalError} : thrown when a call to eval() fails.
                                          • \n
                                          • {SyntaxError} : thrown in response to improper JavaScript language\nsyntax.
                                          • \n
                                          • {RangeError} : thrown when a value is not within an expected range
                                          • \n
                                          • {ReferenceError} : thrown when using undefined variables
                                          • \n
                                          • {TypeError} : thrown when passing arguments of the wrong type
                                          • \n
                                          • {URIError} : thrown when a global URI handling function is misused.
                                          • \n
                                          \n
                                        • \n
                                        • System errors triggered by underlying operating system constraints such\nas attempting to open a file that does not exist, attempting to send data\nover a closed socket, etc;
                                        • \n
                                        • And User-specified errors triggered by application code.
                                        • \n
                                        • Assertion Errors are a special class of error that can be triggered whenever\nNode.js detects an exceptional logic violation that should never occur. These\nare raised typically by the assert module.
                                        • \n
                                        \n

                                        All JavaScript and System errors raised by Node.js inherit from, or are\ninstances of, the standard JavaScript {Error} class and are guaranteed\nto provide at least the properties available on that class.

                                        \n", "miscs": [ @@ -706,7 +712,7 @@ "textRaw": "`stack` {string} ", "type": "string", "name": "stack", - "desc": "

                                        The error.stack property is a string describing the point in the code at which\nthe Error was instantiated.

                                        \n

                                        For example:

                                        \n
                                        Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.<anonymous> (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n
                                        \n

                                        The first line is formatted as <error class name>: <error message>, and\nis followed by a series of stack frames (each line beginning with "at ").\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.

                                        \n

                                        It is important to note that frames are only generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called cheetahify, which itself calls a JavaScript function, the\nframe representing the cheetahify call will not be present in the stack\ntraces:

                                        \n
                                        const cheetahify = require('./native-binding.node');\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error('oh no!');\n  });\n}\n\nmakeFaster(); // will throw:\n  // /home/gbusey/file.js:6\n  //     throw new Error('oh no!');\n  //           ^\n  // Error: oh no!\n  //     at speedy (/home/gbusey/file.js:6:11)\n  //     at makeFaster (/home/gbusey/file.js:5:3)\n  //     at Object.<anonymous> (/home/gbusey/file.js:10:1)\n  //     at Module._compile (module.js:456:26)\n  //     at Object.Module._extensions..js (module.js:474:10)\n  //     at Module.load (module.js:356:32)\n  //     at Function.Module._load (module.js:312:12)\n  //     at Function.Module.runMain (module.js:497:10)\n  //     at startup (node.js:119:16)\n  //     at node.js:906:3\n
                                        \n

                                        The location information will be one of:

                                        \n
                                          \n
                                        • native, if the frame represents a call internal to V8 (as in [].forEach).
                                        • \n
                                        • plain-filename.js:line:column, if the frame represents a call internal\n to Node.js.
                                        • \n
                                        • /absolute/path/to/file.js:line:column, if the frame represents a call in\na user program, or its dependencies.
                                        • \n
                                        \n

                                        The string representing the stack trace is lazily generated when the\nerror.stack property is accessed.

                                        \n

                                        The number of frames captured by the stack trace is bounded by the smaller of\nError.stackTraceLimit or the number of available frames on the current event\nloop tick.

                                        \n

                                        System-level errors are generated as augmented Error instances, which are\ndetailed here.

                                        \n" + "desc": "

                                        The error.stack property is a string describing the point in the code at which\nthe Error was instantiated.

                                        \n

                                        For example:

                                        \n
                                        Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.<anonymous> (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n
                                        \n

                                        The first line is formatted as <error class name>: <error message>, and\nis followed by a series of stack frames (each line beginning with "at ").\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.

                                        \n

                                        It is important to note that frames are only generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called cheetahify, which itself calls a JavaScript function, the\nframe representing the cheetahify call will not be present in the stack\ntraces:

                                        \n
                                        const cheetahify = require('./native-binding.node');\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error('oh no!');\n  });\n}\n\nmakeFaster(); // will throw:\n// /home/gbusey/file.js:6\n//     throw new Error('oh no!');\n//           ^\n// Error: oh no!\n//     at speedy (/home/gbusey/file.js:6:11)\n//     at makeFaster (/home/gbusey/file.js:5:3)\n//     at Object.<anonymous> (/home/gbusey/file.js:10:1)\n//     at Module._compile (module.js:456:26)\n//     at Object.Module._extensions..js (module.js:474:10)\n//     at Module.load (module.js:356:32)\n//     at Function.Module._load (module.js:312:12)\n//     at Function.Module.runMain (module.js:497:10)\n//     at startup (node.js:119:16)\n//     at node.js:906:3\n
                                        \n

                                        The location information will be one of:

                                        \n
                                          \n
                                        • native, if the frame represents a call internal to V8 (as in [].forEach).
                                        • \n
                                        • plain-filename.js:line:column, if the frame represents a call internal\n to Node.js.
                                        • \n
                                        • /absolute/path/to/file.js:line:column, if the frame represents a call in\na user program, or its dependencies.
                                        • \n
                                        \n

                                        The string representing the stack trace is lazily generated when the\nerror.stack property is accessed.

                                        \n

                                        The number of frames captured by the stack trace is bounded by the smaller of\nError.stackTraceLimit or the number of available frames on the current event\nloop tick.

                                        \n

                                        System-level errors are generated as augmented Error instances, which are\ndetailed here.

                                        \n" } ], "signatures": [ @@ -734,13 +740,13 @@ "textRaw": "Class: RangeError", "type": "class", "name": "RangeError", - "desc": "

                                        A subclass of Error that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.

                                        \n

                                        For example:

                                        \n
                                        require('net').connect(-1);\n  // throws "RangeError: "port" option should be >= 0 and < 65536: -1"\n
                                        \n

                                        Node.js will generate and throw RangeError instances immediately as a form\nof argument validation.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.

                                        \n

                                        For example:

                                        \n
                                        require('net').connect(-1);\n// throws "RangeError: "port" option should be >= 0 and < 65536: -1"\n
                                        \n

                                        Node.js will generate and throw RangeError instances immediately as a form\nof argument validation.

                                        \n" }, { "textRaw": "Class: ReferenceError", "type": "class", "name": "ReferenceError", - "desc": "

                                        A subclass of Error that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.

                                        \n

                                        While client code may generate and propagate these errors, in practice, only V8\nwill do so.

                                        \n
                                        doesNotExist;\n  // throws ReferenceError, doesNotExist is not a variable in this program.\n
                                        \n

                                        Unless an application is dynamically generating and running code,\nReferenceError instances should always be considered a bug in the code\nor its dependencies.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.

                                        \n

                                        While client code may generate and propagate these errors, in practice, only V8\nwill do so.

                                        \n
                                        doesNotExist;\n// throws ReferenceError, doesNotExist is not a variable in this program.\n
                                        \n

                                        Unless an application is dynamically generating and running code,\nReferenceError instances should always be considered a bug in the code\nor its dependencies.

                                        \n" }, { "textRaw": "Class: SyntaxError", @@ -752,13 +758,14 @@ "textRaw": "Class: TypeError", "type": "class", "name": "TypeError", - "desc": "

                                        A subclass of Error that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.

                                        \n
                                        require('url').parse(() => { });\n  // throws TypeError, since it expected a string\n
                                        \n

                                        Node.js will generate and throw TypeError instances immediately as a form\nof argument validation.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.

                                        \n
                                        require('url').parse(() => { });\n// throws TypeError, since it expected a string\n
                                        \n

                                        Node.js will generate and throw TypeError instances immediately as a form\nof argument validation.

                                        \n" } ] }, { "textRaw": "Global Objects", "name": "Global Objects", + "introduced_in": "v0.10.0", "type": "misc", "desc": "

                                        These objects are available in all modules. Some of these objects aren't\nactually in the global scope but in the module scope - this will be noted.

                                        \n

                                        The objects listed here are specific to Node.js. There are a number of\nbuilt-in objects that are part of the JavaScript language itself, which are\nalso globally accessible.

                                        \n", "globals": [ @@ -875,6 +882,7 @@ { "textRaw": "Process", "name": "Process", + "introduced_in": "v0.10.0", "type": "global", "desc": "

                                        The process object is a global that provides information about, and control\nover, the current Node.js process. As a global, it is always available to\nNode.js applications without using require().

                                        \n", "modules": [ @@ -990,7 +998,7 @@ { "textRaw": "Emitting custom warnings", "name": "emitting_custom_warnings", - "desc": "

                                        The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                        \n
                                        // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n  // Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n  // Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n  // Prints: (node 12345) CustomWarning: Something happened!\n
                                        \n", + "desc": "

                                        The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                        \n
                                        // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n// Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n// Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n// Prints: (node 12345) CustomWarning: Something happened!\n
                                        \n", "type": "module", "displayName": "Emitting custom warnings" }, @@ -1782,7 +1790,7 @@ ] } ], - "desc": "

                                        The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. The old\nmask is return if the mask argument is given, otherwise returns the current\nmask.

                                        \n
                                        const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                        \n" + "desc": "

                                        The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. Invoked\nwithout an argument, the current mask is returned, otherwise the umask is set to\nthe argument value and the previous mask is returned.

                                        \n
                                        const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                        \n" }, { "textRaw": "process.uptime()", @@ -2124,6 +2132,7 @@ { "textRaw": "C/C++ Addons", "name": "c/c++_addons", + "introduced_in": "v0.10.0", "desc": "

                                        Node.js Addons are dynamically-linked shared objects, written in C or C++, that\ncan be loaded into Node.js using the require() function, and used\njust as if they were an ordinary Node.js module. They are used primarily to\nprovide an interface between JavaScript running in Node.js and C/C++ libraries.

                                        \n

                                        At the moment, the method for implementing Addons is rather complicated,\ninvolving knowledge of several components and APIs :

                                        \n
                                          \n
                                        • V8: the C++ library Node.js currently uses to provide the\nJavaScript implementation. V8 provides the mechanisms for creating objects,\ncalling functions, etc. V8's API is documented mostly in the\nv8.h header file (deps/v8/include/v8.h in the Node.js source\ntree), which is also available online.

                                          \n
                                        • \n
                                        • libuv: The C library that implements the Node.js event loop, its worker\nthreads and all of the asynchronous behaviors of the platform. It also\nserves as a cross-platform abstraction library, giving easy, POSIX-like\naccess across all major operating systems to many common system tasks, such\nas interacting with the filesystem, sockets, timers and system events. libuv\nalso provides a pthreads-like threading abstraction that may be used to\npower more sophisticated asynchronous Addons that need to move beyond the\nstandard event loop. Addon authors are encouraged to think about how to\navoid blocking the event loop with I/O or other time-intensive tasks by\noff-loading work via libuv to non-blocking system operations, worker threads\nor a custom use of libuv's threads.

                                          \n
                                        • \n
                                        • Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs\nthat Addons can use — the most important of which is the\nnode::ObjectWrap class.

                                          \n
                                        • \n
                                        • Node.js includes a number of other statically linked libraries including\nOpenSSL. These other libraries are located in the deps/ directory in the\nNode.js source tree. Only the V8 and OpenSSL symbols are purposefully\nre-exported by Node.js and may be used to various extents by Addons.\nSee Linking to Node.js' own dependencies for additional information.

                                          \n
                                        • \n
                                        \n

                                        All of the following examples are available for download and may\nbe used as a starting-point for your own Addon.

                                        \n", "modules": [ { @@ -2218,7 +2227,7 @@ { "textRaw": "void AtExit(callback, args)", "name": "void_atexit(callback,_args)", - "desc": "
                                          \n
                                        • callback: void (*)(void*) - A pointer to the function to call at exit.
                                        • \n
                                        • args: void* - A pointer to pass to the callback at exit.
                                        • \n
                                        \n

                                        Registers exit hooks that run after the event loop has ended but before the VM\nis killed.

                                        \n

                                        AtExit takes two parameters: a pointer to a callback function to run at exit,\nand a pointer to untyped context data to be passed to that callback.

                                        \n

                                        Callbacks are run in last-in first-out order.

                                        \n

                                        The following addon.cc implements AtExit:

                                        \n
                                        // addon.cc\n#undef NDEBUG\n#include <assert.h>\n#include <stdlib.h>\n#include <node.h>\n\nnamespace demo {\n\nusing node::AtExit;\nusing v8::HandleScope;\nusing v8::Isolate;\nusing v8::Local;\nusing v8::Object;\n\nstatic char cookie[] = "yum yum";\nstatic int at_exit_cb1_called = 0;\nstatic int at_exit_cb2_called = 0;\n\nstatic void at_exit_cb1(void* arg) {\n  Isolate* isolate = static_cast<Isolate*>(arg);\n  HandleScope scope(isolate);\n  Local<Object> obj = Object::New(isolate);\n  assert(!obj.IsEmpty()); // assert VM is still alive\n  assert(obj->IsObject());\n  at_exit_cb1_called++;\n}\n\nstatic void at_exit_cb2(void* arg) {\n  assert(arg == static_cast<void*>(cookie));\n  at_exit_cb2_called++;\n}\n\nstatic void sanity_check(void*) {\n  assert(at_exit_cb1_called == 1);\n  assert(at_exit_cb2_called == 2);\n}\n\nvoid init(Local<Object> exports) {\n  AtExit(sanity_check);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb1, exports->GetIsolate());\n}\n\nNODE_MODULE(addon, init)\n\n}  // namespace demo\n
                                        \n

                                        Test in JavaScript by running:

                                        \n
                                        // test.js\nconst addon = require('./build/Release/addon');\n
                                        \n\n\n", + "desc": "
                                          \n
                                        • callback: void (*)(void*) - A pointer to the function to call at exit.
                                        • \n
                                        • args: void* - A pointer to pass to the callback at exit.
                                        • \n
                                        \n

                                        Registers exit hooks that run after the event loop has ended but before the VM\nis killed.

                                        \n

                                        AtExit takes two parameters: a pointer to a callback function to run at exit,\nand a pointer to untyped context data to be passed to that callback.

                                        \n

                                        Callbacks are run in last-in first-out order.

                                        \n

                                        The following addon.cc implements AtExit:

                                        \n
                                        // addon.cc\n#include <assert.h>\n#include <stdlib.h>\n#include <node.h>\n\nnamespace demo {\n\nusing node::AtExit;\nusing v8::HandleScope;\nusing v8::Isolate;\nusing v8::Local;\nusing v8::Object;\n\nstatic char cookie[] = "yum yum";\nstatic int at_exit_cb1_called = 0;\nstatic int at_exit_cb2_called = 0;\n\nstatic void at_exit_cb1(void* arg) {\n  Isolate* isolate = static_cast<Isolate*>(arg);\n  HandleScope scope(isolate);\n  Local<Object> obj = Object::New(isolate);\n  assert(!obj.IsEmpty()); // assert VM is still alive\n  assert(obj->IsObject());\n  at_exit_cb1_called++;\n}\n\nstatic void at_exit_cb2(void* arg) {\n  assert(arg == static_cast<void*>(cookie));\n  at_exit_cb2_called++;\n}\n\nstatic void sanity_check(void*) {\n  assert(at_exit_cb1_called == 1);\n  assert(at_exit_cb2_called == 2);\n}\n\nvoid init(Local<Object> exports) {\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb2, cookie);\n  AtExit(at_exit_cb1, exports->GetIsolate());\n  AtExit(sanity_check);\n}\n\nNODE_MODULE(addon, init)\n\n}  // namespace demo\n
                                        \n

                                        Test in JavaScript by running:

                                        \n
                                        // test.js\nrequire('./build/Release/addon');\n
                                        \n\n\n", "type": "module", "displayName": "void AtExit(callback, args)" } @@ -2244,6 +2253,7 @@ { "textRaw": "Assert", "name": "assert", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The assert module provides a simple set of assertion tests that can be used to\ntest invariants.

                                        \n", @@ -2478,7 +2488,7 @@ "desc": "

                                        Tests shallow, coercive equality between the actual and expected parameters\nusing the equal comparison operator ( == ).

                                        \n
                                        const assert = require('assert');\n\nassert.equal(1, 1);\n// OK, 1 == 1\nassert.equal(1, '1');\n// OK, 1 == '1'\n\nassert.equal(1, 2);\n// AssertionError: 1 == 2\nassert.equal({a: {b: 1}}, {a: {b: 1}});\n//AssertionError: { a: { b: 1 } } == { a: { b: 1 } }\n
                                        \n

                                        If the values are not equal, an AssertionError is thrown with a message\nproperty set equal to the value of the message parameter. If the message\nparameter is undefined, a default error message is assigned.

                                        \n" }, { - "textRaw": "assert.fail(actual, expected, message, operator)", + "textRaw": "assert.fail(actual, expected[, message[, operator[, stackStartFunction]]])", "type": "method", "name": "fail", "meta": { @@ -2502,12 +2512,21 @@ { "textRaw": "`message` {any} ", "name": "message", - "type": "any" + "type": "any", + "optional": true }, { "textRaw": "`operator` {string} ", "name": "operator", - "type": "string" + "type": "string", + "optional": true + }, + { + "textRaw": "`stackStartFunction` {function} (default: `assert.fail`) ", + "name": "stackStartFunction", + "default": "assert.fail", + "type": "function", + "optional": true } ] }, @@ -2520,15 +2539,21 @@ "name": "expected" }, { - "name": "message" + "name": "message", + "optional": true + }, + { + "name": "operator", + "optional": true }, { - "name": "operator" + "name": "stackStartFunction", + "optional": true } ] } ], - "desc": "

                                        Throws an AssertionError. If message is falsy, the error message is set as\nthe values of actual and expected separated by the provided operator.\nOtherwise, the error message is the value of message.

                                        \n
                                        const assert = require('assert');\n\nassert.fail(1, 2, undefined, '>');\n// AssertionError: 1 > 2\n\nassert.fail(1, 2, 'whoops', '>');\n// AssertionError: whoops\n
                                        \n" + "desc": "

                                        Throws an AssertionError. If message is falsy, the error message is set as\nthe values of actual and expected separated by the provided operator.\nOtherwise, the error message is the value of message.\nIf stackStartFunction is provided, all stack frames above that function will\nbe removed from stacktrace (see Error.captureStackTrace).

                                        \n
                                        const assert = require('assert');\n\nassert.fail(1, 2, undefined, '>');\n// AssertionError: 1 > 2\n\nassert.fail(1, 2, 'fail');\n// AssertionError: fail\n\nassert.fail(1, 2, 'whoops', '>');\n// AssertionError: whoops\n
                                        \n

                                        Example use of stackStartFunction for truncating the exception's stacktrace:

                                        \n
                                        function suppressFrame() {\n  assert.fail('a', 'b', undefined, '!==', suppressFrame);\n}\nsuppressFrame();\n// AssertionError: 'a' !== 'b'\n//     at repl:1:1\n//     at ContextifyScript.Script.runInThisContext (vm.js:44:33)\n//     ...\n
                                        \n" }, { "textRaw": "assert.ifError(value)", @@ -2880,7 +2905,7 @@ ] } ], - "desc": "

                                        Expects the function block to throw an error.

                                        \n

                                        If specified, error can be a constructor, RegExp, or validation\nfunction.

                                        \n

                                        If specified, message will be the message provided by the AssertionError if\nthe block fails to throw.

                                        \n

                                        Validate instanceof using constructor:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error\n);\n
                                        \n

                                        Validate error message using RegExp:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /value/\n);\n
                                        \n

                                        Custom error validation:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  function(err) {\n    if ((err instanceof Error) && /value/.test(err)) {\n      return true;\n    }\n  },\n  'unexpected error'\n);\n
                                        \n

                                        Note that error can not be a string. If a string is provided as the second\nargument, then error is assumed to be omitted and the string will be used for\nmessage instead. This can lead to easy-to-miss mistakes:

                                        \n\n
                                        // THIS IS A MISTAKE! DO NOT DO THIS!\nassert.throws(myFunction, 'missing foo', 'did not throw with expected message');\n\n// Do this instead.\nassert.throws(myFunction, /missing foo/, 'did not throw with expected message');\n
                                        \n\n\n" + "desc": "

                                        Expects the function block to throw an error.

                                        \n

                                        If specified, error can be a constructor, RegExp, or validation\nfunction.

                                        \n

                                        If specified, message will be the message provided by the AssertionError if\nthe block fails to throw.

                                        \n

                                        Validate instanceof using constructor:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  Error\n);\n
                                        \n

                                        Validate error message using RegExp:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  /value/\n);\n
                                        \n

                                        Custom error validation:

                                        \n
                                        assert.throws(\n  () => {\n    throw new Error('Wrong value');\n  },\n  function(err) {\n    if ((err instanceof Error) && /value/.test(err)) {\n      return true;\n    }\n  },\n  'unexpected error'\n);\n
                                        \n

                                        Note that error can not be a string. If a string is provided as the second\nargument, then error is assumed to be omitted and the string will be used for\nmessage instead. This can lead to easy-to-miss mistakes:

                                        \n\n
                                        // THIS IS A MISTAKE! DO NOT DO THIS!\nassert.throws(myFunction, 'missing foo', 'did not throw with expected message');\n\n// Do this instead.\nassert.throws(myFunction, /missing foo/, 'did not throw with expected message');\n
                                        \n\n\n" } ], "type": "module", @@ -2889,6 +2914,7 @@ { "textRaw": "Buffer", "name": "buffer", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        Prior to the introduction of TypedArray in ECMAScript 2015 (ES6), the\nJavaScript language had no mechanism for reading or manipulating streams\nof binary data. The Buffer class was introduced as part of the Node.js\nAPI to make it possible to interact with octet streams in the context of things\nlike TCP streams and file system operations.

                                        \n

                                        Now that TypedArray has been added in ES6, the Buffer class implements the\nUint8Array API in a manner that is more optimized and suitable for Node.js'\nuse cases.

                                        \n

                                        Instances of the Buffer class are similar to arrays of integers but\ncorrespond to fixed-sized, raw memory allocations outside the V8 heap.\nThe size of the Buffer is established when it is created and cannot be\nresized.

                                        \n

                                        The Buffer class is a global within Node.js, making it unlikely that one\nwould need to ever use require('buffer').Buffer.

                                        \n

                                        Examples:

                                        \n
                                        // Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10, filled with 0x1.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using either fill() or write().\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing [0x1, 0x2, 0x3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing UTF-8 bytes [0x74, 0xc3, 0xa9, 0x73, 0x74].\nconst buf5 = Buffer.from('tést');\n\n// Creates a Buffer containing Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf6 = Buffer.from('tést', 'latin1');\n
                                        \n", @@ -3347,7 +3373,7 @@ ] } ], - "desc": "

                                        Creates a new Buffer containing the given JavaScript string string. If\nprovided, the encoding parameter identifies the character encoding of string.

                                        \n

                                        Examples:

                                        \n
                                        const buf1 = Buffer.from('this is a tést');\n\n// Prints: this is a tést\nconsole.log(buf1.toString());\n\n// Prints: this is a tC)st\nconsole.log(buf1.toString('ascii'));\n\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\n// Prints: this is a tést\nconsole.log(buf2.toString());\n
                                        \n

                                        A TypeError will be thrown if str is not a string.

                                        \n" + "desc": "

                                        Creates a new Buffer containing the given JavaScript string string. If\nprovided, the encoding parameter identifies the character encoding of string.

                                        \n

                                        Examples:

                                        \n
                                        const buf1 = Buffer.from('this is a tést');\n\n// Prints: this is a tést\nconsole.log(buf1.toString());\n\n// Prints: this is a tC)st\nconsole.log(buf1.toString('ascii'));\n\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\n// Prints: this is a tést\nconsole.log(buf2.toString());\n
                                        \n

                                        A TypeError will be thrown if string is not a string.

                                        \n" }, { "textRaw": "Class Method: Buffer.isBuffer(obj)", @@ -6606,6 +6632,7 @@ { "textRaw": "Child Process", "name": "child_process", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The child_process module provides the ability to spawn child processes in\na manner that is similar, but not identical, to popen(3). This capability\nis primarily provided by the child_process.spawn() function:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst ls = spawn('ls', ['-lh', '/usr']);\n\nls.stdout.on('data', (data) => {\n  console.log(`stdout: ${data}`);\n});\n\nls.stderr.on('data', (data) => {\n  console.log(`stderr: ${data}`);\n});\n\nls.on('close', (code) => {\n  console.log(`child process exited with code ${code}`);\n});\n
                                        \n

                                        By default, pipes for stdin, stdout and stderr are established between\nthe parent Node.js process and the spawned child. It is possible to stream data\nthrough these pipes in a non-blocking way. Note, however, that some programs\nuse line-buffered I/O internally. While that does not affect Node.js, it can\nmean that data sent to the child process may not be immediately consumed.

                                        \n

                                        The child_process.spawn() method spawns the child process asynchronously,\nwithout blocking the Node.js event loop. The child_process.spawnSync()\nfunction provides equivalent functionality in a synchronous manner that blocks\nthe event loop until the spawned process either exits or is terminated.

                                        \n

                                        For convenience, the child_process module provides a handful of synchronous\nand asynchronous alternatives to child_process.spawn() and\nchild_process.spawnSync(). Note that each of these alternatives are\nimplemented on top of child_process.spawn() or child_process.spawnSync().

                                        \n\n

                                        For certain use cases, such as automating shell scripts, the\nsynchronous counterparts may be more convenient. In many cases, however,\nthe synchronous methods can have significant impact on performance due to\nstalling the event loop while spawned processes complete.

                                        \n", @@ -6993,7 +7020,7 @@ ] } ], - "desc": "

                                        The child_process.fork() method is a special case of\nchild_process.spawn() used specifically to spawn new Node.js processes.\nLike child_process.spawn(), a ChildProcess object is returned. The returned\nChildProcess will have an additional communication channel built-in that\nallows messages to be passed back and forth between the parent and child. See\nchild.send() for details.

                                        \n

                                        It is important to keep in mind that spawned Node.js child processes are\nindependent of the parent with exception of the IPC communication channel\nthat is established between the two. Each process has its own memory, with\ntheir own V8 instances. Because of the additional resource allocations\nrequired, spawning a large number of child Node.js processes is not\nrecommended.

                                        \n

                                        By default, child_process.fork() will spawn new Node.js instances using the\nprocess.execPath of the parent process. The execPath property in the\noptions object allows for an alternative execution path to be used.

                                        \n

                                        Node.js processes launched with a custom execPath will communicate with the\nparent process using the file descriptor (fd) identified using the\nenvironment variable NODE_CHANNEL_FD on the child process. The input and\noutput on this fd is expected to be line delimited JSON objects.

                                        \n

                                        Note: Unlike the fork(2) POSIX system call, child_process.fork() does\nnot clone the current process.

                                        \n" + "desc": "

                                        The child_process.fork() method is a special case of\nchild_process.spawn() used specifically to spawn new Node.js processes.\nLike child_process.spawn(), a ChildProcess object is returned. The returned\nChildProcess will have an additional communication channel built-in that\nallows messages to be passed back and forth between the parent and child. See\nsubprocess.send() for details.

                                        \n

                                        It is important to keep in mind that spawned Node.js child processes are\nindependent of the parent with exception of the IPC communication channel\nthat is established between the two. Each process has its own memory, with\ntheir own V8 instances. Because of the additional resource allocations\nrequired, spawning a large number of child Node.js processes is not\nrecommended.

                                        \n

                                        By default, child_process.fork() will spawn new Node.js instances using the\nprocess.execPath of the parent process. The execPath property in the\noptions object allows for an alternative execution path to be used.

                                        \n

                                        Node.js processes launched with a custom execPath will communicate with the\nparent process using the file descriptor (fd) identified using the\nenvironment variable NODE_CHANNEL_FD on the child process. The input and\noutput on this fd is expected to be line delimited JSON objects.

                                        \n

                                        Note: Unlike the fork(2) POSIX system call, child_process.fork() does\nnot clone the current process.

                                        \n" }, { "textRaw": "child_process.spawn(command[, args][, options])", @@ -7099,7 +7126,7 @@ ] } ], - "desc": "

                                        The child_process.spawn() method spawns a new process using the given\ncommand, with command line arguments in args. If omitted, args defaults\nto an empty array.

                                        \n

                                        Note: If the shell option is enabled, do not pass unsanitised user input to\nthis function. Any input containing shell metacharacters may be used to\ntrigger arbitrary command execution.

                                        \n

                                        A third argument may be used to specify additional options, with these defaults:

                                        \n
                                        const defaults = {\n  cwd: undefined,\n  env: process.env\n};\n
                                        \n

                                        Use cwd to specify the working directory from which the process is spawned.\nIf not given, the default is to inherit the current working directory.

                                        \n

                                        Use env to specify environment variables that will be visible to the new\nprocess, the default is process.env.

                                        \n

                                        Example of running ls -lh /usr, capturing stdout, stderr, and the\nexit code:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst ls = spawn('ls', ['-lh', '/usr']);\n\nls.stdout.on('data', (data) => {\n  console.log(`stdout: ${data}`);\n});\n\nls.stderr.on('data', (data) => {\n  console.log(`stderr: ${data}`);\n});\n\nls.on('close', (code) => {\n  console.log(`child process exited with code ${code}`);\n});\n
                                        \n

                                        Example: A very elaborate way to run ps ax | grep ssh

                                        \n
                                        const spawn = require('child_process').spawn;\nconst ps = spawn('ps', ['ax']);\nconst grep = spawn('grep', ['ssh']);\n\nps.stdout.on('data', (data) => {\n  grep.stdin.write(data);\n});\n\nps.stderr.on('data', (data) => {\n  console.log(`ps stderr: ${data}`);\n});\n\nps.on('close', (code) => {\n  if (code !== 0) {\n    console.log(`ps process exited with code ${code}`);\n  }\n  grep.stdin.end();\n});\n\ngrep.stdout.on('data', (data) => {\n  console.log(data.toString());\n});\n\ngrep.stderr.on('data', (data) => {\n  console.log(`grep stderr: ${data}`);\n});\n\ngrep.on('close', (code) => {\n  if (code !== 0) {\n    console.log(`grep process exited with code ${code}`);\n  }\n});\n
                                        \n

                                        Example of checking for failed exec:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst child = spawn('bad_command');\n\nchild.on('error', (err) => {\n  console.log('Failed to start child process.');\n});\n
                                        \n

                                        Note: Certain platforms (macOS, Linux) will use the value of argv[0] for the\nprocess title while others (Windows, SunOS) will use command.

                                        \n

                                        Note: Node.js currently overwrites argv[0] with process.execPath on\nstartup, so process.argv[0] in a Node.js child process will not match the\nargv0 parameter passed to spawn from the parent, retrieve it with the\nprocess.argv0 property instead.

                                        \n", + "desc": "

                                        The child_process.spawn() method spawns a new process using the given\ncommand, with command line arguments in args. If omitted, args defaults\nto an empty array.

                                        \n

                                        Note: If the shell option is enabled, do not pass unsanitised user input to\nthis function. Any input containing shell metacharacters may be used to\ntrigger arbitrary command execution.

                                        \n

                                        A third argument may be used to specify additional options, with these defaults:

                                        \n
                                        const defaults = {\n  cwd: undefined,\n  env: process.env\n};\n
                                        \n

                                        Use cwd to specify the working directory from which the process is spawned.\nIf not given, the default is to inherit the current working directory.

                                        \n

                                        Use env to specify environment variables that will be visible to the new\nprocess, the default is process.env.

                                        \n

                                        Example of running ls -lh /usr, capturing stdout, stderr, and the\nexit code:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst ls = spawn('ls', ['-lh', '/usr']);\n\nls.stdout.on('data', (data) => {\n  console.log(`stdout: ${data}`);\n});\n\nls.stderr.on('data', (data) => {\n  console.log(`stderr: ${data}`);\n});\n\nls.on('close', (code) => {\n  console.log(`child process exited with code ${code}`);\n});\n
                                        \n

                                        Example: A very elaborate way to run ps ax | grep ssh

                                        \n
                                        const spawn = require('child_process').spawn;\nconst ps = spawn('ps', ['ax']);\nconst grep = spawn('grep', ['ssh']);\n\nps.stdout.on('data', (data) => {\n  grep.stdin.write(data);\n});\n\nps.stderr.on('data', (data) => {\n  console.log(`ps stderr: ${data}`);\n});\n\nps.on('close', (code) => {\n  if (code !== 0) {\n    console.log(`ps process exited with code ${code}`);\n  }\n  grep.stdin.end();\n});\n\ngrep.stdout.on('data', (data) => {\n  console.log(data.toString());\n});\n\ngrep.stderr.on('data', (data) => {\n  console.log(`grep stderr: ${data}`);\n});\n\ngrep.on('close', (code) => {\n  if (code !== 0) {\n    console.log(`grep process exited with code ${code}`);\n  }\n});\n
                                        \n

                                        Example of checking for failed spawn:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst subprocess = spawn('bad_command');\n\nsubprocess.on('error', (err) => {\n  console.log('Failed to start subprocess.');\n});\n
                                        \n

                                        Note: Certain platforms (macOS, Linux) will use the value of argv[0] for the\nprocess title while others (Windows, SunOS) will use command.

                                        \n

                                        Note: Node.js currently overwrites argv[0] with process.execPath on\nstartup, so process.argv[0] in a Node.js child process will not match the\nargv0 parameter passed to spawn from the parent, retrieve it with the\nprocess.argv0 property instead.

                                        \n", "properties": [ { "textRaw": "options.detached", @@ -7109,7 +7136,7 @@ "v0.7.10" ] }, - "desc": "

                                        On Windows, setting options.detached to true makes it possible for the\nchild process to continue running after the parent exits. The child will have\nits own console window. Once enabled for a child process, it cannot be\ndisabled.

                                        \n

                                        On non-Windows platforms, if options.detached is set to true, the child\nprocess will be made the leader of a new process group and session. Note that\nchild processes may continue running after the parent exits regardless of\nwhether they are detached or not. See setsid(2) for more information.

                                        \n

                                        By default, the parent will wait for the detached child to exit. To prevent\nthe parent from waiting for a given child, use the child.unref() method.\nDoing so will cause the parent's event loop to not include the child in its\nreference count, allowing the parent to exit independently of the child, unless\nthere is an established IPC channel between the child and parent.

                                        \n

                                        When using the detached option to start a long-running process, the process\nwill not stay running in the background after the parent exits unless it is\nprovided with a stdio configuration that is not connected to the parent.\nIf the parent's stdio is inherited, the child will remain attached to the\ncontrolling terminal.

                                        \n

                                        Example of a long-running process, by detaching and also ignoring its parent\nstdio file descriptors, in order to ignore the parent's termination:

                                        \n
                                        const spawn = require('child_process').spawn;\n\nconst child = spawn(process.argv[0], ['child_program.js'], {\n  detached: true,\n  stdio: 'ignore'\n});\n\nchild.unref();\n
                                        \n

                                        Alternatively one can redirect the child process' output into files:

                                        \n
                                        const fs = require('fs');\nconst spawn = require('child_process').spawn;\nconst out = fs.openSync('./out.log', 'a');\nconst err = fs.openSync('./out.log', 'a');\n\nconst child = spawn('prg', [], {\n  detached: true,\n  stdio: [ 'ignore', out, err ]\n});\n\nchild.unref();\n
                                        \n" + "desc": "

                                        On Windows, setting options.detached to true makes it possible for the\nchild process to continue running after the parent exits. The child will have\nits own console window. Once enabled for a child process, it cannot be\ndisabled.

                                        \n

                                        On non-Windows platforms, if options.detached is set to true, the child\nprocess will be made the leader of a new process group and session. Note that\nchild processes may continue running after the parent exits regardless of\nwhether they are detached or not. See setsid(2) for more information.

                                        \n

                                        By default, the parent will wait for the detached child to exit. To prevent\nthe parent from waiting for a given subprocess, use the subprocess.unref()\nmethod. Doing so will cause the parent's event loop to not include the child in\nits reference count, allowing the parent to exit independently of the child,\nunless there is an established IPC channel between the child and parent.

                                        \n

                                        When using the detached option to start a long-running process, the process\nwill not stay running in the background after the parent exits unless it is\nprovided with a stdio configuration that is not connected to the parent.\nIf the parent's stdio is inherited, the child will remain attached to the\ncontrolling terminal.

                                        \n

                                        Example of a long-running process, by detaching and also ignoring its parent\nstdio file descriptors, in order to ignore the parent's termination:

                                        \n
                                        const spawn = require('child_process').spawn;\n\nconst subprocess = spawn(process.argv[0], ['child_program.js'], {\n  detached: true,\n  stdio: 'ignore'\n});\n\nsubprocess.unref();\n
                                        \n

                                        Alternatively one can redirect the child process' output into files:

                                        \n
                                        const fs = require('fs');\nconst spawn = require('child_process').spawn;\nconst out = fs.openSync('./out.log', 'a');\nconst err = fs.openSync('./out.log', 'a');\n\nconst subprocess = spawn('prg', [], {\n  detached: true,\n  stdio: [ 'ignore', out, err ]\n});\n\nsubprocess.unref();\n
                                        \n" }, { "textRaw": "options.stdio", @@ -7119,7 +7146,7 @@ "v0.7.10" ] }, - "desc": "

                                        The options.stdio option is used to configure the pipes that are established\nbetween the parent and child process. By default, the child's stdin, stdout,\nand stderr are redirected to corresponding child.stdin, child.stdout, and\nchild.stderr streams on the ChildProcess object. This is equivalent to\nsetting the options.stdio equal to ['pipe', 'pipe', 'pipe'].

                                        \n

                                        For convenience, options.stdio may be one of the following strings:

                                        \n
                                          \n
                                        • 'pipe' - equivalent to ['pipe', 'pipe', 'pipe'] (the default)
                                        • \n
                                        • 'ignore' - equivalent to ['ignore', 'ignore', 'ignore']
                                        • \n
                                        • 'inherit' - equivalent to [process.stdin, process.stdout, process.stderr]\n or [0,1,2]
                                        • \n
                                        \n

                                        Otherwise, the value of options.stdio is an array where each index corresponds\nto an fd in the child. The fds 0, 1, and 2 correspond to stdin, stdout,\nand stderr, respectively. Additional fds can be specified to create additional\npipes between the parent and child. The value is one of the following:

                                        \n
                                          \n
                                        1. 'pipe' - Create a pipe between the child process and the parent process.\nThe parent end of the pipe is exposed to the parent as a property on the\nchild_process object as child.stdio[fd]. Pipes created for\nfds 0 - 2 are also available as child.stdin, child.stdout\nand child.stderr, respectively.
                                        2. \n
                                        3. 'ipc' - Create an IPC channel for passing messages/file descriptors\nbetween parent and child. A ChildProcess may have at most one IPC stdio\nfile descriptor. Setting this option enables the child.send() method.\nIf the child writes JSON messages to this file descriptor, the\nchild.on('message') event handler will be triggered in the parent.\nIf the child is a Node.js process, the presence of an IPC channel will enable\nprocess.send(), process.disconnect(), process.on('disconnect'), and\nprocess.on('message') within the child.
                                        4. \n
                                        5. 'ignore' - Instructs Node.js to ignore the fd in the child. While Node.js\nwill always open fds 0 - 2 for the processes it spawns, setting the fd to\n'ignore' will cause Node.js to open /dev/null and attach it to the\nchild's fd.
                                        6. \n
                                        7. {Stream} object - Share a readable or writable stream that refers to a tty,\nfile, socket, or a pipe with the child process. The stream's underlying\nfile descriptor is duplicated in the child process to the fd that\ncorresponds to the index in the stdio array. Note that the stream must\nhave an underlying descriptor (file streams do not until the 'open'\nevent has occurred).
                                        8. \n
                                        9. Positive integer - The integer value is interpreted as a file descriptor\nthat is is currently open in the parent process. It is shared with the child\nprocess, similar to how {Stream} objects can be shared.
                                        10. \n
                                        11. null, undefined - Use default value. For stdio fds 0, 1 and 2 (in other\nwords, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the\ndefault is 'ignore'.
                                        12. \n
                                        \n

                                        Example:

                                        \n
                                        const spawn = require('child_process').spawn;\n\n// Child will use parent's stdios\nspawn('prg', [], { stdio: 'inherit' });\n\n// Spawn child sharing only stderr\nspawn('prg', [], { stdio: ['pipe', 'pipe', process.stderr] });\n\n// Open an extra fd=4, to interact with programs presenting a\n// startd-style interface.\nspawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });\n
                                        \n

                                        It is worth noting that when an IPC channel is established between the\nparent and child processes, and the child is a Node.js process, the child\nis launched with the IPC channel unreferenced (using unref()) until the\nchild registers an event handler for the process.on('disconnect') event\nor the process.on('message') event.This allows the child to exit normally\nwithout the process being held open by the open IPC channel.

                                        \n

                                        See also: child_process.exec() and child_process.fork()

                                        \n" + "desc": "

                                        The options.stdio option is used to configure the pipes that are established\nbetween the parent and child process. By default, the child's stdin, stdout,\nand stderr are redirected to corresponding subprocess.stdin,\nsubprocess.stdout, and subprocess.stderr streams on the\nChildProcess object. This is equivalent to setting the options.stdio\nequal to ['pipe', 'pipe', 'pipe'].

                                        \n

                                        For convenience, options.stdio may be one of the following strings:

                                        \n
                                          \n
                                        • 'pipe' - equivalent to ['pipe', 'pipe', 'pipe'] (the default)
                                        • \n
                                        • 'ignore' - equivalent to ['ignore', 'ignore', 'ignore']
                                        • \n
                                        • 'inherit' - equivalent to [process.stdin, process.stdout, process.stderr]\n or [0,1,2]
                                        • \n
                                        \n

                                        Otherwise, the value of options.stdio is an array where each index corresponds\nto an fd in the child. The fds 0, 1, and 2 correspond to stdin, stdout,\nand stderr, respectively. Additional fds can be specified to create additional\npipes between the parent and child. The value is one of the following:

                                        \n
                                          \n
                                        1. 'pipe' - Create a pipe between the child process and the parent process.\nThe parent end of the pipe is exposed to the parent as a property on the\nchild_process object as subprocess.stdio[fd]. Pipes created\nfor fds 0 - 2 are also available as subprocess.stdin,\nsubprocess.stdout and subprocess.stderr, respectively.
                                        2. \n
                                        3. 'ipc' - Create an IPC channel for passing messages/file descriptors\nbetween parent and child. A ChildProcess may have at most one IPC stdio\nfile descriptor. Setting this option enables the subprocess.send()\nmethod. If the child writes JSON messages to this file descriptor, the\nsubprocess.on('message') event handler will be triggered in\nthe parent. If the child is a Node.js process, the presence of an IPC channel\nwill enable process.send(), process.disconnect(),\nprocess.on('disconnect'), and process.on('message') within the\nchild.
                                        4. \n
                                        5. 'ignore' - Instructs Node.js to ignore the fd in the child. While Node.js\nwill always open fds 0 - 2 for the processes it spawns, setting the fd to\n'ignore' will cause Node.js to open /dev/null and attach it to the\nchild's fd.
                                        6. \n
                                        7. {Stream} object - Share a readable or writable stream that refers to a tty,\nfile, socket, or a pipe with the child process. The stream's underlying\nfile descriptor is duplicated in the child process to the fd that\ncorresponds to the index in the stdio array. Note that the stream must\nhave an underlying descriptor (file streams do not until the 'open'\nevent has occurred).
                                        8. \n
                                        9. Positive integer - The integer value is interpreted as a file descriptor\nthat is is currently open in the parent process. It is shared with the child\nprocess, similar to how {Stream} objects can be shared.
                                        10. \n
                                        11. null, undefined - Use default value. For stdio fds 0, 1 and 2 (in other\nwords, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the\ndefault is 'ignore'.
                                        12. \n
                                        \n

                                        Example:

                                        \n
                                        const spawn = require('child_process').spawn;\n\n// Child will use parent's stdios\nspawn('prg', [], { stdio: 'inherit' });\n\n// Spawn child sharing only stderr\nspawn('prg', [], { stdio: ['pipe', 'pipe', process.stderr] });\n\n// Open an extra fd=4, to interact with programs presenting a\n// startd-style interface.\nspawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });\n
                                        \n

                                        It is worth noting that when an IPC channel is established between the\nparent and child processes, and the child is a Node.js process, the child\nis launched with the IPC channel unreferenced (using unref()) until the\nchild registers an event handler for the process.on('disconnect') event\nor the process.on('message') event.This allows the child to exit normally\nwithout the process being held open by the open IPC channel.

                                        \n

                                        See also: child_process.exec() and child_process.fork()

                                        \n" } ] } @@ -7263,7 +7290,7 @@ ] } ], - "desc": "

                                        The child_process.execFileSync() method is generally identical to\nchild_process.execFile() with the exception that the method will not return\nuntil the child process has fully closed. When a timeout has been encountered\nand killSignal is sent, the method won't return until the process has\ncompletely exited. Note that if the child process intercepts and handles\nthe SIGTERM signal and does not exit, the parent process will still wait\nuntil the child process has exited.

                                        \n

                                        If the process times out, or has a non-zero exit code, this method will\nthrow. The Error object will contain the entire result from\nchild_process.spawnSync()

                                        \n" + "desc": "

                                        The child_process.execFileSync() method is generally identical to\nchild_process.execFile() with the exception that the method will not return\nuntil the child process has fully closed. When a timeout has been encountered\nand killSignal is sent, the method won't return until the process has\ncompletely exited. Note that if the child process intercepts and handles\nthe SIGTERM signal and does not exit, the parent process will still wait\nuntil the child process has exited.

                                        \n

                                        If the process times out, or has a non-zero exit code, this method will\nthrow an Error that will include the full result of the underlying\nchild_process.spawnSync().

                                        \n" }, { "textRaw": "child_process.execSync(command[, options])", @@ -7613,7 +7640,7 @@ "v0.7.2" ] }, - "desc": "

                                        The 'disconnect' event is emitted after calling the\nchild.disconnect() method in parent process or process.disconnect() in child process. After\ndisconnecting it is no longer possible to send or receive messages, and the\nchild.connected property is false.

                                        \n", + "desc": "

                                        The 'disconnect' event is emitted after calling the\nsubprocess.disconnect() method in parent process or\nprocess.disconnect() in child process. After disconnecting it is no longer\npossible to send or receive messages, and the subprocess.connected\nproperty is false.

                                        \n", "params": [] }, { @@ -7621,7 +7648,7 @@ "type": "event", "name": "error", "params": [], - "desc": "

                                        The 'error' event is emitted whenever:

                                        \n
                                          \n
                                        1. The process could not be spawned, or
                                        2. \n
                                        3. The process could not be killed, or
                                        4. \n
                                        5. Sending a message to the child process failed.
                                        6. \n
                                        \n

                                        Note that the 'exit' event may or may not fire after an error has occurred.\nIf you are listening to both the 'exit' and 'error' events, it is important\nto guard against accidentally invoking handler functions multiple times.

                                        \n

                                        See also child.kill() and child.send().

                                        \n" + "desc": "

                                        The 'error' event is emitted whenever:

                                        \n
                                          \n
                                        1. The process could not be spawned, or
                                        2. \n
                                        3. The process could not be killed, or
                                        4. \n
                                        5. Sending a message to the child process failed.
                                        6. \n
                                        \n

                                        Note that the 'exit' event may or may not fire after an error has occurred.\nIf you are listening to both the 'exit' and 'error' events, it is important\nto guard against accidentally invoking handler functions multiple times.

                                        \n

                                        See also subprocess.kill() and subprocess.send().

                                        \n" }, { "textRaw": "Event: 'exit'", @@ -7645,12 +7672,12 @@ ] }, "params": [], - "desc": "

                                        The 'message' event is triggered when a child process uses process.send()\nto send messages.

                                        \n" + "desc": "

                                        The 'message' event is triggered when a child process uses process.send()\nto send messages.

                                        \n

                                        \n" } ], "properties": [ { - "textRaw": "`connected` {boolean} Set to `false` after `child.disconnect()` is called ", + "textRaw": "`connected` {boolean} Set to `false` after `subprocess.disconnect()` is called ", "type": "boolean", "name": "connected", "meta": { @@ -7658,8 +7685,20 @@ "v0.7.2" ] }, - "desc": "

                                        The child.connected property indicates whether it is still possible to send\nand receive messages from a child process. When child.connected is false, it\nis no longer possible to send or receive messages.

                                        \n", - "shortDesc": "Set to `false` after `child.disconnect()` is called" + "desc": "

                                        The subprocess.connected property indicates whether it is still possible to\nsend and receive messages from a child process. When subprocess.connected is\nfalse, it is no longer possible to send or receive messages.

                                        \n

                                        \n", + "shortDesc": "Set to `false` after `subprocess.disconnect()` is called" + }, + { + "textRaw": "`killed` {boolean} Set to `true` after `subprocess.kill()` is used to successfully terminate the child process. ", + "type": "boolean", + "name": "killed", + "meta": { + "added": [ + "v0.5.10" + ] + }, + "desc": "

                                        The subprocess.killed property indicates whether the child process was\nsuccessfully terminated using subprocess.kill().

                                        \n

                                        \n", + "shortDesc": "Set to `true` after `subprocess.kill()` is used to successfully terminate the child process." }, { "textRaw": "`pid` {number} Integer ", @@ -7670,7 +7709,7 @@ "v0.1.90" ] }, - "desc": "

                                        Returns the process identifier (PID) of the child process.

                                        \n

                                        Example:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst grep = spawn('grep', ['ssh']);\n\nconsole.log(`Spawned child pid: ${grep.pid}`);\ngrep.stdin.end();\n
                                        \n", + "desc": "

                                        Returns the process identifier (PID) of the child process.

                                        \n

                                        Example:

                                        \n
                                        const spawn = require('child_process').spawn;\nconst grep = spawn('grep', ['ssh']);\n\nconsole.log(`Spawned child pid: ${grep.pid}`);\ngrep.stdin.end();\n
                                        \n

                                        \n", "shortDesc": "Integer" }, { @@ -7682,7 +7721,7 @@ "v0.1.90" ] }, - "desc": "

                                        A Readable Stream that represents the child process's stderr.

                                        \n

                                        If the child was spawned with stdio[2] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        child.stderr is an alias for child.stdio[2]. Both properties will refer to\nthe same value.

                                        \n" + "desc": "

                                        A Readable Stream that represents the child process's stderr.

                                        \n

                                        If the child was spawned with stdio[2] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        subprocess.stderr is an alias for subprocess.stdio[2]. Both properties will\nrefer to the same value.

                                        \n

                                        \n" }, { "textRaw": "`stdin` {stream.Writable} ", @@ -7693,7 +7732,7 @@ "v0.1.90" ] }, - "desc": "

                                        A Writable Stream that represents the child process's stdin.

                                        \n

                                        Note that if a child process waits to read all of its input, the child will not\ncontinue until this stream has been closed via end().

                                        \n

                                        If the child was spawned with stdio[0] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        child.stdin is an alias for child.stdio[0]. Both properties will refer to\nthe same value.

                                        \n" + "desc": "

                                        A Writable Stream that represents the child process's stdin.

                                        \n

                                        Note that if a child process waits to read all of its input, the child will not\ncontinue until this stream has been closed via end().

                                        \n

                                        If the child was spawned with stdio[0] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        subprocess.stdin is an alias for subprocess.stdio[0]. Both properties will\nrefer to the same value.

                                        \n

                                        \n" }, { "textRaw": "`stdio` {Array} ", @@ -7704,7 +7743,7 @@ "v0.7.10" ] }, - "desc": "

                                        A sparse array of pipes to the child process, corresponding with positions in\nthe stdio option passed to child_process.spawn() that have been set\nto the value 'pipe'. Note that child.stdio[0], child.stdio[1], and\nchild.stdio[2] are also available as child.stdin, child.stdout, and\nchild.stderr, respectively.

                                        \n

                                        In the following example, only the child's fd 1 (stdout) is configured as a\npipe, so only the parent's child.stdio[1] is a stream, all other values in\nthe array are null.

                                        \n
                                        const assert = require('assert');\nconst fs = require('fs');\nconst child_process = require('child_process');\n\nconst child = child_process.spawn('ls', {\n  stdio: [\n    0, // Use parent's stdin for child\n    'pipe', // Pipe child's stdout to parent\n    fs.openSync('err.out', 'w') // Direct child's stderr to a file\n  ]\n});\n\nassert.strictEqual(child.stdio[0], null);\nassert.strictEqual(child.stdio[0], child.stdin);\n\nassert(child.stdout);\nassert.strictEqual(child.stdio[1], child.stdout);\n\nassert.strictEqual(child.stdio[2], null);\nassert.strictEqual(child.stdio[2], child.stderr);\n
                                        \n" + "desc": "

                                        A sparse array of pipes to the child process, corresponding with positions in\nthe stdio option passed to child_process.spawn() that have been set\nto the value 'pipe'. Note that subprocess.stdio[0], subprocess.stdio[1],\nand subprocess.stdio[2] are also available as subprocess.stdin,\nsubprocess.stdout, and subprocess.stderr, respectively.

                                        \n

                                        In the following example, only the child's fd 1 (stdout) is configured as a\npipe, so only the parent's subprocess.stdio[1] is a stream, all other values\nin the array are null.

                                        \n
                                        const assert = require('assert');\nconst fs = require('fs');\nconst child_process = require('child_process');\n\nconst subprocess = child_process.spawn('ls', {\n  stdio: [\n    0, // Use parent's stdin for child\n    'pipe', // Pipe child's stdout to parent\n    fs.openSync('err.out', 'w') // Direct child's stderr to a file\n  ]\n});\n\nassert.strictEqual(subprocess.stdio[0], null);\nassert.strictEqual(subprocess.stdio[0], subprocess.stdin);\n\nassert(subprocess.stdout);\nassert.strictEqual(subprocess.stdio[1], subprocess.stdout);\n\nassert.strictEqual(subprocess.stdio[2], null);\nassert.strictEqual(subprocess.stdio[2], subprocess.stderr);\n
                                        \n

                                        \n" }, { "textRaw": "`stdout` {stream.Readable} ", @@ -7715,12 +7754,12 @@ "v0.1.90" ] }, - "desc": "

                                        A Readable Stream that represents the child process's stdout.

                                        \n

                                        If the child was spawned with stdio[1] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        child.stdout is an alias for child.stdio[1]. Both properties will refer\nto the same value.

                                        \n" + "desc": "

                                        A Readable Stream that represents the child process's stdout.

                                        \n

                                        If the child was spawned with stdio[1] set to anything other than 'pipe',\nthen this will be null.

                                        \n

                                        subprocess.stdout is an alias for subprocess.stdio[1]. Both properties will\nrefer to the same value.

                                        \n" } ], "methods": [ { - "textRaw": "child.disconnect()", + "textRaw": "subprocess.disconnect()", "type": "method", "name": "disconnect", "meta": { @@ -7728,7 +7767,7 @@ "v0.7.2" ] }, - "desc": "

                                        Closes the IPC channel between parent and child, allowing the child to exit\ngracefully once there are no other connections keeping it alive. After calling\nthis method the child.connected and process.connected properties in both\nthe parent and child (respectively) will be set to false, and it will be no\nlonger possible to pass messages between the processes.

                                        \n

                                        The 'disconnect' event will be emitted when there are no messages in the\nprocess of being received. This will most often be triggered immediately after\ncalling child.disconnect().

                                        \n

                                        Note that when the child process is a Node.js instance (e.g. spawned using\nchild_process.fork()), the process.disconnect() method can be invoked\nwithin the child process to close the IPC channel as well.

                                        \n", + "desc": "

                                        Closes the IPC channel between parent and child, allowing the child to exit\ngracefully once there are no other connections keeping it alive. After calling\nthis method the subprocess.connected and process.connected properties in\nboth the parent and child (respectively) will be set to false, and it will be\nno longer possible to pass messages between the processes.

                                        \n

                                        The 'disconnect' event will be emitted when there are no messages in the\nprocess of being received. This will most often be triggered immediately after\ncalling subprocess.disconnect().

                                        \n

                                        Note that when the child process is a Node.js instance (e.g. spawned using\nchild_process.fork()), the process.disconnect() method can be invoked\nwithin the child process to close the IPC channel as well.

                                        \n

                                        \n", "signatures": [ { "params": [] @@ -7736,7 +7775,7 @@ ] }, { - "textRaw": "child.kill([signal])", + "textRaw": "subprocess.kill([signal])", "type": "method", "name": "kill", "meta": { @@ -7764,10 +7803,10 @@ ] } ], - "desc": "

                                        The child.kill() methods sends a signal to the child process. If no argument\nis given, the process will be sent the 'SIGTERM' signal. See signal(7) for\na list of available signals.

                                        \n
                                        const spawn = require('child_process').spawn;\nconst grep = spawn('grep', ['ssh']);\n\ngrep.on('close', (code, signal) => {\n  console.log(\n    `child process terminated due to receipt of signal ${signal}`);\n});\n\n// Send SIGHUP to process\ngrep.kill('SIGHUP');\n
                                        \n

                                        The ChildProcess object may emit an 'error' event if the signal cannot be\ndelivered. Sending a signal to a child process that has already exited is not\nan error but may have unforeseen consequences. Specifically, if the process\nidentifier (PID) has been reassigned to another process, the signal will be\ndelivered to that process instead which can have unexpected results.

                                        \n

                                        Note that while the function is called kill, the signal delivered to the\nchild process may not actually terminate the process.

                                        \n

                                        See kill(2) for reference.

                                        \n

                                        Also note: on Linux, child processes of child processes will not be terminated\nwhen attempting to kill their parent. This is likely to happen when running a\nnew process in a shell or with use of the shell option of ChildProcess, such\nas in this example:

                                        \n
                                        'use strict';\nconst spawn = require('child_process').spawn;\n\nconst child = spawn(\n  'sh',\n  [\n    '-c',\n    `node -e "setInterval(() => {\n      console.log(process.pid, 'is alive')\n    }, 500);"`\n  ], {\n    stdio: ['inherit', 'inherit', 'inherit']\n  }\n);\n\nsetTimeout(() => {\n  child.kill(); // does not terminate the node process in the shell\n}, 2000);\n
                                        \n" + "desc": "

                                        The subprocess.kill() methods sends a signal to the child process. If no\nargument is given, the process will be sent the 'SIGTERM' signal. See\nsignal(7) for a list of available signals.

                                        \n
                                        const spawn = require('child_process').spawn;\nconst grep = spawn('grep', ['ssh']);\n\ngrep.on('close', (code, signal) => {\n  console.log(\n    `child process terminated due to receipt of signal ${signal}`);\n});\n\n// Send SIGHUP to process\ngrep.kill('SIGHUP');\n
                                        \n

                                        The ChildProcess object may emit an 'error' event if the signal cannot be\ndelivered. Sending a signal to a child process that has already exited is not\nan error but may have unforeseen consequences. Specifically, if the process\nidentifier (PID) has been reassigned to another process, the signal will be\ndelivered to that process instead which can have unexpected results.

                                        \n

                                        Note that while the function is called kill, the signal delivered to the\nchild process may not actually terminate the process.

                                        \n

                                        See kill(2) for reference.

                                        \n

                                        Also note: on Linux, child processes of child processes will not be terminated\nwhen attempting to kill their parent. This is likely to happen when running a\nnew process in a shell or with use of the shell option of ChildProcess, such\nas in this example:

                                        \n
                                        'use strict';\nconst spawn = require('child_process').spawn;\n\nconst subprocess = spawn(\n  'sh',\n  [\n    '-c',\n    `node -e "setInterval(() => {\n      console.log(process.pid, 'is alive')\n    }, 500);"`\n  ], {\n    stdio: ['inherit', 'inherit', 'inherit']\n  }\n);\n\nsetTimeout(() => {\n  subprocess.kill(); // does not terminate the node process in the shell\n}, 2000);\n
                                        \n" }, { - "textRaw": "child.send(message[, sendHandle[, options]][, callback])", + "textRaw": "subprocess.send(message[, sendHandle[, options]][, callback])", "type": "method", "name": "send", "meta": { @@ -7828,7 +7867,7 @@ ] } ], - "desc": "

                                        When an IPC channel has been established between the parent and child (\ni.e. when using child_process.fork()), the child.send() method can be\nused to send messages to the child process. When the child process is a Node.js\ninstance, these messages can be received via the process.on('message') event.

                                        \n

                                        For example, in the parent script:

                                        \n
                                        const cp = require('child_process');\nconst n = cp.fork(`${__dirname}/sub.js`);\n\nn.on('message', (m) => {\n  console.log('PARENT got message:', m);\n});\n\nn.send({ hello: 'world' });\n
                                        \n

                                        And then the child script, 'sub.js' might look like this:

                                        \n
                                        process.on('message', (m) => {\n  console.log('CHILD got message:', m);\n});\n\nprocess.send({ foo: 'bar' });\n
                                        \n

                                        Child Node.js processes will have a process.send() method of their own that\nallows the child to send messages back to the parent.

                                        \n

                                        There is a special case when sending a {cmd: 'NODE_foo'} message. All messages\ncontaining a NODE_ prefix in its cmd property are considered to be reserved\nfor use within Node.js core and will not be emitted in the child's\nprocess.on('message') event. Rather, such messages are emitted using the\nprocess.on('internalMessage') event and are consumed internally by Node.js.\nApplications should avoid using such messages or listening for\n'internalMessage' events as it is subject to change without notice.

                                        \n

                                        The optional sendHandle argument that may be passed to child.send() is for\npassing a TCP server or socket object to the child process. The child will\nreceive the object as the second argument passed to the callback function\nregistered on the process.on('message') event. Any data that is received\nand buffered in the socket will not be sent to the child.

                                        \n

                                        The options argument, if present, is an object used to parameterize the\nsending of certain types of handles. options supports the following\nproperties:

                                        \n
                                          \n
                                        • keepOpen - A Boolean value that can be used when passing instances of\nnet.Socket. When true, the socket is kept open in the sending process.\nDefaults to false.
                                        • \n
                                        \n

                                        The optional callback is a function that is invoked after the message is\nsent but before the child may have received it. The function is called with a\nsingle argument: null on success, or an Error object on failure.

                                        \n

                                        If no callback function is provided and the message cannot be sent, an\n'error' event will be emitted by the ChildProcess object. This can happen,\nfor instance, when the child process has already exited.

                                        \n

                                        child.send() will return false if the channel has closed or when the\nbacklog of unsent messages exceeds a threshold that makes it unwise to send\nmore. Otherwise, the method returns true. The callback function can be\nused to implement flow control.

                                        \n

                                        Example: sending a server object

                                        \n

                                        The sendHandle argument can be used, for instance, to pass the handle of\na TCP server object to the child process as illustrated in the example below:

                                        \n
                                        const child = require('child_process').fork('child.js');\n\n// Open up the server object and send the handle.\nconst server = require('net').createServer();\nserver.on('connection', (socket) => {\n  socket.end('handled by parent');\n});\nserver.listen(1337, () => {\n  child.send('server', server);\n});\n
                                        \n

                                        The child would then receive the server object as:

                                        \n
                                        process.on('message', (m, server) => {\n  if (m === 'server') {\n    server.on('connection', (socket) => {\n      socket.end('handled by child');\n    });\n  }\n});\n
                                        \n

                                        Once the server is now shared between the parent and child, some connections\ncan be handled by the parent and some by the child.

                                        \n

                                        While the example above uses a server created using the net module, dgram\nmodule servers use exactly the same workflow with the exceptions of listening on\na 'message' event instead of 'connection' and using server.bind() instead of\nserver.listen(). This is, however, currently only supported on UNIX platforms.

                                        \n

                                        Example: sending a socket object

                                        \n

                                        Similarly, the sendHandler argument can be used to pass the handle of a\nsocket to the child process. The example below spawns two children that each\nhandle connections with "normal" or "special" priority:

                                        \n
                                        const normal = require('child_process').fork('child.js', ['normal']);\nconst special = require('child_process').fork('child.js', ['special']);\n\n// Open up the server and send sockets to child\nconst server = require('net').createServer();\nserver.on('connection', (socket) => {\n\n  // If this is special priority\n  if (socket.remoteAddress === '74.125.127.100') {\n    special.send('socket', socket);\n    return;\n  }\n  // This is normal priority\n  normal.send('socket', socket);\n});\nserver.listen(1337);\n
                                        \n

                                        The child.js would receive the socket handle as the second argument passed\nto the event callback function:

                                        \n
                                        process.on('message', (m, socket) => {\n  if (m === 'socket') {\n    socket.end(`Request handled with ${process.argv[2]} priority`);\n  }\n});\n
                                        \n

                                        Once a socket has been passed to a child, the parent is no longer capable of\ntracking when the socket is destroyed. To indicate this, the .connections\nproperty becomes null. It is recommended not to use .maxConnections when\nthis occurs.

                                        \n

                                        Note: this function uses JSON.stringify() internally to serialize the\nmessage.

                                        \n" + "desc": "

                                        When an IPC channel has been established between the parent and child (\ni.e. when using child_process.fork()), the subprocess.send() method can\nbe used to send messages to the child process. When the child process is a\nNode.js instance, these messages can be received via the\nprocess.on('message') event.

                                        \n

                                        For example, in the parent script:

                                        \n
                                        const cp = require('child_process');\nconst n = cp.fork(`${__dirname}/sub.js`);\n\nn.on('message', (m) => {\n  console.log('PARENT got message:', m);\n});\n\nn.send({ hello: 'world' });\n
                                        \n

                                        And then the child script, 'sub.js' might look like this:

                                        \n
                                        process.on('message', (m) => {\n  console.log('CHILD got message:', m);\n});\n\nprocess.send({ foo: 'bar' });\n
                                        \n

                                        Child Node.js processes will have a process.send() method of their own that\nallows the child to send messages back to the parent.

                                        \n

                                        There is a special case when sending a {cmd: 'NODE_foo'} message. All messages\ncontaining a NODE_ prefix in its cmd property are considered to be reserved\nfor use within Node.js core and will not be emitted in the child's\nprocess.on('message') event. Rather, such messages are emitted using the\nprocess.on('internalMessage') event and are consumed internally by Node.js.\nApplications should avoid using such messages or listening for\n'internalMessage' events as it is subject to change without notice.

                                        \n

                                        The optional sendHandle argument that may be passed to subprocess.send() is\nfor passing a TCP server or socket object to the child process. The child will\nreceive the object as the second argument passed to the callback function\nregistered on the process.on('message') event. Any data that is received\nand buffered in the socket will not be sent to the child.

                                        \n

                                        The options argument, if present, is an object used to parameterize the\nsending of certain types of handles. options supports the following\nproperties:

                                        \n
                                          \n
                                        • keepOpen - A Boolean value that can be used when passing instances of\nnet.Socket. When true, the socket is kept open in the sending process.\nDefaults to false.
                                        • \n
                                        \n

                                        The optional callback is a function that is invoked after the message is\nsent but before the child may have received it. The function is called with a\nsingle argument: null on success, or an Error object on failure.

                                        \n

                                        If no callback function is provided and the message cannot be sent, an\n'error' event will be emitted by the ChildProcess object. This can happen,\nfor instance, when the child process has already exited.

                                        \n

                                        subprocess.send() will return false if the channel has closed or when the\nbacklog of unsent messages exceeds a threshold that makes it unwise to send\nmore. Otherwise, the method returns true. The callback function can be\nused to implement flow control.

                                        \n

                                        Example: sending a server object

                                        \n

                                        The sendHandle argument can be used, for instance, to pass the handle of\na TCP server object to the child process as illustrated in the example below:

                                        \n
                                        const subprocess = require('child_process').fork('subprocess.js');\n\n// Open up the server object and send the handle.\nconst server = require('net').createServer();\nserver.on('connection', (socket) => {\n  socket.end('handled by parent');\n});\nserver.listen(1337, () => {\n  subprocess.send('server', server);\n});\n
                                        \n

                                        The child would then receive the server object as:

                                        \n
                                        process.on('message', (m, server) => {\n  if (m === 'server') {\n    server.on('connection', (socket) => {\n      socket.end('handled by child');\n    });\n  }\n});\n
                                        \n

                                        Once the server is now shared between the parent and child, some connections\ncan be handled by the parent and some by the child.

                                        \n

                                        While the example above uses a server created using the net module, dgram\nmodule servers use exactly the same workflow with the exceptions of listening on\na 'message' event instead of 'connection' and using server.bind() instead of\nserver.listen(). This is, however, currently only supported on UNIX platforms.

                                        \n

                                        Example: sending a socket object

                                        \n

                                        Similarly, the sendHandler argument can be used to pass the handle of a\nsocket to the child process. The example below spawns two children that each\nhandle connections with "normal" or "special" priority:

                                        \n
                                        const { fork } = require('child_process');\nconst normal = fork('subprocess.js', ['normal']);\nconst special = fork('subprocess.js', ['special']);\n\n// Open up the server and send sockets to child\nconst server = require('net').createServer();\nserver.on('connection', (socket) => {\n\n  // If this is special priority\n  if (socket.remoteAddress === '74.125.127.100') {\n    special.send('socket', socket);\n    return;\n  }\n  // This is normal priority\n  normal.send('socket', socket);\n});\nserver.listen(1337);\n
                                        \n

                                        The subprocess.js would receive the socket handle as the second argument\npassed to the event callback function:

                                        \n
                                        process.on('message', (m, socket) => {\n  if (m === 'socket') {\n    socket.end(`Request handled with ${process.argv[2]} priority`);\n  }\n});\n
                                        \n

                                        Once a socket has been passed to a child, the parent is no longer capable of\ntracking when the socket is destroyed. To indicate this, the .connections\nproperty becomes null. It is recommended not to use .maxConnections when\nthis occurs.

                                        \n

                                        Note: this function uses JSON.stringify() internally to serialize the\nmessage.

                                        \n

                                        \n" } ] } @@ -7839,6 +7878,7 @@ { "textRaw": "Cluster", "name": "cluster", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        A single instance of Node.js runs in a single thread. To take advantage of\nmulti-core systems the user will sometimes want to launch a cluster of Node.js\nprocesses to handle the load.

                                        \n

                                        The cluster module allows you to easily create child processes that\nall share server ports.

                                        \n
                                        const cluster = require('cluster');\nconst http = require('http');\nconst numCPUs = require('os').cpus().length;\n\nif (cluster.isMaster) {\n  console.log(`Master ${process.pid} is running`);\n\n  // Fork workers.\n  for (let i = 0; i < numCPUs; i++) {\n    cluster.fork();\n  }\n\n  cluster.on('exit', (worker, code, signal) => {\n    console.log(`worker ${worker.process.pid} died`);\n  });\n} else {\n  // Workers can share any TCP connection\n  // In this case it is an HTTP server\n  http.createServer((req, res) => {\n    res.writeHead(200);\n    res.end('hello world\\n');\n  }).listen(8000);\n\n  console.log(`Worker ${process.pid} started`);\n}\n
                                        \n

                                        Running Node.js will now share port 8000 between the workers:

                                        \n
                                        $ node server.js\nMaster 3596 is running\nWorker 4324 started\nWorker 4520 started\nWorker 6056 started\nWorker 5644 started\n
                                        \n

                                        Please note that on Windows, it is not yet possible to set up a named pipe\nserver in a worker.

                                        \n", @@ -8467,6 +8507,7 @@ { "textRaw": "Console", "name": "console", + "introduced_in": "v0.10.13", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The console module provides a simple debugging console that is similar to the\nJavaScript console mechanism provided by web browsers.

                                        \n

                                        The module exports two specific components:

                                        \n
                                          \n
                                        • A Console class with methods such as console.log(), console.error() and\nconsole.warn() that can be used to write to any Node.js stream.
                                        • \n
                                        • A global console instance configured to write to process.stdout and\nprocess.stderr. The global console can be used without calling\nrequire('console').
                                        • \n
                                        \n

                                        Warning: The global console object's methods are neither consistently\nsynchronous like the browser APIs they resemble, nor are they consistently\nasynchronous like all other Node.js streams. See the note on process I/O for\nmore information.

                                        \n

                                        Example using the global console:

                                        \n
                                        console.log('hello world');\n// Prints: hello world, to stdout\nconsole.log('hello %s', 'world');\n// Prints: hello world, to stdout\nconsole.error(new Error('Whoops, something bad happened'));\n// Prints: [Error: Whoops, something bad happened], to stderr\n\nconst name = 'Will Robinson';\nconsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to stderr\n
                                        \n

                                        Example using the Console class:

                                        \n
                                        const out = getStreamSomehow();\nconst err = getStreamSomehow();\nconst myConsole = new console.Console(out, err);\n\nmyConsole.log('hello world');\n// Prints: hello world, to out\nmyConsole.log('hello %s', 'world');\n// Prints: hello world, to out\nmyConsole.error(new Error('Whoops, something bad happened'));\n// Prints: [Error: Whoops, something bad happened], to err\n\nconst name = 'Will Robinson';\nmyConsole.warn(`Danger ${name}! Danger!`);\n// Prints: Danger Will Robinson! Danger!, to err\n
                                        \n", @@ -8620,7 +8661,7 @@ "v0.1.100" ] }, - "desc": "

                                        Prints to stdout with newline. Multiple arguments can be passed, with the\nfirst used as the primary message and all additional used as substitution\nvalues similar to printf(3) (the arguments are all passed to\nutil.format()).

                                        \n
                                        const count = 5;\nconsole.log('count: %d', count);\n// Prints: count: 5, to stdout\nconsole.log('count:', count);\n// Prints: count: 5, to stdout\n
                                        \n

                                        If formatting elements (e.g. %d) are not found in the first string then\nutil.inspect() is called on each argument and the resulting string\nvalues are concatenated. See util.format() for more information.

                                        \n", + "desc": "

                                        Prints to stdout with newline. Multiple arguments can be passed, with the\nfirst used as the primary message and all additional used as substitution\nvalues similar to printf(3) (the arguments are all passed to\nutil.format()).

                                        \n
                                        const count = 5;\nconsole.log('count: %d', count);\n// Prints: count: 5, to stdout\nconsole.log('count:', count);\n// Prints: count: 5, to stdout\n
                                        \n

                                        See util.format() for more information.

                                        \n", "signatures": [ { "params": [ @@ -8766,6 +8807,7 @@ { "textRaw": "Crypto", "name": "crypto", + "introduced_in": "v0.3.6", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The crypto module provides cryptographic functionality that includes a set of\nwrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions.

                                        \n

                                        Use require('crypto') to access this module.

                                        \n
                                        const crypto = require('crypto');\n\nconst secret = 'abcdefg';\nconst hash = crypto.createHmac('sha256', secret)\n                   .update('I love cupcakes')\n                   .digest('hex');\nconsole.log(hash);\n// Prints:\n//   c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e\n
                                        \n", @@ -9359,7 +9401,7 @@ "v0.5.8" ] }, - "desc": "

                                        Generates cryptographically strong pseudo-random data. The size argument\nis a number indicating the number of bytes to generate.

                                        \n

                                        If a callback function is provided, the bytes are generated asynchronously\nand the callback function is invoked with two arguments: err and buf.\nIf an error occurs, err will be an Error object; otherwise it is null. The\nbuf argument is a Buffer containing the generated bytes.

                                        \n
                                        // Asynchronous\nconst crypto = require('crypto');\ncrypto.randomBytes(256, (err, buf) => {\n  if (err) throw err;\n  console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`);\n});\n
                                        \n

                                        If the callback function is not provided, the random bytes are generated\nsynchronously and returned as a Buffer. An error will be thrown if\nthere is a problem generating the bytes.

                                        \n
                                        // Synchronous\nconst buf = crypto.randomBytes(256);\nconsole.log(\n  `${buf.length} bytes of random data: ${buf.toString('hex')}`);\n
                                        \n

                                        The crypto.randomBytes() method will block until there is sufficient entropy.\nThis should normally never take longer than a few milliseconds. The only time\nwhen generating the random bytes may conceivably block for a longer period of\ntime is right after boot, when the whole system is still low on entropy.

                                        \n", + "desc": "

                                        Generates cryptographically strong pseudo-random data. The size argument\nis a number indicating the number of bytes to generate.

                                        \n

                                        If a callback function is provided, the bytes are generated asynchronously\nand the callback function is invoked with two arguments: err and buf.\nIf an error occurs, err will be an Error object; otherwise it is null. The\nbuf argument is a Buffer containing the generated bytes.

                                        \n
                                        // Asynchronous\nconst crypto = require('crypto');\ncrypto.randomBytes(256, (err, buf) => {\n  if (err) throw err;\n  console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`);\n});\n
                                        \n

                                        If the callback function is not provided, the random bytes are generated\nsynchronously and returned as a Buffer. An error will be thrown if\nthere is a problem generating the bytes.

                                        \n
                                        // Synchronous\nconst buf = crypto.randomBytes(256);\nconsole.log(\n  `${buf.length} bytes of random data: ${buf.toString('hex')}`);\n
                                        \n

                                        The crypto.randomBytes() method will not complete until there is\nsufficient entropy available.\nThis should normally never take longer than a few milliseconds. The only time\nwhen generating the random bytes may conceivably block for a longer period of\ntime is right after boot, when the whole system is still low on entropy.

                                        \n", "signatures": [ { "params": [ @@ -10011,7 +10053,7 @@ "v0.11.14" ] }, - "desc": "

                                        The ECDH class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH)\nkey exchanges.

                                        \n

                                        Instances of the ECDH class can be created using the\ncrypto.createECDH() function.

                                        \n
                                        const crypto = require('crypto');\nconst assert = require('assert');\n\n// Generate Alice's keys...\nconst alice = crypto.createECDH('secp521r1');\nconst aliceKey = alice.generateKeys();\n\n// Generate Bob's keys...\nconst bob = crypto.createECDH('secp521r1');\nconst bobKey = bob.generateKeys();\n\n// Exchange and generate the secret...\nconst aliceSecret = alice.computeSecret(bobKey);\nconst bobSecret = bob.computeSecret(aliceKey);\n\nassert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));\n  // OK\n
                                        \n", + "desc": "

                                        The ECDH class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH)\nkey exchanges.

                                        \n

                                        Instances of the ECDH class can be created using the\ncrypto.createECDH() function.

                                        \n
                                        const crypto = require('crypto');\nconst assert = require('assert');\n\n// Generate Alice's keys...\nconst alice = crypto.createECDH('secp521r1');\nconst aliceKey = alice.generateKeys();\n\n// Generate Bob's keys...\nconst bob = crypto.createECDH('secp521r1');\nconst bobKey = bob.generateKeys();\n\n// Exchange and generate the secret...\nconst aliceSecret = alice.computeSecret(bobKey);\nconst bobSecret = bob.computeSecret(aliceKey);\n\nassert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));\n// OK\n
                                        \n", "methods": [ { "textRaw": "ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding])", @@ -10176,7 +10218,7 @@ "v0.1.92" ] }, - "desc": "

                                        The Hash class is a utility for creating hash digests of data. It can be\nused in one of two ways:

                                        \n
                                          \n
                                        • As a stream that is both readable and writable, where data is written\nto produce a computed hash digest on the readable side, or
                                        • \n
                                        • Using the hash.update() and hash.digest() methods to produce the\ncomputed hash.
                                        • \n
                                        \n

                                        The crypto.createHash() method is used to create Hash instances. Hash\nobjects are not to be created directly using the new keyword.

                                        \n

                                        Example: Using Hash objects as streams:

                                        \n
                                        const crypto = require('crypto');\nconst hash = crypto.createHash('sha256');\n\nhash.on('readable', () => {\n  const data = hash.read();\n  if (data)\n    console.log(data.toString('hex'));\n    // Prints:\n    //   6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\n});\n\nhash.write('some data to hash');\nhash.end();\n
                                        \n

                                        Example: Using Hash and piped streams:

                                        \n
                                        const crypto = require('crypto');\nconst fs = require('fs');\nconst hash = crypto.createHash('sha256');\n\nconst input = fs.createReadStream('test.js');\ninput.pipe(hash).pipe(process.stdout);\n
                                        \n

                                        Example: Using the hash.update() and hash.digest() methods:

                                        \n
                                        const crypto = require('crypto');\nconst hash = crypto.createHash('sha256');\n\nhash.update('some data to hash');\nconsole.log(hash.digest('hex'));\n// Prints:\n//   6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\n
                                        \n", + "desc": "

                                        The Hash class is a utility for creating hash digests of data. It can be\nused in one of two ways:

                                        \n
                                          \n
                                        • As a stream that is both readable and writable, where data is written\nto produce a computed hash digest on the readable side, or
                                        • \n
                                        • Using the hash.update() and hash.digest() methods to produce the\ncomputed hash.
                                        • \n
                                        \n

                                        The crypto.createHash() method is used to create Hash instances. Hash\nobjects are not to be created directly using the new keyword.

                                        \n

                                        Example: Using Hash objects as streams:

                                        \n
                                        const crypto = require('crypto');\nconst hash = crypto.createHash('sha256');\n\nhash.on('readable', () => {\n  const data = hash.read();\n  if (data) {\n    console.log(data.toString('hex'));\n    // Prints:\n    //   6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\n  }\n});\n\nhash.write('some data to hash');\nhash.end();\n
                                        \n

                                        Example: Using Hash and piped streams:

                                        \n
                                        const crypto = require('crypto');\nconst fs = require('fs');\nconst hash = crypto.createHash('sha256');\n\nconst input = fs.createReadStream('test.js');\ninput.pipe(hash).pipe(process.stdout);\n
                                        \n

                                        Example: Using the hash.update() and hash.digest() methods:

                                        \n
                                        const crypto = require('crypto');\nconst hash = crypto.createHash('sha256');\n\nhash.update('some data to hash');\nconsole.log(hash.digest('hex'));\n// Prints:\n//   6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50\n
                                        \n", "methods": [ { "textRaw": "hash.digest([encoding])", @@ -10234,7 +10276,7 @@ "v0.1.94" ] }, - "desc": "

                                        The Hmac Class is a utility for creating cryptographic HMAC digests. It can\nbe used in one of two ways:

                                        \n
                                          \n
                                        • As a stream that is both readable and writable, where data is written\nto produce a computed HMAC digest on the readable side, or
                                        • \n
                                        • Using the hmac.update() and hmac.digest() methods to produce the\ncomputed HMAC digest.
                                        • \n
                                        \n

                                        The crypto.createHmac() method is used to create Hmac instances. Hmac\nobjects are not to be created directly using the new keyword.

                                        \n

                                        Example: Using Hmac objects as streams:

                                        \n
                                        const crypto = require('crypto');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nhmac.on('readable', () => {\n  const data = hmac.read();\n  if (data)\n    console.log(data.toString('hex'));\n    // Prints:\n    //   7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e\n});\n\nhmac.write('some data to hash');\nhmac.end();\n
                                        \n

                                        Example: Using Hmac and piped streams:

                                        \n
                                        const crypto = require('crypto');\nconst fs = require('fs');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nconst input = fs.createReadStream('test.js');\ninput.pipe(hmac).pipe(process.stdout);\n
                                        \n

                                        Example: Using the hmac.update() and hmac.digest() methods:

                                        \n
                                        const crypto = require('crypto');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nhmac.update('some data to hash');\nconsole.log(hmac.digest('hex'));\n// Prints:\n//   7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e\n
                                        \n", + "desc": "

                                        The Hmac Class is a utility for creating cryptographic HMAC digests. It can\nbe used in one of two ways:

                                        \n
                                          \n
                                        • As a stream that is both readable and writable, where data is written\nto produce a computed HMAC digest on the readable side, or
                                        • \n
                                        • Using the hmac.update() and hmac.digest() methods to produce the\ncomputed HMAC digest.
                                        • \n
                                        \n

                                        The crypto.createHmac() method is used to create Hmac instances. Hmac\nobjects are not to be created directly using the new keyword.

                                        \n

                                        Example: Using Hmac objects as streams:

                                        \n
                                        const crypto = require('crypto');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nhmac.on('readable', () => {\n  const data = hmac.read();\n  if (data) {\n    console.log(data.toString('hex'));\n    // Prints:\n    //   7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e\n  }\n});\n\nhmac.write('some data to hash');\nhmac.end();\n
                                        \n

                                        Example: Using Hmac and piped streams:

                                        \n
                                        const crypto = require('crypto');\nconst fs = require('fs');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nconst input = fs.createReadStream('test.js');\ninput.pipe(hmac).pipe(process.stdout);\n
                                        \n

                                        Example: Using the hmac.update() and hmac.digest() methods:

                                        \n
                                        const crypto = require('crypto');\nconst hmac = crypto.createHmac('sha256', 'a secret');\n\nhmac.update('some data to hash');\nconsole.log(hmac.digest('hex'));\n// Prints:\n//   7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e\n
                                        \n", "methods": [ { "textRaw": "hmac.digest([encoding])", @@ -10415,6 +10457,7 @@ { "textRaw": "UDP / Datagram Sockets", "name": "dgram", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The dgram module provides an implementation of UDP Datagram sockets.

                                        \n
                                        const dgram = require('dgram');\nconst server = dgram.createSocket('udp4');\n\nserver.on('error', (err) => {\n  console.log(`server error:\\n${err.stack}`);\n  server.close();\n});\n\nserver.on('message', (msg, rinfo) => {\n  console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);\n});\n\nserver.on('listening', () => {\n  const address = server.address();\n  console.log(`server listening ${address.address}:${address.port}`);\n});\n\nserver.bind(41234);\n// server listening 0.0.0.0:41234\n
                                        \n", @@ -11059,6 +11102,7 @@ { "textRaw": "DNS", "name": "dns", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The dns module contains functions belonging to two different categories:

                                        \n

                                        1) Functions that use the underlying operating system facilities to perform\nname resolution, and that do not necessarily perform any network communication.\nThis category contains only one function: dns.lookup(). Developers\nlooking to perform name resolution in the same way that other applications on\nthe same operating system behave should use dns.lookup().

                                        \n

                                        For example, looking up iana.org.

                                        \n
                                        const dns = require('dns');\n\ndns.lookup('nodejs.org', (err, addresses, family) => {\n  console.log('addresses:', addresses);\n});\n// address: "192.0.43.8" family: IPv4\n
                                        \n

                                        2) Functions that connect to an actual DNS server to perform name resolution,\nand that always use the network to perform DNS queries. This category\ncontains all functions in the dns module except dns.lookup(). These\nfunctions do not use the same set of configuration files used by\ndns.lookup() (e.g. /etc/hosts). These functions should be used by\ndevelopers who do not want to use the underlying operating system's facilities\nfor name resolution, and instead want to always perform DNS queries.

                                        \n

                                        Below is an example that resolves 'archive.org' then reverse resolves the IP\naddresses that are returned.

                                        \n
                                        const dns = require('dns');\n\ndns.resolve4('archive.org', (err, addresses) => {\n  if (err) throw err;\n\n  console.log(`addresses: ${JSON.stringify(addresses)}`);\n\n  addresses.forEach((a) => {\n    dns.reverse(a, (err, hostnames) => {\n      if (err) {\n        throw err;\n      }\n      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);\n    });\n  });\n});\n
                                        \n

                                        There are subtle consequences in choosing one over the other, please consult\nthe Implementation considerations section for more information.

                                        \n", @@ -11522,6 +11566,7 @@ { "textRaw": "Domain", "name": "domain", + "introduced_in": "v0.10.0", "stability": 0, "stabilityText": "Deprecated", "desc": "

                                        This module is pending deprecation. Once a replacement API has been\nfinalized, this module will be fully deprecated. Most end users should\nnot have cause to use this module. Users who absolutely must have\nthe functionality that domains provide may rely on it for the time being\nbut should expect to have to migrate to a different solution\nin the future.

                                        \n

                                        Domains provide a way to handle multiple different IO operations as a\nsingle group. If any of the event emitters or callbacks registered to a\ndomain emit an 'error' event, or throw an error, then the domain object\nwill be notified, rather than losing the context of the error in the\nprocess.on('uncaughtException') handler, or causing the program to\nexit immediately with an error code.

                                        \n", @@ -11775,6 +11820,7 @@ { "textRaw": "Events", "name": "Events", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "type": "module", @@ -12243,6 +12289,7 @@ { "textRaw": "File System", "name": "fs", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        File I/O is provided by simple wrappers around standard POSIX functions. To\nuse this module do require('fs'). All the methods have asynchronous and\nsynchronous forms.

                                        \n

                                        The asynchronous form always takes a completion callback as its last argument.\nThe arguments passed to the completion callback depend on the method, but the\nfirst argument is always reserved for an exception. If the operation was\ncompleted successfully, then the first argument will be null or undefined.

                                        \n

                                        When using the synchronous form any exceptions are immediately thrown.\nYou can use try/catch to handle exceptions or allow them to bubble up.

                                        \n

                                        Here is an example of the asynchronous version:

                                        \n
                                        const fs = require('fs');\n\nfs.unlink('/tmp/hello', (err) => {\n  if (err) throw err;\n  console.log('successfully deleted /tmp/hello');\n});\n
                                        \n

                                        Here is the synchronous version:

                                        \n
                                        const fs = require('fs');\n\nfs.unlinkSync('/tmp/hello');\nconsole.log('successfully deleted /tmp/hello');\n
                                        \n

                                        With the asynchronous methods there is no guaranteed ordering. So the\nfollowing is prone to error:

                                        \n
                                        fs.rename('/tmp/hello', '/tmp/world', (err) => {\n  if (err) throw err;\n  console.log('renamed complete');\n});\nfs.stat('/tmp/world', (err, stats) => {\n  if (err) throw err;\n  console.log(`stats: ${JSON.stringify(stats)}`);\n});\n
                                        \n

                                        It could be that fs.stat is executed before fs.rename.\nThe correct way to do this is to chain the callbacks.

                                        \n
                                        fs.rename('/tmp/hello', '/tmp/world', (err) => {\n  if (err) throw err;\n  fs.stat('/tmp/world', (err, stats) => {\n    if (err) throw err;\n    console.log(`stats: ${JSON.stringify(stats)}`);\n  });\n});\n
                                        \n

                                        In busy processes, the programmer is strongly encouraged to use the\nasynchronous versions of these calls. The synchronous versions will block\nthe entire process until they complete--halting all connections.

                                        \n

                                        The relative path to a filename can be used. Remember, however, that this path\nwill be relative to process.cwd().

                                        \n

                                        Most fs functions let you omit the callback argument. If you do, a default\ncallback is used that rethrows errors. To get a trace to the original call\nsite, set the NODE_DEBUG environment variable:

                                        \n
                                        $ cat script.js\nfunction bad() {\n  require('fs').readFile('/');\n}\nbad();\n\n$ env NODE_DEBUG=fs node script.js\nfs.js:88\n        throw backtrace;\n        ^\nError: EISDIR: illegal operation on a directory, read\n    <stack trace.>\n
                                        \n", @@ -12319,7 +12366,7 @@ ] }, "params": [], - "desc": "

                                        Emitted when something changes in a watched directory or file.\nSee more details in fs.watch().

                                        \n

                                        The filename argument may not be provided depending on operating system\nsupport. If filename is provided, it will be provided as a Buffer if\nfs.watch() is called with its encoding option set to 'buffer', otherwise\nfilename will be a string.

                                        \n
                                        // Example when handled through fs.watch listener\nfs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {\n  if (filename)\n    console.log(filename);\n    // Prints: <Buffer ...>\n});\n
                                        \n" + "desc": "

                                        Emitted when something changes in a watched directory or file.\nSee more details in fs.watch().

                                        \n

                                        The filename argument may not be provided depending on operating system\nsupport. If filename is provided, it will be provided as a Buffer if\nfs.watch() is called with its encoding option set to 'buffer', otherwise\nfilename will be a string.

                                        \n
                                        // Example when handled through fs.watch listener\nfs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {\n  if (filename)\n    console.log(filename);\n  // Prints: <Buffer ...>\n});\n
                                        \n" }, { "textRaw": "Event: 'error'", @@ -13700,7 +13747,7 @@ ] } ], - "desc": "

                                        Change the file timestamps of a file referenced by the supplied file\ndescriptor.

                                        \n" + "desc": "

                                        Change the file timestamps of a file referenced by the supplied file\ndescriptor.

                                        \n

                                        Note: This function does not work on AIX versions before 7.1, it will return\nthe error UV_ENOSYS.

                                        \n" }, { "textRaw": "fs.futimesSync(fd, atime, mtime)", @@ -14316,7 +14363,7 @@ ] } ], - "desc": "

                                        Asynchronous file open. See open(2). flags can be:

                                        \n
                                          \n
                                        • 'r' - Open file for reading.\nAn exception occurs if the file does not exist.

                                          \n
                                        • \n
                                        • 'r+' - Open file for reading and writing.\nAn exception occurs if the file does not exist.

                                          \n
                                        • \n
                                        • 'rs+' - Open file for reading and writing in synchronous mode. Instructs\nthe operating system to bypass the local file system cache.

                                          \n

                                          This is primarily useful for opening files on NFS mounts as it allows you to\nskip the potentially stale local cache. It has a very real impact on I/O\nperformance so don't use this flag unless you need it.

                                          \n

                                          Note that this doesn't turn fs.open() into a synchronous blocking call.\nIf that's what you want then you should be using fs.openSync()

                                          \n
                                        • \n
                                        • 'w' - Open file for writing.\nThe file is created (if it does not exist) or truncated (if it exists).

                                          \n
                                        • \n
                                        • 'wx' - Like 'w' but fails if path exists.

                                          \n
                                        • \n
                                        • 'w+' - Open file for reading and writing.\nThe file is created (if it does not exist) or truncated (if it exists).

                                          \n
                                        • \n
                                        • 'wx+' - Like 'w+' but fails if path exists.

                                          \n
                                        • \n
                                        • 'a' - Open file for appending.\nThe file is created if it does not exist.

                                          \n
                                        • \n
                                        • 'ax' - Like 'a' but fails if path exists.

                                          \n
                                        • \n
                                        • 'a+' - Open file for reading and appending.\nThe file is created if it does not exist.

                                          \n
                                        • \n
                                        • 'ax+' - Like 'a+' but fails if path exists.

                                          \n
                                        • \n
                                        \n

                                        mode sets the file mode (permission and sticky bits), but only if the file was\ncreated. It defaults to 0666, readable and writable.

                                        \n

                                        The callback gets two arguments (err, fd).

                                        \n

                                        The exclusive flag 'x' (O_EXCL flag in open(2)) ensures that path is newly\ncreated. On POSIX systems, path is considered to exist even if it is a symlink\nto a non-existent file. The exclusive flag may or may not work with network file\nsystems.

                                        \n

                                        flags can also be a number as documented by open(2); commonly used constants\nare available from fs.constants. On Windows, flags are translated to\ntheir equivalent ones where applicable, e.g. O_WRONLY to FILE_GENERIC_WRITE,\nor O_EXCL|O_CREAT to CREATE_NEW, as accepted by CreateFileW.

                                        \n

                                        On Linux, positional writes don't work when the file is opened in append mode.\nThe kernel ignores the position argument and always appends the data to\nthe end of the file.

                                        \n

                                        Note: The behavior of fs.open() is platform-specific for some flags. As such,\nopening a directory on macOS and Linux with the 'a+' flag - see example\nbelow - will return an error. In contrast, on Windows and FreeBSD, a file\ndescriptor will be returned.

                                        \n
                                        // macOS and Linux\nfs.open('<directory>', 'a+', (err, fd) => {\n  // => [Error: EISDIR: illegal operation on a directory, open <directory>]\n});\n\n// Windows and FreeBSD\nfs.open('<directory>', 'a+', (err, fd) => {\n  // => null, <fd>\n});\n
                                        \n" + "desc": "

                                        Asynchronous file open. See open(2). flags can be:

                                        \n
                                          \n
                                        • 'r' - Open file for reading.\nAn exception occurs if the file does not exist.

                                          \n
                                        • \n
                                        • 'r+' - Open file for reading and writing.\nAn exception occurs if the file does not exist.

                                          \n
                                        • \n
                                        • 'rs+' - Open file for reading and writing in synchronous mode. Instructs\nthe operating system to bypass the local file system cache.

                                          \n

                                          This is primarily useful for opening files on NFS mounts as it allows you to\nskip the potentially stale local cache. It has a very real impact on I/O\nperformance so don't use this flag unless you need it.

                                          \n

                                          Note that this doesn't turn fs.open() into a synchronous blocking call.\nIf that's what you want then you should be using fs.openSync()

                                          \n
                                        • \n
                                        • 'w' - Open file for writing.\nThe file is created (if it does not exist) or truncated (if it exists).

                                          \n
                                        • \n
                                        • 'wx' - Like 'w' but fails if path exists.

                                          \n
                                        • \n
                                        • 'w+' - Open file for reading and writing.\nThe file is created (if it does not exist) or truncated (if it exists).

                                          \n
                                        • \n
                                        • 'wx+' - Like 'w+' but fails if path exists.

                                          \n
                                        • \n
                                        • 'a' - Open file for appending.\nThe file is created if it does not exist.

                                          \n
                                        • \n
                                        • 'ax' - Like 'a' but fails if path exists.

                                          \n
                                        • \n
                                        • 'a+' - Open file for reading and appending.\nThe file is created if it does not exist.

                                          \n
                                        • \n
                                        • 'ax+' - Like 'a+' but fails if path exists.

                                          \n
                                        • \n
                                        \n

                                        mode sets the file mode (permission and sticky bits), but only if the file was\ncreated. It defaults to 0666, readable and writable.

                                        \n

                                        The callback gets two arguments (err, fd).

                                        \n

                                        The exclusive flag 'x' (O_EXCL flag in open(2)) ensures that path is newly\ncreated. On POSIX systems, path is considered to exist even if it is a symlink\nto a non-existent file. The exclusive flag may or may not work with network file\nsystems.

                                        \n

                                        flags can also be a number as documented by open(2); commonly used constants\nare available from fs.constants. On Windows, flags are translated to\ntheir equivalent ones where applicable, e.g. O_WRONLY to FILE_GENERIC_WRITE,\nor O_EXCL|O_CREAT to CREATE_NEW, as accepted by CreateFileW.

                                        \n

                                        On Linux, positional writes don't work when the file is opened in append mode.\nThe kernel ignores the position argument and always appends the data to\nthe end of the file.

                                        \n

                                        Note: The behavior of fs.open() is platform-specific for some flags. As such,\nopening a directory on macOS and Linux with the 'a+' flag - see example\nbelow - will return an error. In contrast, on Windows and FreeBSD, a file\ndescriptor will be returned.

                                        \n
                                        // macOS and Linux\nfs.open('<directory>', 'a+', (err, fd) => {\n  // => [Error: EISDIR: illegal operation on a directory, open <directory>]\n});\n\n// Windows and FreeBSD\nfs.open('<directory>', 'a+', (err, fd) => {\n  // => null, <fd>\n});\n
                                        \n

                                        Some characters (< > : " / \\ | ? *) are reserved under Windows as documented\nby Naming Files, Paths, and Namespaces. Under NTFS, if the filename contains\na colon, Node.js will open a file system stream, as described by\nthis MSDN page.

                                        \n

                                        Functions based on fs.open() exhibit this behavior as well. eg.\nfs.writeFile(), fs.readFile(), etc.

                                        \n" }, { "textRaw": "fs.openSync(path, flags[, mode])", @@ -14432,7 +14479,7 @@ ] } ], - "desc": "

                                        Read data from the file specified by fd.

                                        \n

                                        buffer is the buffer that the data will be written to.

                                        \n

                                        offset is the offset in the buffer to start writing at.

                                        \n

                                        length is an integer specifying the number of bytes to read.

                                        \n

                                        position is an integer specifying where to begin reading from in the file.\nIf position is null, data will be read from the current file position.

                                        \n

                                        The callback is given the three arguments, (err, bytesRead, buffer).

                                        \n" + "desc": "

                                        Read data from the file specified by fd.

                                        \n

                                        buffer is the buffer that the data will be written to.

                                        \n

                                        offset is the offset in the buffer to start writing at.

                                        \n

                                        length is an integer specifying the number of bytes to read.

                                        \n

                                        position is an argument specifying where to begin reading from in the file.\nIf position is null, data will be read from the current file position,\nand the file position will be updated.\nIf position is an integer, the file position will remain unchanged.

                                        \n

                                        The callback is given the three arguments, (err, bytesRead, buffer).

                                        \n" }, { "textRaw": "fs.readdir(path[, options], callback)", @@ -15035,7 +15082,7 @@ ] } ], - "desc": "

                                        Asynchronous rmdir(2). No arguments other than a possible exception are given\nto the completion callback.

                                        \n" + "desc": "

                                        Asynchronous rmdir(2). No arguments other than a possible exception are given\nto the completion callback.

                                        \n

                                        Note: Using fs.rmdir() on a file (not a directory) results in an ENOENT\nerror on Windows and an ENOTDIR error on POSIX.

                                        \n" }, { "textRaw": "fs.rmdirSync(path)", @@ -15064,7 +15111,7 @@ ] } ], - "desc": "

                                        Synchronous rmdir(2). Returns undefined.

                                        \n" + "desc": "

                                        Synchronous rmdir(2). Returns undefined.

                                        \n

                                        Note: Using fs.rmdirSync() on a file (not a directory) results in an ENOENT\nerror on Windows and an ENOTDIR error on POSIX.

                                        \n" }, { "textRaw": "fs.stat(path, callback)", @@ -16091,6 +16138,7 @@ { "textRaw": "HTTP", "name": "http", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        To use the HTTP server and client one must require('http').

                                        \n

                                        The HTTP interfaces in Node.js are designed to support many features\nof the protocol which have been traditionally difficult to use.\nIn particular, large, possibly chunk-encoded, messages. The interface is\ncareful to never buffer entire requests or responses--the\nuser is able to stream data.

                                        \n

                                        HTTP message headers are represented by an object like this:

                                        \n\n
                                        { 'content-length': '123',\n  'content-type': 'text/plain',\n  'connection': 'keep-alive',\n  'host': 'mysite.com',\n  'accept': '*/*' }\n
                                        \n

                                        Keys are lowercased. Values are not modified.

                                        \n

                                        In order to support the full spectrum of possible HTTP applications, Node.js's\nHTTP API is very low-level. It deals with stream handling and message\nparsing only. It parses a message into headers and body but it does not\nparse the actual headers or the body.

                                        \n

                                        See message.headers for details on how duplicate headers are handled.

                                        \n

                                        The raw headers as they were received are retained in the rawHeaders\nproperty, which is an array of [key, value, key2, value2, ...]. For\nexample, the previous message header object might have a rawHeaders\nlist like the following:

                                        \n\n
                                        [ 'ConTent-Length', '123456',\n  'content-LENGTH', '123',\n  'content-type', 'text/plain',\n  'CONNECTION', 'keep-alive',\n  'Host', 'mysite.com',\n  'accepT', '*/*' ]\n
                                        \n", @@ -16493,7 +16541,7 @@ ] } ], - "desc": "

                                        Finishes sending the request. If any parts of the body are\nunsent, it will flush them to the stream. If the request is\nchunked, this will send the terminating '0\\r\\n\\r\\n'.

                                        \n

                                        If data is specified, it is equivalent to calling\nresponse.write(data, encoding) followed by request.end(callback).

                                        \n

                                        If callback is specified, it will be called when the request stream\nis finished.

                                        \n" + "desc": "

                                        Finishes sending the request. If any parts of the body are\nunsent, it will flush them to the stream. If the request is\nchunked, this will send the terminating '0\\r\\n\\r\\n'.

                                        \n

                                        If data is specified, it is equivalent to calling\nrequest.write(data, encoding) followed by request.end(callback).

                                        \n

                                        If callback is specified, it will be called when the request stream\nis finished.

                                        \n" }, { "textRaw": "request.flushHeaders()", @@ -17835,7 +17883,7 @@ ] } ], - "desc": "

                                        Since most requests are GET requests without bodies, Node.js provides this\nconvenience method. The only difference between this method and\nhttp.request() is that it sets the method to GET and calls req.end()\nautomatically. Note that response data must be consumed in the callback\nfor reasons stated in http.ClientRequest section.

                                        \n

                                        The callback is invoked with a single argument that is an instance of\nhttp.IncomingMessage

                                        \n

                                        JSON Fetching Example:

                                        \n
                                        http.get('http://nodejs.org/dist/index.json', (res) => {\n  const statusCode = res.statusCode;\n  const contentType = res.headers['content-type'];\n\n  let error;\n  if (statusCode !== 200) {\n    error = new Error('Request Failed.\\n' +\n                      `Status Code: ${statusCode}`);\n  } else if (!/^application\\/json/.test(contentType)) {\n    error = new Error('Invalid content-type.\\n' +\n                      `Expected application/json but received ${contentType}`);\n  }\n  if (error) {\n    console.log(error.message);\n    // consume response data to free up memory\n    res.resume();\n    return;\n  }\n\n  res.setEncoding('utf8');\n  let rawData = '';\n  res.on('data', (chunk) => rawData += chunk);\n  res.on('end', () => {\n    try {\n      const parsedData = JSON.parse(rawData);\n      console.log(parsedData);\n    } catch (e) {\n      console.log(e.message);\n    }\n  });\n}).on('error', (e) => {\n  console.log(`Got error: ${e.message}`);\n});\n
                                        \n" + "desc": "

                                        Since most requests are GET requests without bodies, Node.js provides this\nconvenience method. The only difference between this method and\nhttp.request() is that it sets the method to GET and calls req.end()\nautomatically. Note that the callback must take care to consume the response\ndata for reasons stated in http.ClientRequest section.

                                        \n

                                        The callback is invoked with a single argument that is an instance of\nhttp.IncomingMessage

                                        \n

                                        JSON Fetching Example:

                                        \n
                                        http.get('http://nodejs.org/dist/index.json', (res) => {\n  const statusCode = res.statusCode;\n  const contentType = res.headers['content-type'];\n\n  let error;\n  if (statusCode !== 200) {\n    error = new Error('Request Failed.\\n' +\n                      `Status Code: ${statusCode}`);\n  } else if (!/^application\\/json/.test(contentType)) {\n    error = new Error('Invalid content-type.\\n' +\n                      `Expected application/json but received ${contentType}`);\n  }\n  if (error) {\n    console.log(error.message);\n    // consume response data to free up memory\n    res.resume();\n    return;\n  }\n\n  res.setEncoding('utf8');\n  let rawData = '';\n  res.on('data', (chunk) => rawData += chunk);\n  res.on('end', () => {\n    try {\n      const parsedData = JSON.parse(rawData);\n      console.log(parsedData);\n    } catch (e) {\n      console.log(e.message);\n    }\n  });\n}).on('error', (e) => {\n  console.log(`Got error: ${e.message}`);\n});\n
                                        \n" }, { "textRaw": "http.request(options[, callback])", @@ -17992,6 +18040,7 @@ { "textRaw": "HTTPS", "name": "https", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a\nseparate module.

                                        \n", @@ -18355,7 +18404,7 @@ ] } ], - "desc": "

                                        Makes a request to a secure web server.

                                        \n

                                        The following additional options from tls.connect() are also accepted when using a\n custom Agent:\n pfx, key, passphrase, cert, ca, ciphers, rejectUnauthorized, secureProtocol, servername

                                        \n

                                        options can be an object or a string. If options is a string, it is\nautomatically parsed with url.parse().

                                        \n

                                        Example:

                                        \n
                                        const https = require('https');\n\nconst options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET'\n};\n\nconst req = https.request(options, (res) => {\n  console.log('statusCode:', res.statusCode);\n  console.log('headers:', res.headers);\n\n  res.on('data', (d) => {\n    process.stdout.write(d);\n  });\n});\n\nreq.on('error', (e) => {\n  console.error(e);\n});\nreq.end();\n
                                        \n

                                        Example using options from tls.connect():

                                        \n
                                        const options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET',\n  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),\n  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')\n};\noptions.agent = new https.Agent(options);\n\nconst req = https.request(options, (res) => {\n  // ...\n});\n
                                        \n

                                        Alternatively, opt out of connection pooling by not using an Agent.

                                        \n

                                        Example:

                                        \n
                                        const options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET',\n  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),\n  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),\n  agent: false\n};\n\nconst req = https.request(options, (res) => {\n  // ...\n});\n
                                        \n\n\n" + "desc": "

                                        Makes a request to a secure web server.

                                        \n

                                        The following additional options from tls.connect() are also accepted when using a\n custom Agent:\n pfx, key, passphrase, cert, ca, ciphers, rejectUnauthorized, secureProtocol, servername

                                        \n

                                        options can be an object or a string. If options is a string, it is\nautomatically parsed with url.parse().

                                        \n

                                        Example:

                                        \n
                                        const https = require('https');\n\nconst options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET'\n};\n\nconst req = https.request(options, (res) => {\n  console.log('statusCode:', res.statusCode);\n  console.log('headers:', res.headers);\n\n  res.on('data', (d) => {\n    process.stdout.write(d);\n  });\n});\n\nreq.on('error', (e) => {\n  console.error(e);\n});\nreq.end();\n
                                        \n

                                        Example using options from tls.connect():

                                        \n
                                        const options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET',\n  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),\n  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')\n};\noptions.agent = new https.Agent(options);\n\nconst req = https.request(options, (res) => {\n  // ...\n});\n
                                        \n

                                        Alternatively, opt out of connection pooling by not using an Agent.

                                        \n

                                        Example:

                                        \n
                                        const options = {\n  hostname: 'encrypted.google.com',\n  port: 443,\n  path: '/',\n  method: 'GET',\n  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),\n  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),\n  agent: false\n};\n\nconst req = https.request(options, (res) => {\n  // ...\n});\n
                                        \n\n\n" } ], "properties": [ @@ -18374,8 +18423,71 @@ "displayName": "HTTPS" }, { + "textRaw": "Internationalization Support", + "name": "internationalization_support", + "desc": "

                                        Node.js has many features that make it easier to write internationalized\nprograms. Some of them are:

                                        \n\n

                                        Node.js (and its underlying V8 engine) uses ICU to implement these features\nin native C/C++ code. However, some of them require a very large ICU data file\nin order to support all locales of the world. Because it is expected that most\nNode.js users will make use of only a small portion of ICU functionality, only\na subset of the full ICU data set is provided by Node.js by default. Several\noptions are provided for customizing and expanding the ICU data set either when\nbuilding or running Node.js.

                                        \n", + "properties": [ + { + "textRaw": "Options for building Node.js", + "name": "js", + "desc": "

                                        To control how ICU is used in Node.js, four configure options are available\nduring compilation. Additional details on how to compile Node.js are documented\nin BUILDING.md.

                                        \n
                                          \n
                                        • --with-intl=none / --without-intl
                                        • \n
                                        • --with-intl=system-icu
                                        • \n
                                        • --with-intl=small-icu (default)
                                        • \n
                                        • --with-intl=full-icu
                                        • \n
                                        \n

                                        An overview of available Node.js and JavaScript features for each configure\noption:

                                        \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
                                        nonesystem-icusmall-icufull-icu
                                        String.prototype.normalize()none (function is no-op)fullfullfull
                                        String.prototype.to*Case()fullfullfullfull
                                        Intlnone (object does not exist)partial/full (depends on OS)partial (English-only)full
                                        String.prototype.localeCompare()partial (not locale-aware)fullfullfull
                                        String.prototype.toLocale*Case()partial (not locale-aware)fullfullfull
                                        Number.prototype.toLocaleString()partial (not locale-aware)partial/full (depends on OS)partial (English-only)full
                                        Date.prototype.toLocale*String()partial (not locale-aware)partial/full (depends on OS)partial (English-only)full
                                        \n

                                        Note: The "(not locale-aware)" designation denotes that the function carries\nout its operation just like the non-Locale version of the function, if one\nexists. For example, under none mode, Date.prototype.toLocaleString()'s\noperation is identical to that of Date.prototype.toString().

                                        \n", + "modules": [ + { + "textRaw": "Disable all internationalization features (`none`)", + "name": "disable_all_internationalization_features_(`none`)", + "desc": "

                                        If this option is chosen, most internationalization features mentioned above\nwill be unavailable in the resulting node binary.

                                        \n", + "type": "module", + "displayName": "Disable all internationalization features (`none`)" + }, + { + "textRaw": "Build with a pre-installed ICU (`system-icu`)", + "name": "build_with_a_pre-installed_icu_(`system-icu`)", + "desc": "

                                        Node.js can link against an ICU build already installed on the system. In fact,\nmost Linux distributions already come with ICU installed, and this option would\nmake it possible to reuse the same set of data used by other components in the\nOS.

                                        \n

                                        Functionalities that only require the ICU library itself, such as\nString.prototype.normalize(), are fully supported under system-icu.\nFeatures that require ICU locale data in addition, such as\nIntl.DateTimeFormat may be fully or partially supported, depending on\nthe completeness of the ICU data installed on the system.

                                        \n", + "type": "module", + "displayName": "Build with a pre-installed ICU (`system-icu`)" + }, + { + "textRaw": "Embed a limited set of ICU data (`small-icu`)", + "name": "embed_a_limited_set_of_icu_data_(`small-icu`)", + "desc": "

                                        This option makes the resulting binary link against the ICU library statically,\nand includes a subset of ICU data (typically only the English locale) within\nthe node executable.

                                        \n

                                        Functionalities that only require the ICU library itself, such as\nString.prototype.normalize(), are fully supported under small-icu.\nFeatures that require ICU locale data in addition, such as\nIntl.DateTimeFormat, generally only work with the English locale:

                                        \n
                                        const january = new Date(9e8);\nconst english = new Intl.DateTimeFormat('en', { month: 'long' });\nconst spanish = new Intl.DateTimeFormat('es', { month: 'long' });\n\nconsole.log(english.format(january));\n// Prints "January"\nconsole.log(spanish.format(january));\n// Prints "January" or "M01" on small-icu\n// Should print "enero"\n
                                        \n

                                        This mode provides a good balance between features and binary size, and it is\nthe default behavior if no --with-intl flag is passed. The official binaries\nare also built in this mode.

                                        \n", + "modules": [ + { + "textRaw": "Providing ICU data at runtime", + "name": "providing_icu_data_at_runtime", + "desc": "

                                        If the small-icu option is used, one can still provide additional locale data\nat runtime so that the JS methods would work for all ICU locales. Assuming the\ndata file is stored at /some/directory, it can be made available to ICU\nthrough either:

                                        \n
                                          \n
                                        • The NODE_ICU_DATA environment variable:

                                          \n
                                          env NODE_ICU_DATA=/some/directory node\n
                                          \n
                                        • \n
                                        • The --icu-data-dir CLI parameter:

                                          \n
                                          node --icu-data-dir=/some/directory\n
                                          \n
                                        • \n
                                        \n

                                        (If both are specified, the --icu-data-dir CLI parameter takes precedence.)

                                        \n

                                        ICU is able to automatically find and load a variety of data formats, but the\ndata must be appropriate for the ICU version, and the file correctly named.\nThe most common name for the data file is icudt5X[bl].dat, where 5X denotes\nthe intended ICU version, and b or l indicates the system's endianness.\nCheck "ICU Data" article in the ICU User Guide for other supported formats\nand more details on ICU data in general.

                                        \n

                                        The full-icu npm module can greatly simplify ICU data installation by\ndetecting the ICU version of the running node executable and downloading the\nappropriate data file. After installing the module through npm i full-icu,\nthe data file will be available at ./node_modules/full-icu. This path can be\nthen passed either to NODE_ICU_DATA or --icu-data-dir as shown above to\nenable full Intl support.

                                        \n", + "type": "module", + "displayName": "Providing ICU data at runtime" + } + ], + "type": "module", + "displayName": "Embed a limited set of ICU data (`small-icu`)" + }, + { + "textRaw": "Embed the entire ICU (`full-icu`)", + "name": "embed_the_entire_icu_(`full-icu`)", + "desc": "

                                        This option makes the resulting binary link against ICU statically and include\na full set of ICU data. A binary created this way has no further external\ndependencies and supports all locales, but might be rather large. See\nBUILDING.md on how to compile a binary using this mode.

                                        \n", + "type": "module", + "displayName": "Embed the entire ICU (`full-icu`)" + } + ] + } + ], + "modules": [ + { + "textRaw": "Detecting internationalization support", + "name": "detecting_internationalization_support", + "desc": "

                                        To verify that ICU is enabled at all (system-icu, small-icu, or\nfull-icu), simply checking the existence of Intl should suffice:

                                        \n
                                        const hasICU = typeof Intl === 'object';\n
                                        \n

                                        Alternatively, checking for process.versions.icu, a property defined only\nwhen ICU is enabled, works too:

                                        \n
                                        const hasICU = typeof process.versions.icu === 'string';\n
                                        \n

                                        To check for support for a non-English locale (i.e. full-icu or\nsystem-icu), Intl.DateTimeFormat can be a good distinguishing factor:

                                        \n
                                        const hasFullICU = (() => {\n  try {\n    const january = new Date(9e8);\n    const spanish = new Intl.DateTimeFormat('es', { month: 'long' });\n    return spanish.format(january) === 'enero';\n  } catch (err) {\n    return false;\n  }\n})();\n
                                        \n

                                        For more verbose tests for Intl support, the following resources may be found\nto be helpful:

                                        \n
                                          \n
                                        • btest402: Generally used to check whether Node.js with Intl support is\nbuilt correctly.
                                        • \n
                                        • Test262: ECMAScript's official conformance test suite includes a section\ndedicated to ECMA-402.
                                        • \n
                                        \n\n\n", + "type": "module", + "displayName": "Detecting internationalization support" + } + ], + "type": "module", + "displayName": "Internationalization Support" + }, + { "textRaw": "Modules", "name": "module", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        Node.js has a simple module loading system. In Node.js, files and modules\nare in one-to-one correspondence (each file is treated as a separate module).

                                        \n

                                        As an example, consider a file named foo.js:

                                        \n
                                        const circle = require('./circle.js');\nconsole.log(`The area of a circle of radius 4 is ${circle.area(4)}`);\n
                                        \n

                                        On the first line, foo.js loads the module circle.js that is in the same\ndirectory as foo.js.

                                        \n

                                        Here are the contents of circle.js:

                                        \n
                                        const { PI } = Math;\n\nexports.area = (r) => PI * r * r;\n\nexports.circumference = (r) => 2 * PI * r;\n
                                        \n

                                        The module circle.js has exported the functions area() and\ncircumference(). To add functions and objects to the root of your module,\nyou can add them to the special exports object.

                                        \n

                                        Variables local to the module will be private, because the module is wrapped\nin a function by Node.js (see module wrapper).\nIn this example, the variable PI is private to circle.js.

                                        \n

                                        If you want the root of your module's export to be a function (such as a\nconstructor) or if you want to export a complete object in one assignment\ninstead of building it one property at a time, assign it to module.exports\ninstead of exports.

                                        \n

                                        Below, bar.js makes use of the square module, which exports a constructor:

                                        \n
                                        const square = require('./square.js');\nconst mySquare = square(2);\nconsole.log(`The area of my square is ${mySquare.area()}`);\n
                                        \n

                                        The square module is defined in square.js:

                                        \n
                                        // assigning to exports will not modify module, must use module.exports\nmodule.exports = (width) => {\n  return {\n    area: () => width * width\n  };\n};\n
                                        \n

                                        The module system is implemented in the require('module') module.

                                        \n", @@ -18594,6 +18706,7 @@ { "textRaw": "Net", "name": "net", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The net module provides you with an asynchronous network wrapper. It contains\nfunctions for creating both servers and clients (called streams). You can include\nthis module with require('net');.

                                        \n", @@ -18913,7 +19026,7 @@ ] } ], - "desc": "

                                        Start a local socket server listening for connections on the given path.

                                        \n

                                        This function is asynchronous. When the server has been bound,\n'listening' event will be emitted. The last parameter callback\nwill be added as a listener for the 'listening' event.

                                        \n

                                        On UNIX, the local domain is usually known as the UNIX domain. The path is a\nfilesystem path name. It gets truncated to sizeof(sockaddr_un.sun_path)\nbytes, decreased by 1. It varies on different operating system between 91 and\n107 bytes. The typical values are 107 on Linux and 103 on OS X. The path is\nsubject to the same naming conventions and permissions checks as would be done\non file creation, will be visible in the filesystem, and will persist until\nunlinked.

                                        \n

                                        On Windows, the local domain is implemented using a named pipe. The path must\nrefer to an entry in \\\\?\\pipe\\ or \\\\.\\pipe\\. Any characters are permitted,\nbut the latter may do some processing of pipe names, such as resolving ..\nsequences. Despite appearances, the pipe name space is flat. Pipes will not\npersist, they are removed when the last reference to them is closed. Do not\nforget JavaScript string escaping requires paths to be specified with\ndouble-backslashes, such as:

                                        \n
                                        net.createServer().listen(\n    path.join('\\\\\\\\?\\\\pipe', process.cwd(), 'myctl'));\n
                                        \n

                                        The parameter backlog behaves the same as in\nserver.listen([port][, hostname][, backlog][, callback]).

                                        \n

                                        Note: The server.listen() method may be called multiple times. Each\nsubsequent call will re-open the server using the provided options.

                                        \n" + "desc": "

                                        Start a local socket server listening for connections on the given path.

                                        \n

                                        This function is asynchronous. When the server has been bound,\n'listening' event will be emitted. The last parameter callback\nwill be added as a listener for the 'listening' event.

                                        \n

                                        On UNIX, the local domain is usually known as the UNIX domain. The path is a\nfilesystem path name. It gets truncated to sizeof(sockaddr_un.sun_path)\nbytes, decreased by 1. It varies on different operating system between 91 and\n107 bytes. The typical values are 107 on Linux and 103 on OS X. The path is\nsubject to the same naming conventions and permissions checks as would be done\non file creation, will be visible in the filesystem, and will persist until\nunlinked.

                                        \n

                                        On Windows, the local domain is implemented using a named pipe. The path must\nrefer to an entry in \\\\?\\pipe\\ or \\\\.\\pipe\\. Any characters are permitted,\nbut the latter may do some processing of pipe names, such as resolving ..\nsequences. Despite appearances, the pipe name space is flat. Pipes will not\npersist, they are removed when the last reference to them is closed. Do not\nforget JavaScript string escaping requires paths to be specified with\ndouble-backslashes, such as:

                                        \n
                                        net.createServer().listen(\n  path.join('\\\\\\\\?\\\\pipe', process.cwd(), 'myctl'));\n
                                        \n

                                        The parameter backlog behaves the same as in\nserver.listen([port][, hostname][, backlog][, callback]).

                                        \n

                                        Note: The server.listen() method may be called multiple times. Each\nsubsequent call will re-open the server using the provided options.

                                        \n" }, { "textRaw": "server.listen([port][, hostname][, backlog][, callback])", @@ -19978,6 +20091,7 @@ { "textRaw": "OS", "name": "os", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The os module provides a number of operating system-related utility methods.\nIt can be accessed using:

                                        \n
                                        const os = require('os');\n
                                        \n", @@ -20002,7 +20116,7 @@ "v6.3.0" ] }, - "desc": "

                                        Returns an object containing commonly used operating system specific constants\nfor error codes, process signals, and so on. The specific constants currently\ndefined are described in OS Constants.

                                        \n" + "desc": "

                                        Returns an object containing commonly used operating system specific constants\nfor error codes, process signals, and so on. The specific constants currently\ndefined are described in OS Constants.

                                        \n" } ], "methods": [ @@ -20442,6 +20556,7 @@ { "textRaw": "Path", "name": "path", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The path module provides utilities for working with file and directory paths.\nIt can be accessed using:

                                        \n
                                        const path = require('path');\n
                                        \n", @@ -20808,7 +20923,7 @@ ] } ], - "desc": "

                                        The path.relative() method returns the relative path from from to to based\non the current working directory. If from and to each resolve to the same\npath (after calling path.resolve() on each), a zero-length string is returned.

                                        \n

                                        If a zero-length string is passed as from or to, the current working\ndirectory will be used instead of the zero-length strings.

                                        \n

                                        For example on POSIX:

                                        \n
                                        path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');\n// Returns: '../../impl/bbb'\n
                                        \n

                                        On Windows:

                                        \n
                                        path.relative('C:\\\\orandea\\\\test\\\\aaa', 'C:\\\\orandea\\\\impl\\\\bbb');\n// Returns: '..\\\\..\\\\impl\\\\bbb'\n
                                        \n

                                        A TypeError is thrown if neither from nor to is a string.

                                        \n" + "desc": "

                                        The path.relative() method returns the relative path from from to to based\non the current working directory. If from and to each resolve to the same\npath (after calling path.resolve() on each), a zero-length string is returned.

                                        \n

                                        If a zero-length string is passed as from or to, the current working\ndirectory will be used instead of the zero-length strings.

                                        \n

                                        For example on POSIX:

                                        \n
                                        path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');\n// Returns: '../../impl/bbb'\n
                                        \n

                                        On Windows:

                                        \n
                                        path.relative('C:\\\\orandea\\\\test\\\\aaa', 'C:\\\\orandea\\\\impl\\\\bbb');\n// Returns: '..\\\\..\\\\impl\\\\bbb'\n
                                        \n

                                        A TypeError is thrown if either from or to is not a string.

                                        \n" }, { "textRaw": "path.resolve([...paths])", @@ -20900,6 +21015,7 @@ { "textRaw": "Punycode", "name": "punycode", + "introduced_in": "v0.10.0", "stability": 0, "stabilityText": "Deprecated", "desc": "

                                        The version of the punycode module bundled in Node.js is being deprecated.\nIn a future major version of Node.js this module will be removed. Users\ncurrently depending on the punycode module should switch to using the\nuserland-provided Punycode.js module instead.

                                        \n

                                        The punycode module is a bundled version of the Punycode.js module. It\ncan be accessed using:

                                        \n
                                        const punycode = require('punycode');\n
                                        \n

                                        Punycode is a character encoding scheme defined by RFC 3492 that is\nprimarily intended for use in Internationalized Domain Names. Because host\nnames in URLs are limited to ASCII characters only, Domain Names that contain\nnon-ASCII characters must be converted into ASCII using the Punycode scheme.\nFor instance, the Japanese character that translates into the English word,\n'example' is '例'. The Internationalized Domain Name, '例.com' (equivalent\nto 'example.com') is represented by Punycode as the ASCII string\n'xn--fsq.com'.

                                        \n

                                        The punycode module provides a simple implementation of the Punycode standard.

                                        \n

                                        Note: The punycode module is a third-party dependency used by Node.js and\nmade available to developers as a convenience. Fixes or other modifications to\nthe module must be directed to the Punycode.js project.

                                        \n", @@ -21074,6 +21190,7 @@ { "textRaw": "Query String", "name": "querystring", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The querystring module provides utilities for parsing and formatting URL\nquery strings. It can be accessed using:

                                        \n
                                        const querystring = require('querystring');\n
                                        \n", @@ -21181,7 +21298,7 @@ ] } ], - "desc": "

                                        The querystring.parse() method parses a URL query string (str) into a\ncollection of key and value pairs.

                                        \n

                                        For example, the query string 'foo=bar&abc=xyz&abc=123' is parsed into:

                                        \n\n
                                        {\n  foo: 'bar',\n  abc: ['xyz', '123']\n}\n
                                        \n

                                        Note: The object returned by the querystring.parse() method does not\nprototypically extend from the JavaScript Object. This means that the\ntypical Object methods such as obj.toString(), obj.hasOwnProperty(),\nand others are not defined and will not work.

                                        \n

                                        By default, percent-encoded characters within the query string will be assumed\nto use UTF-8 encoding. If an alternative character encoding is used, then an\nalternative decodeURIComponent option will need to be specified as illustrated\nin the following example:

                                        \n
                                        // Assuming gbkDecodeURIComponent function already exists...\n\nquerystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,\n  { decodeURIComponent: gbkDecodeURIComponent });\n
                                        \n" + "desc": "

                                        The querystring.parse() method parses a URL query string (str) into a\ncollection of key and value pairs.

                                        \n

                                        For example, the query string 'foo=bar&abc=xyz&abc=123' is parsed into:

                                        \n\n
                                        {\n  foo: 'bar',\n  abc: ['xyz', '123']\n}\n
                                        \n

                                        Note: The object returned by the querystring.parse() method does not\nprototypically extend from the JavaScript Object. This means that the\ntypical Object methods such as obj.toString(), obj.hasOwnProperty(),\nand others are not defined and will not work.

                                        \n

                                        By default, percent-encoded characters within the query string will be assumed\nto use UTF-8 encoding. If an alternative character encoding is used, then an\nalternative decodeURIComponent option will need to be specified as illustrated\nin the following example:

                                        \n
                                        // Assuming gbkDecodeURIComponent function already exists...\n\nquerystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,\n                  { decodeURIComponent: gbkDecodeURIComponent });\n
                                        \n" }, { "textRaw": "querystring.stringify(obj[, sep[, eq[, options]]])", @@ -21250,7 +21367,7 @@ ] } ], - "desc": "

                                        The querystring.stringify() method produces a URL query string from a\ngiven obj by iterating through the object's "own properties".

                                        \n

                                        It serializes the following types of values passed in obj:\n{string|number|boolean|string[]|number[]|boolean[]}\nAny other input values will be coerced to empty strings.

                                        \n

                                        For example:

                                        \n
                                        querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });\n// returns 'foo=bar&baz=qux&baz=quux&corge='\n\nquerystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');\n// returns 'foo:bar;baz:qux'\n
                                        \n

                                        By default, characters requiring percent-encoding within the query string will\nbe encoded as UTF-8. If an alternative encoding is required, then an alternative\nencodeURIComponent option will need to be specified as illustrated in the\nfollowing example:

                                        \n
                                        // Assuming gbkEncodeURIComponent function already exists,\n\nquerystring.stringify({ w: '中文', foo: 'bar' }, null, null,\n  { encodeURIComponent: gbkEncodeURIComponent });\n
                                        \n" + "desc": "

                                        The querystring.stringify() method produces a URL query string from a\ngiven obj by iterating through the object's "own properties".

                                        \n

                                        It serializes the following types of values passed in obj:\n{string|number|boolean|string[]|number[]|boolean[]}\nAny other input values will be coerced to empty strings.

                                        \n

                                        For example:

                                        \n
                                        querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });\n// returns 'foo=bar&baz=qux&baz=quux&corge='\n\nquerystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');\n// returns 'foo:bar;baz:qux'\n
                                        \n

                                        By default, characters requiring percent-encoding within the query string will\nbe encoded as UTF-8. If an alternative encoding is required, then an alternative\nencodeURIComponent option will need to be specified as illustrated in the\nfollowing example:

                                        \n
                                        // Assuming gbkEncodeURIComponent function already exists,\n\nquerystring.stringify({ w: '中文', foo: 'bar' }, null, null,\n                      { encodeURIComponent: gbkEncodeURIComponent });\n
                                        \n" }, { "textRaw": "querystring.unescape(str)", @@ -21288,6 +21405,7 @@ { "textRaw": "Readline", "name": "readline", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The readline module provides an interface for reading data from a Readable\nstream (such as process.stdin) one line at a time. It can be accessed using:

                                        \n
                                        const readline = require('readline');\n
                                        \n

                                        The following simple example illustrates the basic use of the readline module.

                                        \n
                                        const readline = require('readline');\n\nconst rl = readline.createInterface({\n  input: process.stdin,\n  output: process.stdout\n});\n\nrl.question('What do you think of Node.js? ', (answer) => {\n  // TODO: Log the answer in a database\n  console.log(`Thank you for your valuable feedback: ${answer}`);\n\n  rl.close();\n});\n
                                        \n

                                        Note Once this code is invoked, the Node.js application will not\nterminate until the readline.Interface is closed because the interface\nwaits for data to be received on the input stream.

                                        \n", @@ -21740,10 +21858,10 @@ "desc": "the prompt string to use. Default: `'> '`" }, { - "textRaw": "`crlfDelay` {number} If the delay between `\\r` and `\\n` exceeds `crlfDelay` milliseconds, both `\\r` and `\\n` will be treated as separate end-of-line input. Default to `100` milliseconds. `crlfDelay` will be coerced to `[100, 2000]` range. ", + "textRaw": "`crlfDelay` {number} If the delay between `\\r` and `\\n` exceeds `crlfDelay` milliseconds, both `\\r` and `\\n` will be treated as separate end-of-line input. Default to `100` milliseconds. `crlfDelay` will be coerced to a number no less than `100`. It can be set to `Infinity`, in which case `\\r` followed by `\\n` will always be considered a single newline. ", "name": "crlfDelay", "type": "number", - "desc": "If the delay between `\\r` and `\\n` exceeds `crlfDelay` milliseconds, both `\\r` and `\\n` will be treated as separate end-of-line input. Default to `100` milliseconds. `crlfDelay` will be coerced to `[100, 2000]` range." + "desc": "If the delay between `\\r` and `\\n` exceeds `crlfDelay` milliseconds, both `\\r` and `\\n` will be treated as separate end-of-line input. Default to `100` milliseconds. `crlfDelay` will be coerced to a number no less than `100`. It can be set to `Infinity`, in which case `\\r` followed by `\\n` will always be considered a single newline." }, { "textRaw": "`removeHistoryDuplicates` {boolean} If `true`, when a new input line added to the history list duplicates an older one, this removes the older line from the list. Defaults to `false`. ", @@ -21858,7 +21976,7 @@ ] } ], - "desc": "

                                        The readline.emitKeypressEvents() method causes the given Writable\nstream to begin emitting 'keypress' events corresponding to received input.

                                        \n

                                        Optionally, interface specifies a readline.Interface instance for which\nautocompletion is disabled when copy-pasted input is detected.

                                        \n

                                        If the stream is a TTY, then it must be in raw mode.

                                        \n
                                        readline.emitKeypressEvents(process.stdin);\nif (process.stdin.isTTY)\n  process.stdin.setRawMode(true);\n
                                        \n" + "desc": "

                                        The readline.emitKeypressEvents() method causes the given Writable\nstream to begin emitting 'keypress' events corresponding to received input.

                                        \n

                                        Optionally, interface specifies a readline.Interface instance for which\nautocompletion is disabled when copy-pasted input is detected.

                                        \n

                                        If the stream is a TTY, then it must be in raw mode.

                                        \n

                                        Note: This is automatically called by any readline instance on its input\nif the input is a terminal. Closing the readline instance does not stop\nthe input from emitting 'keypress' events.

                                        \n
                                        readline.emitKeypressEvents(process.stdin);\nif (process.stdin.isTTY)\n  process.stdin.setRawMode(true);\n
                                        \n" }, { "textRaw": "readline.moveCursor(stream, dx, dy)", @@ -21912,6 +22030,7 @@ { "textRaw": "REPL", "name": "repl", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The repl module provides a Read-Eval-Print-Loop (REPL) implementation that\nis available both as a standalone program or includible in other applications.\nIt can be accessed using:

                                        \n
                                        const repl = require('repl');\n
                                        \n", @@ -22033,7 +22152,7 @@ { "textRaw": "Using the Node.js REPL with advanced line-editors", "name": "using_the_node.js_repl_with_advanced_line-editors", - "desc": "

                                        For advanced line-editors, start Node.js with the environmental variable\nNODE_NO_READLINE=1. This will start the main and debugger REPL in canonical\nterminal settings which will allow you to use with rlwrap.

                                        \n

                                        For example, you could add this to your bashrc file:

                                        \n
                                        alias node="env NODE_NO_READLINE=1 rlwrap node"\n
                                        \n", + "desc": "

                                        For advanced line-editors, start Node.js with the environment variable\nNODE_NO_READLINE=1. This will start the main and debugger REPL in canonical\nterminal settings which will allow you to use with rlwrap.

                                        \n

                                        For example, you could add this to your bashrc file:

                                        \n
                                        alias node="env NODE_NO_READLINE=1 rlwrap node"\n
                                        \n", "type": "module", "displayName": "Using the Node.js REPL with advanced line-editors" }, @@ -22288,6 +22407,7 @@ { "textRaw": "Stream", "name": "stream", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        A stream is an abstract interface for working with streaming data in Node.js.\nThe stream module provides a base API that makes it easy to build objects\nthat implement the stream interface.

                                        \n

                                        There are many stream objects provided by Node.js. For instance, a\nrequest to an HTTP server and process.stdout\nare both stream instances.

                                        \n

                                        Streams can be readable, writable, or both. All streams are instances of\nEventEmitter.

                                        \n

                                        The stream module can be accessed using:

                                        \n
                                        const stream = require('stream');\n
                                        \n

                                        While it is important for all Node.js users to understand how streams work,\nthe stream module itself is most useful for developers that are creating new\ntypes of stream instances. Developers who are primarily consuming stream\nobjects will rarely (if ever) have need to use the stream module directly.

                                        \n", @@ -22317,7 +22437,7 @@ "textRaw": "Buffering", "name": "Buffering", "type": "misc", - "desc": "

                                        Both Writable and Readable streams will store data in an internal\nbuffer that can be retrieved using writable._writableState.getBuffer() or\nreadable._readableState.buffer, respectively.

                                        \n

                                        The amount of data potentially buffered depends on the highWaterMark option\npassed into the streams constructor. For normal streams, the highWaterMark\noption specifies a total number of bytes. For streams operating in object mode,\nthe highWaterMark specifies a total number of objects.

                                        \n

                                        Data is buffered in Readable streams when the implementation calls\nstream.push(chunk). If the consumer of the Stream does not\ncall stream.read(), the data will sit in the internal\nqueue until it is consumed.

                                        \n

                                        Once the total size of the internal read buffer reaches the threshold specified\nby highWaterMark, the stream will temporarily stop reading data from the\nunderlying resource until the data currently buffered can be consumed (that is,\nthe stream will stop calling the internal readable._read() method that is\nused to fill the read buffer).

                                        \n

                                        Data is buffered in Writable streams when the\nwritable.write(chunk) method is called repeatedly. While the\ntotal size of the internal write buffer is below the threshold set by\nhighWaterMark, calls to writable.write() will return true. Once\nthe size of the internal buffer reaches or exceeds the highWaterMark, false\nwill be returned.

                                        \n

                                        A key goal of the stream API, particularly the stream.pipe() method,\nis to limit the buffering of data to acceptable levels such that sources and\ndestinations of differing speeds will not overwhelm the available memory.

                                        \n

                                        Because Duplex and Transform streams are both Readable and Writable,\neach maintain two separate internal buffers used for reading and writing,\nallowing each side to operate independently of the other while maintaining an\nappropriate and efficient flow of data. For example, net.Socket instances\nare Duplex streams whose Readable side allows consumption of data received\nfrom the socket and whose Writable side allows writing data to the socket.\nBecause data may be written to the socket at a faster or slower rate than data\nis received, it is important for each side to operate (and buffer) independently\nof the other.

                                        \n" + "desc": "

                                        Both Writable and Readable streams will store data in an internal\nbuffer that can be retrieved using writable._writableState.getBuffer() or\nreadable._readableState.buffer, respectively.

                                        \n

                                        The amount of data potentially buffered depends on the highWaterMark option\npassed into the streams constructor. For normal streams, the highWaterMark\noption specifies a total number of bytes. For streams operating\nin object mode, the highWaterMark specifies a total number of objects.

                                        \n

                                        Data is buffered in Readable streams when the implementation calls\nstream.push(chunk). If the consumer of the Stream does not\ncall stream.read(), the data will sit in the internal\nqueue until it is consumed.

                                        \n

                                        Once the total size of the internal read buffer reaches the threshold specified\nby highWaterMark, the stream will temporarily stop reading data from the\nunderlying resource until the data currently buffered can be consumed (that is,\nthe stream will stop calling the internal readable._read() method that is\nused to fill the read buffer).

                                        \n

                                        Data is buffered in Writable streams when the\nwritable.write(chunk) method is called repeatedly. While the\ntotal size of the internal write buffer is below the threshold set by\nhighWaterMark, calls to writable.write() will return true. Once\nthe size of the internal buffer reaches or exceeds the highWaterMark, false\nwill be returned.

                                        \n

                                        A key goal of the stream API, particularly the stream.pipe() method,\nis to limit the buffering of data to acceptable levels such that sources and\ndestinations of differing speeds will not overwhelm the available memory.

                                        \n

                                        Because Duplex and Transform streams are both Readable and Writable,\neach maintain two separate internal buffers used for reading and writing,\nallowing each side to operate independently of the other while maintaining an\nappropriate and efficient flow of data. For example, net.Socket instances\nare Duplex streams whose Readable side allows consumption of data received\nfrom the socket and whose Writable side allows writing data to the socket.\nBecause data may be written to the socket at a faster or slower rate than data\nis received, it is important for each side to operate (and buffer) independently\nof the other.

                                        \n" } ], "type": "module", @@ -22837,7 +22957,7 @@ ] } ], - "desc": "

                                        The readable.read() method pulls some data out of the internal buffer and\nreturns it. If no data available to be read, null is returned. By default,\nthe data will be returned as a Buffer object unless an encoding has been\nspecified using the readable.setEncoding() method or the stream is operating\nin object mode.

                                        \n

                                        The optional size argument specifies a specific number of bytes to read. If\nsize bytes are not available to be read, null will be returned unless\nthe stream has ended, in which case all of the data remaining in the internal\nbuffer will be returned (even if it exceeds size bytes).

                                        \n

                                        If the size argument is not specified, all of the data contained in the\ninternal buffer will be returned.

                                        \n

                                        The readable.read() method should only be called on Readable streams operating\nin paused mode. In flowing mode, readable.read() is called automatically until\nthe internal buffer is fully drained.

                                        \n
                                        const readable = getReadableStreamSomehow();\nreadable.on('readable', () => {\n  let chunk;\n  while (null !== (chunk = readable.read())) {\n    console.log(`Received ${chunk.length} bytes of data.`);\n  }\n});\n
                                        \n

                                        In general, it is recommended that developers avoid the use of the 'readable'\nevent and the readable.read() method in favor of using either\nreadable.pipe() or the 'data' event.

                                        \n

                                        A Readable stream in object mode will always return a single item from\na call to readable.read(size), regardless of the value of the\nsize argument.

                                        \n

                                        Note: If the readable.read() method returns a chunk of data, a 'data'\nevent will also be emitted.

                                        \n

                                        Note: Calling stream.read([size]) after the 'end'\nevent has been emitted will return null. No runtime error will be raised.

                                        \n" + "desc": "

                                        The readable.read() method pulls some data out of the internal buffer and\nreturns it. If no data available to be read, null is returned. By default,\nthe data will be returned as a Buffer object unless an encoding has been\nspecified using the readable.setEncoding() method or the stream is operating\nin object mode.

                                        \n

                                        The optional size argument specifies a specific number of bytes to read. If\nsize bytes are not available to be read, null will be returned unless\nthe stream has ended, in which case all of the data remaining in the internal\nbuffer will be returned.

                                        \n

                                        If the size argument is not specified, all of the data contained in the\ninternal buffer will be returned.

                                        \n

                                        The readable.read() method should only be called on Readable streams operating\nin paused mode. In flowing mode, readable.read() is called automatically until\nthe internal buffer is fully drained.

                                        \n
                                        const readable = getReadableStreamSomehow();\nreadable.on('readable', () => {\n  let chunk;\n  while (null !== (chunk = readable.read())) {\n    console.log(`Received ${chunk.length} bytes of data.`);\n  }\n});\n
                                        \n

                                        In general, it is recommended that developers avoid the use of the 'readable'\nevent and the readable.read() method in favor of using either\nreadable.pipe() or the 'data' event.

                                        \n

                                        A Readable stream in object mode will always return a single item from\na call to readable.read(size), regardless of the value of the\nsize argument.

                                        \n

                                        Note: If the readable.read() method returns a chunk of data, a 'data'\nevent will also be emitted.

                                        \n

                                        Note: Calling stream.read([size]) after the 'end'\nevent has been emitted will return null. No runtime error will be raised.

                                        \n" }, { "textRaw": "readable.resume()", @@ -23217,10 +23337,10 @@ "textRaw": "`options` {Object} ", "options": [ { - "textRaw": "`highWaterMark` {number} The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams ", + "textRaw": "`highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams ", "name": "highWaterMark", "type": "number", - "desc": "The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams" + "desc": "The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams" }, { "textRaw": "`encoding` {string} If specified, then buffers will be decoded to strings using the specified encoding. Defaults to `null` ", @@ -23362,10 +23482,10 @@ "textRaw": "`options` {Object} Passed to both Writable and Readable constructors. Also has the following fields: ", "options": [ { - "textRaw": "`allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then the stream will automatically end the readable side when the writable side ends and vice versa. ", + "textRaw": "`allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then the stream will automatically end the writable side when the readable side ends. ", "name": "allowHalfOpen", "type": "boolean", - "desc": "Defaults to `true`. If set to `false`, then the stream will automatically end the readable side when the writable side ends and vice versa." + "desc": "Defaults to `true`. If set to `false`, then the stream will automatically end the writable side when the readable side ends." }, { "textRaw": "`readableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` for readable side of the stream. Has no effect if `objectMode` is `true`. ", @@ -23528,7 +23648,7 @@ ] } ], - "desc": "

                                        Note: This function MUST NOT be called by application code directly. It\nshould be implemented by child classes, and called only by the internal Readable\nclass methods only.

                                        \n

                                        All Transform stream implementations must provide a _transform()\nmethod to accept input and produce output. The transform._transform()\nimplementation handles the bytes being written, computes an output, then passes\nthat output off to the readable portion using the readable.push() method.

                                        \n

                                        The transform.push() method may be called zero or more times to generate\noutput from a single input chunk, depending on how much is to be output\nas a result of the chunk.

                                        \n

                                        It is possible that no output is generated from any given chunk of input data.

                                        \n

                                        The callback function must be called only when the current chunk is completely\nconsumed. The first argument passed to the callback must be an Error object\nif an error occurred while processing the input or null otherwise. If a second\nargument is passed to the callback, it will be forwarded on to the\nreadable.push() method. In other words the following are equivalent:

                                        \n
                                        transform.prototype._transform = function(data, encoding, callback) {\n  this.push(data);\n  callback();\n};\n\ntransform.prototype._transform = function(data, encoding, callback) {\n  callback(null, data);\n};\n
                                        \n

                                        The transform._transform() method is prefixed with an underscore because it\nis internal to the class that defines it, and should never be called directly by\nuser programs.

                                        \n" + "desc": "

                                        Note: This function MUST NOT be called by application code directly. It\nshould be implemented by child classes, and called only by the internal Readable\nclass methods only.

                                        \n

                                        All Transform stream implementations must provide a _transform()\nmethod to accept input and produce output. The transform._transform()\nimplementation handles the bytes being written, computes an output, then passes\nthat output off to the readable portion using the readable.push() method.

                                        \n

                                        The transform.push() method may be called zero or more times to generate\noutput from a single input chunk, depending on how much is to be output\nas a result of the chunk.

                                        \n

                                        It is possible that no output is generated from any given chunk of input data.

                                        \n

                                        The callback function must be called only when the current chunk is completely\nconsumed. The first argument passed to the callback must be an Error object\nif an error occurred while processing the input or null otherwise. If a second\nargument is passed to the callback, it will be forwarded on to the\nreadable.push() method. In other words the following are equivalent:

                                        \n
                                        transform.prototype._transform = function(data, encoding, callback) {\n  this.push(data);\n  callback();\n};\n\ntransform.prototype._transform = function(data, encoding, callback) {\n  callback(null, data);\n};\n
                                        \n

                                        The transform._transform() method is prefixed with an underscore because it\nis internal to the class that defines it, and should never be called directly by\nuser programs.

                                        \n

                                        transform._transform() is never called in parallel; streams implement a\nqueue mechanism, and to receive the next chunk, callback must be\ncalled, either synchronously or asynchronously.

                                        \n" } ], "modules": [ @@ -23574,9 +23694,16 @@ { "textRaw": "`readable.push('')`", "name": "`readable.push('')`", - "desc": "

                                        Use of readable.push('') is not recommended.

                                        \n

                                        Pushing a zero-byte string or Buffer to a stream that is not in object mode\nhas an interesting side effect. Because it is a call to\nreadable.push(), the call will end the reading process.\nHowever, because the argument is an empty string, no data is added to the\nreadable buffer so there is nothing for a user to consume.

                                        \n\n\n", + "desc": "

                                        Use of readable.push('') is not recommended.

                                        \n

                                        Pushing a zero-byte string or Buffer to a stream that is not in object mode\nhas an interesting side effect. Because it is a call to\nreadable.push(), the call will end the reading process.\nHowever, because the argument is an empty string, no data is added to the\nreadable buffer so there is nothing for a user to consume.

                                        \n", "type": "misc", "displayName": "`readable.push('')`" + }, + { + "textRaw": "`highWaterMark` discrepency after calling `readable.setEncoding()`", + "name": "`highwatermark`_discrepency_after_calling_`readable.setencoding()`", + "desc": "

                                        The use of readable.setEncoding() will change the behavior of how the\nhighWaterMark operates in non-object mode.

                                        \n

                                        Typically, the size of the current buffer is measured against the\nhighWaterMark in bytes. However, after setEncoding() is called, the\ncomparison function will begin to measure the buffer's size in characters.

                                        \n

                                        This is not a problem in common cases with latin1 or ascii. But it is\nadvised to be mindful about this behavior when working with strings that could\ncontain multi-byte characters.

                                        \n\n\n", + "type": "misc", + "displayName": "`highWaterMark` discrepency after calling `readable.setEncoding()`" } ] } @@ -23587,6 +23714,7 @@ { "textRaw": "String Decoder", "name": "string_decoder", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The string_decoder module provides an API for decoding Buffer objects into\nstrings in a manner that preserves encoded multi-byte UTF-8 and UTF-16\ncharacters. It can be accessed using:

                                        \n
                                        const StringDecoder = require('string_decoder').StringDecoder;\n
                                        \n

                                        The following example shows the basic use of the StringDecoder class.

                                        \n
                                        const StringDecoder = require('string_decoder').StringDecoder;\nconst decoder = new StringDecoder('utf8');\n\nconst cent = Buffer.from([0xC2, 0xA2]);\nconsole.log(decoder.write(cent));\n\nconst euro = Buffer.from([0xE2, 0x82, 0xAC]);\nconsole.log(decoder.write(euro));\n
                                        \n

                                        When a Buffer instance is written to the StringDecoder instance, an\ninternal buffer is used to ensure that the decoded string does not contain\nany incomplete multibyte characters. These are held in the buffer until the\nnext call to stringDecoder.write() or until stringDecoder.end() is called.

                                        \n

                                        In the following example, the three UTF-8 encoded bytes of the European Euro\nsymbol () are written over three separate operations:

                                        \n
                                        const StringDecoder = require('string_decoder').StringDecoder;\nconst decoder = new StringDecoder('utf8');\n\ndecoder.write(Buffer.from([0xE2]));\ndecoder.write(Buffer.from([0x82]));\nconsole.log(decoder.end(Buffer.from([0xAC])));\n
                                        \n", @@ -23673,6 +23801,7 @@ { "textRaw": "Timers", "name": "timers", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The timer module exposes a global API for scheduling functions to\nbe called at some future period of time. Because the timer functions are\nglobals, there is no need to call require('timers') to use the API.

                                        \n

                                        The timer functions within Node.js implement a similar API as the timers API\nprovided by Web Browsers but use a different internal implementation that is\nbuilt around the Node.js Event Loop.

                                        \n", @@ -23981,6 +24110,7 @@ { "textRaw": "TLS (SSL)", "name": "tls_(ssl)", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The tls module provides an implementation of the Transport Layer Security\n(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.\nThe module can be accessed using:

                                        \n
                                        const tls = require('tls');\n
                                        \n", @@ -25400,6 +25530,7 @@ { "textRaw": "TTY", "name": "tty", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The tty module provides the tty.ReadStream and tty.WriteStream classes.\nIn most cases, it will not be necessary or possible to use this module directly.\nHowever, it can be accessed using:

                                        \n
                                        const tty = require('tty');\n
                                        \n

                                        When Node.js detects that it is being run inside a text terminal ("TTY")\ncontext, the process.stdin will, by default, be initialized as an instance of\ntty.ReadStream and both process.stdout and process.stderr will, by\ndefault be instances of tty.WriteStream. The preferred method of determining\nwhether Node.js is being run within a TTY context is to check that the value of\nthe process.stdout.isTTY property is true:

                                        \n
                                        $ node -p -e "Boolean(process.stdout.isTTY)"\ntrue\n$ node -p -e "Boolean(process.stdout.isTTY)" | cat\nfalse\n
                                        \n

                                        In most cases, there should be little to no reason for an application to\ncreate instances of the tty.ReadStream and tty.WriteStream classes.

                                        \n", @@ -25469,7 +25600,7 @@ "v0.7.7" ] }, - "desc": "

                                        The 'resize' event is emitted whenever either of the writeStream.columns\nor writeStream.rows properties have changed. No arguments are passed to the\nlistener callback when called.

                                        \n
                                        process.stdout.on('resize', () => {\n  console.log('screen size has changed!');\n  console.log(`${process.stdout.columns}x${process.stdout.rows}`);\n});\n
                                        \n", + "desc": "

                                        The 'resize' event is emitted whenever either of the writeStream.columns\nor writeStream.rows properties have changed. No arguments are passed to the\nlistener callback when called.

                                        \n
                                        process.stdout.on('resize', () => {\n  console.log('screen size has changed!');\n  console.log(`${process.stdout.columns}x${process.stdout.rows}`);\n});\n
                                        \n

                                        Note: On Windows resize events will be emitted only if stdin is unpaused\n(by a call to resume() or by adding a data listener) and in raw mode. It can\nalso be triggered if a terminal control sequence that moves the cursor is\nwritten to the screen. Also, the resize event will only be signaled if the\nconsole screen buffer height was also changed. For example shrinking the\nconsole window height will not cause the resize event to be emitted. Increasing\nthe console window height will only be registered when the new console window\nheight is greater than the current console buffer size.

                                        \n", "params": [] } ], @@ -25535,6 +25666,7 @@ { "textRaw": "URL", "name": "url", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The url module provides utilities for URL resolution and parsing. It can be\naccessed using:

                                        \n
                                        const url = require('url');\n
                                        \n", @@ -25745,6 +25877,7 @@ { "textRaw": "Util", "name": "util", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The util module is primarily designed to support the needs of Node.js' own\ninternal APIs. However, many of the utilities are useful for application and\nmodule developers as well. It can be accessed using:

                                        \n
                                        const util = require('util');\n
                                        \n", @@ -25844,7 +25977,7 @@ ] } ], - "desc": "

                                        The util.format() method returns a formatted string using the first argument\nas a printf-like format.

                                        \n

                                        The first argument is a string containing zero or more placeholder tokens.\nEach placeholder token is replaced with the converted value from the\ncorresponding argument. Supported placeholders are:

                                        \n
                                          \n
                                        • %s - String.
                                        • \n
                                        • %d - Number (both integer and float).
                                        • \n
                                        • %j - JSON. Replaced with the string '[Circular]' if the argument\ncontains circular references.
                                        • \n
                                        • %% - single percent sign ('%'). This does not consume an argument.
                                        • \n
                                        \n

                                        If the placeholder does not have a corresponding argument, the placeholder is\nnot replaced.

                                        \n
                                        util.format('%s:%s', 'foo');\n// Returns: 'foo:%s'\n
                                        \n

                                        If there are more arguments passed to the util.format() method than the\nnumber of placeholders, the extra arguments are coerced into strings (for\nobjects and symbols, util.inspect() is used) then concatenated to the\nreturned string, each delimited by a space.

                                        \n
                                        util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'\n
                                        \n

                                        If the first argument is not a format string then util.format() returns\na string that is the concatenation of all arguments separated by spaces.\nEach argument is converted to a string using util.inspect().

                                        \n
                                        util.format(1, 2, 3); // '1 2 3'\n
                                        \n

                                        If only one argument is passed to util.format(), it is returned as it is\nwithout any formatting.

                                        \n
                                        util.format('%% %s'); // '%% %s'\n
                                        \n" + "desc": "

                                        The util.format() method returns a formatted string using the first argument\nas a printf-like format.

                                        \n

                                        The first argument is a string containing zero or more placeholder tokens.\nEach placeholder token is replaced with the converted value from the\ncorresponding argument. Supported placeholders are:

                                        \n
                                          \n
                                        • %s - String.
                                        • \n
                                        • %d - Number (both integer and float).
                                        • \n
                                        • %j - JSON. Replaced with the string '[Circular]' if the argument\ncontains circular references.
                                        • \n
                                        • %% - single percent sign ('%'). This does not consume an argument.
                                        • \n
                                        \n

                                        If the placeholder does not have a corresponding argument, the placeholder is\nnot replaced.

                                        \n
                                        util.format('%s:%s', 'foo');\n// Returns: 'foo:%s'\n
                                        \n

                                        If there are more arguments passed to the util.format() method than the number\nof placeholders, the extra arguments are coerced into strings then concatenated\nto the returned string, each delimited by a space. Excessive arguments whose\ntypeof is 'object' or 'symbol' (except null) will be transformed by\nutil.inspect().

                                        \n
                                        util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'\n
                                        \n

                                        If the first argument is not a string then util.format() returns\na string that is the concatenation of all arguments separated by spaces.\nEach argument is converted to a string using util.inspect().

                                        \n
                                        util.format(1, 2, 3); // '1 2 3'\n
                                        \n

                                        If only one argument is passed to util.format(), it is returned as it is\nwithout any formatting.

                                        \n
                                        util.format('%% %s'); // '%% %s'\n
                                        \n" }, { "textRaw": "util.inherits(constructor, superConstructor)", @@ -26707,6 +26840,7 @@ { "textRaw": "V8", "name": "v8", + "introduced_in": "v4.0.0", "desc": "

                                        The v8 module exposes APIs that are specific to the version of V8\nbuilt into the Node.js binary. It can be accessed using:

                                        \n
                                        const v8 = require('v8');\n
                                        \n

                                        Note: The APIs and implementation are subject to change at any time.

                                        \n", "methods": [ { @@ -26734,7 +26868,7 @@ "v6.0.0" ] }, - "desc": "

                                        Returns statistics about the V8 heap spaces, i.e. the segments which make up\nthe V8 heap. Neither the ordering of heap spaces, nor the availability of a\nheap space can be guaranteed as the statistics are provided via the V8\nGetHeapSpaceStatistics function and may change from one V8 version to the\nnext.

                                        \n

                                        The value returned is an array of objects containing the following properties:

                                        \n
                                          \n
                                        • space_name {string}
                                        • \n
                                        • space_size {number}
                                        • \n
                                        • space_used_size {number}
                                        • \n
                                        • space_available_size {number}
                                        • \n
                                        • physical_space_size {number}
                                        • \n
                                        \n

                                        For example:

                                        \n
                                        [\n  {\n    "space_name": "new_space",\n    "space_size": 2063872,\n    "space_used_size": 951112,\n    "space_available_size": 80824,\n    "physical_space_size": 2063872\n  },\n  {\n    "space_name": "old_space",\n    "space_size": 3090560,\n    "space_used_size": 2493792,\n    "space_available_size": 0,\n    "physical_space_size": 3090560\n  },\n  {\n    "space_name": "code_space",\n    "space_size": 1260160,\n    "space_used_size": 644256,\n    "space_available_size": 960,\n    "physical_space_size": 1260160\n  },\n  {\n    "space_name": "map_space",\n    "space_size": 1094160,\n    "space_used_size": 201608,\n    "space_available_size": 0,\n    "physical_space_size": 1094160\n  },\n  {\n    "space_name": "large_object_space",\n    "space_size": 0,\n    "space_used_size": 0,\n    "space_available_size": 1490980608,\n    "physical_space_size": 0\n  }\n]\n
                                        \n", + "desc": "

                                        Returns statistics about the V8 heap spaces, i.e. the segments which make up\nthe V8 heap. Neither the ordering of heap spaces, nor the availability of a\nheap space can be guaranteed as the statistics are provided via the V8\nGetHeapSpaceStatistics function and may change from one V8 version to the\nnext.

                                        \n

                                        The value returned is an array of objects containing the following properties:

                                        \n
                                          \n
                                        • space_name {string}
                                        • \n
                                        • space_size {number}
                                        • \n
                                        • space_used_size {number}
                                        • \n
                                        • space_available_size {number}
                                        • \n
                                        • physical_space_size {number}
                                        • \n
                                        \n

                                        For example:

                                        \n
                                        [\n  {\n    "space_name": "new_space",\n    "space_size": 2063872,\n    "space_used_size": 951112,\n    "space_available_size": 80824,\n    "physical_space_size": 2063872\n  },\n  {\n    "space_name": "old_space",\n    "space_size": 3090560,\n    "space_used_size": 2493792,\n    "space_available_size": 0,\n    "physical_space_size": 3090560\n  },\n  {\n    "space_name": "code_space",\n    "space_size": 1260160,\n    "space_used_size": 644256,\n    "space_available_size": 960,\n    "physical_space_size": 1260160\n  },\n  {\n    "space_name": "map_space",\n    "space_size": 1094160,\n    "space_used_size": 201608,\n    "space_available_size": 0,\n    "physical_space_size": 1094160\n  },\n  {\n    "space_name": "large_object_space",\n    "space_size": 0,\n    "space_used_size": 0,\n    "space_available_size": 1490980608,\n    "physical_space_size": 0\n  }\n]\n
                                        \n", "signatures": [ { "params": [] @@ -26768,6 +26902,7 @@ { "textRaw": "VM (Executing JavaScript)", "name": "vm", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The vm module provides APIs for compiling and running code within V8 Virtual\nMachine contexts. It can be accessed using:

                                        \n
                                        const vm = require('vm');\n
                                        \n

                                        JavaScript code can be compiled and run immediately or compiled, saved, and run\nlater.

                                        \n

                                        Note: The vm module is not a security mechanism.\nDo not use it to run untrusted code.

                                        \n", @@ -27416,6 +27551,7 @@ { "textRaw": "Zlib", "name": "zlib", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                        The zlib module provides compression functionality implemented using Gzip and\nDeflate/Inflate. It can be accessed using:

                                        \n
                                        const zlib = require('zlib');\n
                                        \n

                                        Compressing or decompressing a stream (such as a file) can be accomplished by\npiping the source stream data through a zlib stream into a destination stream:

                                        \n
                                        const gzip = zlib.createGzip();\nconst fs = require('fs');\nconst inp = fs.createReadStream('input.txt');\nconst out = fs.createWriteStream('input.txt.gz');\n\ninp.pipe(gzip).pipe(out);\n
                                        \n

                                        It is also possible to compress or decompress data in a single step:

                                        \n
                                        const input = '.................................';\nzlib.deflate(input, (err, buffer) => {\n  if (!err) {\n    console.log(buffer.toString('base64'));\n  } else {\n    // handle error\n  }\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nzlib.unzip(buffer, (err, buffer) => {\n  if (!err) {\n    console.log(buffer.toString());\n  } else {\n    // handle error\n  }\n});\n
                                        \n", @@ -28303,7 +28439,7 @@ "textRaw": "`stack` {string} ", "type": "string", "name": "stack", - "desc": "

                                        The error.stack property is a string describing the point in the code at which\nthe Error was instantiated.

                                        \n

                                        For example:

                                        \n
                                        Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.<anonymous> (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n
                                        \n

                                        The first line is formatted as <error class name>: <error message>, and\nis followed by a series of stack frames (each line beginning with "at ").\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.

                                        \n

                                        It is important to note that frames are only generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called cheetahify, which itself calls a JavaScript function, the\nframe representing the cheetahify call will not be present in the stack\ntraces:

                                        \n
                                        const cheetahify = require('./native-binding.node');\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error('oh no!');\n  });\n}\n\nmakeFaster(); // will throw:\n  // /home/gbusey/file.js:6\n  //     throw new Error('oh no!');\n  //           ^\n  // Error: oh no!\n  //     at speedy (/home/gbusey/file.js:6:11)\n  //     at makeFaster (/home/gbusey/file.js:5:3)\n  //     at Object.<anonymous> (/home/gbusey/file.js:10:1)\n  //     at Module._compile (module.js:456:26)\n  //     at Object.Module._extensions..js (module.js:474:10)\n  //     at Module.load (module.js:356:32)\n  //     at Function.Module._load (module.js:312:12)\n  //     at Function.Module.runMain (module.js:497:10)\n  //     at startup (node.js:119:16)\n  //     at node.js:906:3\n
                                        \n

                                        The location information will be one of:

                                        \n
                                          \n
                                        • native, if the frame represents a call internal to V8 (as in [].forEach).
                                        • \n
                                        • plain-filename.js:line:column, if the frame represents a call internal\n to Node.js.
                                        • \n
                                        • /absolute/path/to/file.js:line:column, if the frame represents a call in\na user program, or its dependencies.
                                        • \n
                                        \n

                                        The string representing the stack trace is lazily generated when the\nerror.stack property is accessed.

                                        \n

                                        The number of frames captured by the stack trace is bounded by the smaller of\nError.stackTraceLimit or the number of available frames on the current event\nloop tick.

                                        \n

                                        System-level errors are generated as augmented Error instances, which are\ndetailed here.

                                        \n" + "desc": "

                                        The error.stack property is a string describing the point in the code at which\nthe Error was instantiated.

                                        \n

                                        For example:

                                        \n
                                        Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.<anonymous> (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n
                                        \n

                                        The first line is formatted as <error class name>: <error message>, and\nis followed by a series of stack frames (each line beginning with "at ").\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.

                                        \n

                                        It is important to note that frames are only generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called cheetahify, which itself calls a JavaScript function, the\nframe representing the cheetahify call will not be present in the stack\ntraces:

                                        \n
                                        const cheetahify = require('./native-binding.node');\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error('oh no!');\n  });\n}\n\nmakeFaster(); // will throw:\n// /home/gbusey/file.js:6\n//     throw new Error('oh no!');\n//           ^\n// Error: oh no!\n//     at speedy (/home/gbusey/file.js:6:11)\n//     at makeFaster (/home/gbusey/file.js:5:3)\n//     at Object.<anonymous> (/home/gbusey/file.js:10:1)\n//     at Module._compile (module.js:456:26)\n//     at Object.Module._extensions..js (module.js:474:10)\n//     at Module.load (module.js:356:32)\n//     at Function.Module._load (module.js:312:12)\n//     at Function.Module.runMain (module.js:497:10)\n//     at startup (node.js:119:16)\n//     at node.js:906:3\n
                                        \n

                                        The location information will be one of:

                                        \n
                                          \n
                                        • native, if the frame represents a call internal to V8 (as in [].forEach).
                                        • \n
                                        • plain-filename.js:line:column, if the frame represents a call internal\n to Node.js.
                                        • \n
                                        • /absolute/path/to/file.js:line:column, if the frame represents a call in\na user program, or its dependencies.
                                        • \n
                                        \n

                                        The string representing the stack trace is lazily generated when the\nerror.stack property is accessed.

                                        \n

                                        The number of frames captured by the stack trace is bounded by the smaller of\nError.stackTraceLimit or the number of available frames on the current event\nloop tick.

                                        \n

                                        System-level errors are generated as augmented Error instances, which are\ndetailed here.

                                        \n" } ], "signatures": [ @@ -28331,13 +28467,13 @@ "textRaw": "Class: RangeError", "type": "class", "name": "RangeError", - "desc": "

                                        A subclass of Error that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.

                                        \n

                                        For example:

                                        \n
                                        require('net').connect(-1);\n  // throws "RangeError: "port" option should be >= 0 and < 65536: -1"\n
                                        \n

                                        Node.js will generate and throw RangeError instances immediately as a form\nof argument validation.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.

                                        \n

                                        For example:

                                        \n
                                        require('net').connect(-1);\n// throws "RangeError: "port" option should be >= 0 and < 65536: -1"\n
                                        \n

                                        Node.js will generate and throw RangeError instances immediately as a form\nof argument validation.

                                        \n" }, { "textRaw": "Class: ReferenceError", "type": "class", "name": "ReferenceError", - "desc": "

                                        A subclass of Error that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.

                                        \n

                                        While client code may generate and propagate these errors, in practice, only V8\nwill do so.

                                        \n
                                        doesNotExist;\n  // throws ReferenceError, doesNotExist is not a variable in this program.\n
                                        \n

                                        Unless an application is dynamically generating and running code,\nReferenceError instances should always be considered a bug in the code\nor its dependencies.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.

                                        \n

                                        While client code may generate and propagate these errors, in practice, only V8\nwill do so.

                                        \n
                                        doesNotExist;\n// throws ReferenceError, doesNotExist is not a variable in this program.\n
                                        \n

                                        Unless an application is dynamically generating and running code,\nReferenceError instances should always be considered a bug in the code\nor its dependencies.

                                        \n" }, { "textRaw": "Class: SyntaxError", @@ -28349,7 +28485,7 @@ "textRaw": "Class: TypeError", "type": "class", "name": "TypeError", - "desc": "

                                        A subclass of Error that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.

                                        \n
                                        require('url').parse(() => { });\n  // throws TypeError, since it expected a string\n
                                        \n

                                        Node.js will generate and throw TypeError instances immediately as a form\nof argument validation.

                                        \n" + "desc": "

                                        A subclass of Error that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.

                                        \n
                                        require('url').parse(() => { });\n// throws TypeError, since it expected a string\n
                                        \n

                                        Node.js will generate and throw TypeError instances immediately as a form\nof argument validation.

                                        \n" } ], "globals": [ @@ -28466,6 +28602,7 @@ { "textRaw": "Process", "name": "Process", + "introduced_in": "v0.10.0", "type": "global", "desc": "

                                        The process object is a global that provides information about, and control\nover, the current Node.js process. As a global, it is always available to\nNode.js applications without using require().

                                        \n", "modules": [ @@ -28581,7 +28718,7 @@ { "textRaw": "Emitting custom warnings", "name": "emitting_custom_warnings", - "desc": "

                                        The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                        \n
                                        // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n  // Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n  // Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n  // Prints: (node 12345) CustomWarning: Something happened!\n
                                        \n", + "desc": "

                                        The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                        \n
                                        // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n// Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n// Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n// Prints: (node 12345) CustomWarning: Something happened!\n
                                        \n", "type": "module", "displayName": "Emitting custom warnings" }, @@ -29373,7 +29510,7 @@ ] } ], - "desc": "

                                        The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. The old\nmask is return if the mask argument is given, otherwise returns the current\nmask.

                                        \n
                                        const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                        \n" + "desc": "

                                        The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. Invoked\nwithout an argument, the current mask is returned, otherwise the umask is set to\nthe argument value and the previous mask is returned.

                                        \n
                                        const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                        \n" }, { "textRaw": "process.uptime()", diff -Nru nodejs-6.11.2~dfsg/doc/api/all.md nodejs-6.11.4~dfsg/doc/api/all.md --- nodejs-6.11.2~dfsg/doc/api/all.md 2017-08-01 05:39:13.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/all.md 2017-10-03 17:11:27.000000000 +0000 @@ -18,6 +18,7 @@ @include globals @include http @include https +@include intl @include modules @include net @include os diff -Nru nodejs-6.11.2~dfsg/doc/api/assert.html nodejs-6.11.4~dfsg/doc/api/assert.html --- nodejs-6.11.2~dfsg/doc/api/assert.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/assert.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - Assert | Node.js v6.11.2 Documentation + Assert | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                      • Globals
                                      • HTTP
                                      • HTTPS
                                      • +
                                      • Internationalization
                                      • Modules
                                      • Net
                                      • OS
                                      • @@ -72,13 +73,31 @@
                                        -

                                        Node.js v6.11.2 Documentation

                                        +

                                        Node.js v6.11.4 Documentation


                                        @@ -92,7 +111,7 @@
                                      • assert.deepStrictEqual(actual, expected[, message])
                                      • assert.doesNotThrow(block[, error][, message])
                                      • assert.equal(actual, expected[, message])
                                      • -
                                      • assert.fail(actual, expected, message, operator)
                                      • +
                                      • assert.fail(actual, expected[, message[, operator[, stackStartFunction]]])
                                      • assert.ifError(value)
                                      • assert.notDeepEqual(actual, expected[, message])
                                      • assert.notDeepStrictEqual(actual, expected[, message])
                                      • @@ -109,7 +128,8 @@

                                        Assert#

                                        -
                                        Stability: 2 - Stable

                                        The assert module provides a simple set of assertion tests that can be used to + +

                                        Stability: 2 - Stable

                                        The assert module provides a simple set of assertion tests that can be used to test invariants.

                                        assert(value[, message])#

                                        Stability: 0 - Deprecated: Use Buffer.alloc() instead (also see Buffer.allocUnsafe()).
                                        • size <integer> The desired length of the new Buffer

                                        Allocates a new Buffer of size bytes. The size must be less than or equal @@ -528,7 +548,7 @@

                                        new Buffer(string[, encoding])#

                                        Stability: 0 - Deprecated: Use Buffer.from(string[, encoding]) instead.
                                          +
                                        • string <string> String to encode
                                        • encoding <string> The encoding of string. Default: 'utf8'
                                        @@ -851,7 +871,7 @@ // Prints: this is a tést console.log(buf2.toString());
                                        -

                                        A TypeError will be thrown if str is not a string.

                                        +

                                        A TypeError will be thrown if string is not a string.

                                        Class Method: Buffer.isBuffer(obj)#

                                        Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.

                                        Returns an un-pooled Buffer.

                                        In order to avoid the garbage collection overhead of creating many individually allocated Buffer instances, by default allocations under 4KB are sliced from a single larger allocated object. This approach improves both performance and memory @@ -2193,7 +2213,7 @@

                                        new SlowBuffer(size)#

                                        Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.
                                          +
                                          Stability: 0 - Deprecated: Use Buffer.allocUnsafeSlow() instead.
                                          • size <integer> The desired length of the new SlowBuffer

                                          Allocates a new SlowBuffer of size bytes. The size must be less than diff -Nru nodejs-6.11.2~dfsg/doc/api/buffer.json nodejs-6.11.4~dfsg/doc/api/buffer.json --- nodejs-6.11.2~dfsg/doc/api/buffer.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/buffer.json 2017-10-03 17:11:38.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Buffer", "name": "buffer", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                          Prior to the introduction of TypedArray in ECMAScript 2015 (ES6), the\nJavaScript language had no mechanism for reading or manipulating streams\nof binary data. The Buffer class was introduced as part of the Node.js\nAPI to make it possible to interact with octet streams in the context of things\nlike TCP streams and file system operations.

                                          \n

                                          Now that TypedArray has been added in ES6, the Buffer class implements the\nUint8Array API in a manner that is more optimized and suitable for Node.js'\nuse cases.

                                          \n

                                          Instances of the Buffer class are similar to arrays of integers but\ncorrespond to fixed-sized, raw memory allocations outside the V8 heap.\nThe size of the Buffer is established when it is created and cannot be\nresized.

                                          \n

                                          The Buffer class is a global within Node.js, making it unlikely that one\nwould need to ever use require('buffer').Buffer.

                                          \n

                                          Examples:

                                          \n
                                          // Creates a zero-filled Buffer of length 10.\nconst buf1 = Buffer.alloc(10);\n\n// Creates a Buffer of length 10, filled with 0x1.\nconst buf2 = Buffer.alloc(10, 1);\n\n// Creates an uninitialized buffer of length 10.\n// This is faster than calling Buffer.alloc() but the returned\n// Buffer instance might contain old data that needs to be\n// overwritten using either fill() or write().\nconst buf3 = Buffer.allocUnsafe(10);\n\n// Creates a Buffer containing [0x1, 0x2, 0x3].\nconst buf4 = Buffer.from([1, 2, 3]);\n\n// Creates a Buffer containing UTF-8 bytes [0x74, 0xc3, 0xa9, 0x73, 0x74].\nconst buf5 = Buffer.from('tést');\n\n// Creates a Buffer containing Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].\nconst buf6 = Buffer.from('tést', 'latin1');\n
                                          \n", @@ -462,7 +463,7 @@ ] } ], - "desc": "

                                          Creates a new Buffer containing the given JavaScript string string. If\nprovided, the encoding parameter identifies the character encoding of string.

                                          \n

                                          Examples:

                                          \n
                                          const buf1 = Buffer.from('this is a tést');\n\n// Prints: this is a tést\nconsole.log(buf1.toString());\n\n// Prints: this is a tC)st\nconsole.log(buf1.toString('ascii'));\n\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\n// Prints: this is a tést\nconsole.log(buf2.toString());\n
                                          \n

                                          A TypeError will be thrown if str is not a string.

                                          \n" + "desc": "

                                          Creates a new Buffer containing the given JavaScript string string. If\nprovided, the encoding parameter identifies the character encoding of string.

                                          \n

                                          Examples:

                                          \n
                                          const buf1 = Buffer.from('this is a tést');\n\n// Prints: this is a tést\nconsole.log(buf1.toString());\n\n// Prints: this is a tC)st\nconsole.log(buf1.toString('ascii'));\n\n\nconst buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');\n\n// Prints: this is a tést\nconsole.log(buf2.toString());\n
                                          \n

                                          A TypeError will be thrown if string is not a string.

                                          \n" }, { "textRaw": "Class Method: Buffer.isBuffer(obj)", diff -Nru nodejs-6.11.2~dfsg/doc/api/buffer.md nodejs-6.11.4~dfsg/doc/api/buffer.md --- nodejs-6.11.2~dfsg/doc/api/buffer.md 2017-08-01 05:39:13.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/buffer.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Buffer + + > Stability: 2 - Stable Prior to the introduction of [`TypedArray`] in ECMAScript 2015 (ES6), the @@ -833,7 +835,7 @@ console.log(buf2.toString()); ``` -A `TypeError` will be thrown if `str` is not a string. +A `TypeError` will be thrown if `string` is not a string. ### Class Method: Buffer.isBuffer(obj) +
                                          Stability: 2 - Stable

                                          The child_process module provides the ability to spawn child processes in a manner that is similar, but not identical, to popen(3). This capability is primarily provided by the child_process.spawn() function:

                                          const spawn = require('child_process').spawn;
                                          @@ -388,7 +409,7 @@
                                           Like child_process.spawn(), a ChildProcess object is returned. The returned
                                           ChildProcess will have an additional communication channel built-in that
                                           allows messages to be passed back and forth between the parent and child. See
                                          -child.send() for details.

                                          +subprocess.send() for details.

                                          It is important to keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel that is established between the two. Each process has its own memory, with @@ -497,12 +518,12 @@ } });

                                          -

                                          Example of checking for failed exec:

                                          +

                                          Example of checking for failed spawn:

                                          const spawn = require('child_process').spawn;
                                          -const child = spawn('bad_command');
                                          +const subprocess = spawn('bad_command');
                                           
                                          -child.on('error', (err) => {
                                          -  console.log('Failed to start child process.');
                                          +subprocess.on('error', (err) => {
                                          +  console.log('Failed to start subprocess.');
                                           });
                                           

                                          Note: Certain platforms (macOS, Linux) will use the value of argv[0] for the @@ -523,10 +544,10 @@ child processes may continue running after the parent exits regardless of whether they are detached or not. See setsid(2) for more information.

                                          By default, the parent will wait for the detached child to exit. To prevent -the parent from waiting for a given child, use the child.unref() method. -Doing so will cause the parent's event loop to not include the child in its -reference count, allowing the parent to exit independently of the child, unless -there is an established IPC channel between the child and parent.

                                          +the parent from waiting for a given subprocess, use the subprocess.unref() +method. Doing so will cause the parent's event loop to not include the child in +its reference count, allowing the parent to exit independently of the child, +unless there is an established IPC channel between the child and parent.

                                          When using the detached option to start a long-running process, the process will not stay running in the background after the parent exits unless it is provided with a stdio configuration that is not connected to the parent. @@ -536,12 +557,12 @@ stdio file descriptors, in order to ignore the parent's termination:

                                          const spawn = require('child_process').spawn;
                                           
                                          -const child = spawn(process.argv[0], ['child_program.js'], {
                                          +const subprocess = spawn(process.argv[0], ['child_program.js'], {
                                             detached: true,
                                             stdio: 'ignore'
                                           });
                                           
                                          -child.unref();
                                          +subprocess.unref();
                                           

                                          Alternatively one can redirect the child process' output into files:

                                          const fs = require('fs');
                                          @@ -549,21 +570,22 @@
                                           const out = fs.openSync('./out.log', 'a');
                                           const err = fs.openSync('./out.log', 'a');
                                           
                                          -const child = spawn('prg', [], {
                                          +const subprocess = spawn('prg', [], {
                                             detached: true,
                                             stdio: [ 'ignore', out, err ]
                                           });
                                           
                                          -child.unref();
                                          +subprocess.unref();
                                           

                                          options.stdio#

                                          The options.stdio option is used to configure the pipes that are established between the parent and child process. By default, the child's stdin, stdout, -and stderr are redirected to corresponding child.stdin, child.stdout, and -child.stderr streams on the ChildProcess object. This is equivalent to -setting the options.stdio equal to ['pipe', 'pipe', 'pipe'].

                                          +and stderr are redirected to corresponding subprocess.stdin, +subprocess.stdout, and subprocess.stderr streams on the +ChildProcess object. This is equivalent to setting the options.stdio +equal to ['pipe', 'pipe', 'pipe'].

                                          For convenience, options.stdio may be one of the following strings:

                                          • 'pipe' - equivalent to ['pipe', 'pipe', 'pipe'] (the default)
                                          • @@ -578,17 +600,18 @@
                                            1. 'pipe' - Create a pipe between the child process and the parent process. The parent end of the pipe is exposed to the parent as a property on the -child_process object as child.stdio[fd]. Pipes created for -fds 0 - 2 are also available as child.stdin, child.stdout -and child.stderr, respectively.
                                            2. +child_process object as subprocess.stdio[fd]. Pipes created +for fds 0 - 2 are also available as subprocess.stdin, +subprocess.stdout and subprocess.stderr, respectively.
                                            3. 'ipc' - Create an IPC channel for passing messages/file descriptors between parent and child. A ChildProcess may have at most one IPC stdio -file descriptor. Setting this option enables the child.send() method. -If the child writes JSON messages to this file descriptor, the -child.on('message') event handler will be triggered in the parent. -If the child is a Node.js process, the presence of an IPC channel will enable -process.send(), process.disconnect(), process.on('disconnect'), and -process.on('message') within the child.
                                            4. +file descriptor. Setting this option enables the subprocess.send() +method. If the child writes JSON messages to this file descriptor, the +subprocess.on('message') event handler will be triggered in +the parent. If the child is a Node.js process, the presence of an IPC channel +will enable process.send(), process.disconnect(), +process.on('disconnect'), and process.on('message') within the +child.
                                            5. 'ignore' - Instructs Node.js to ignore the fd in the child. While Node.js will always open fds 0 - 2 for the processes it spawns, setting the fd to 'ignore' will cause Node.js to open /dev/null and attach it to the @@ -674,8 +697,8 @@ the SIGTERM signal and does not exit, the parent process will still wait until the child process has exited.

                                              If the process times out, or has a non-zero exit code, this method will -throw. The Error object will contain the entire result from -child_process.spawnSync()

                                              +throw an Error that will include the full result of the underlying +child_process.spawnSync().

                                              child_process.execSync(command[, options])#

                                          Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

                                          +

                                          Note: Using fs.rmdir() on a file (not a directory) results in an ENOENT +error on Windows and an ENOTDIR error on POSIX.

                                          fs.rmdirSync(path)#

                                        Synchronous rmdir(2). Returns undefined.

                                        +

                                        Note: Using fs.rmdirSync() on a file (not a directory) results in an ENOENT +error on Windows and an ENOTDIR error on POSIX.

                                        fs.stat(path, callback)#

                                        Stability: 0 - Deprecated

                                        Instruct require on how to handle certain file extensions.

                                        diff -Nru nodejs-6.11.2~dfsg/doc/api/globals.json nodejs-6.11.4~dfsg/doc/api/globals.json --- nodejs-6.11.2~dfsg/doc/api/globals.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/globals.json 2017-10-03 17:11:38.000000000 +0000 @@ -1,5 +1,6 @@ { "source": "doc/api/globals.md", + "introduced_in": "v0.10.0", "globals": [ { "textRaw": "Class: Buffer", @@ -220,6 +221,7 @@ { "textRaw": "Global Objects", "name": "Global Objects", + "introduced_in": "v0.10.0", "type": "misc", "desc": "

                                        These objects are available in all modules. Some of these objects aren't\nactually in the global scope but in the module scope - this will be noted.

                                        \n

                                        The objects listed here are specific to Node.js. There are a number of\nbuilt-in objects that are part of the JavaScript language itself, which are\nalso globally accessible.

                                        \n", "globals": [ diff -Nru nodejs-6.11.2~dfsg/doc/api/globals.md nodejs-6.11.4~dfsg/doc/api/globals.md --- nodejs-6.11.2~dfsg/doc/api/globals.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/globals.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,6 @@ # Global Objects + These objects are available in all modules. Some of these objects aren't diff -Nru nodejs-6.11.2~dfsg/doc/api/http.html nodejs-6.11.4~dfsg/doc/api/http.html --- nodejs-6.11.2~dfsg/doc/api/http.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/http.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - HTTP | Node.js v6.11.2 Documentation + HTTP | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                      • Globals
                                      • HTTP
                                      • HTTPS
                                      • +
                                      • Internationalization
                                      • Modules
                                      • Net
                                      • OS
                                      • @@ -72,13 +73,31 @@
                                        -

                                        Node.js v6.11.2 Documentation

                                        +

                                        Node.js v6.11.4 Documentation


                                        @@ -187,7 +206,8 @@

                                        HTTP#

                                        -
                                        Stability: 2 - Stable

                                        To use the HTTP server and client one must require('http').

                                        + +
                                        Stability: 2 - Stable

                                        To use the HTTP server and client one must require('http').

                                        The HTTP interfaces in Node.js are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is @@ -574,7 +594,7 @@ unsent, it will flush them to the stream. If the request is chunked, this will send the terminating '0\r\n\r\n'.

                                        If data is specified, it is equivalent to calling -response.write(data, encoding) followed by request.end(callback).

                                        +request.write(data, encoding) followed by request.end(callback).

                                        If callback is specified, it will be called when the request stream is finished.

                                        request.flushHeaders()#

                                        @@ -1311,7 +1331,7 @@
                                        Stability: 0 - Deprecated: Use http.request() instead.

                                        Constructs a new HTTP client. port and host refer to the server to be +

                                        Stability: 0 - Deprecated: Use http.request() instead.

                                        Constructs a new HTTP client. port and host refer to the server to be connected to.

                                        http.createServer([requestListener])#

                                      Returns an object containing commonly used operating system specific constants for error codes, process signals, and so on. The specific constants currently -defined are described in OS Constants.

                                      +defined are described in OS Constants.

                                      os.cpus()#

                                    The process.umask() method sets or returns the Node.js process's file mode -creation mask. Child processes inherit the mask from the parent process. The old -mask is return if the mask argument is given, otherwise returns the current -mask.

                                    +creation mask. Child processes inherit the mask from the parent process. Invoked +without an argument, the current mask is returned, otherwise the umask is set to +the argument value and the previous mask is returned.

                                    const newmask = 0o022;
                                     const oldmask = process.umask(newmask);
                                     console.log(
                                    diff -Nru nodejs-6.11.2~dfsg/doc/api/process.json nodejs-6.11.4~dfsg/doc/api/process.json
                                    --- nodejs-6.11.2~dfsg/doc/api/process.json	2017-08-01 05:39:17.000000000 +0000
                                    +++ nodejs-6.11.4~dfsg/doc/api/process.json	2017-10-03 17:11:38.000000000 +0000
                                    @@ -4,6 +4,7 @@
                                         {
                                           "textRaw": "Process",
                                           "name": "Process",
                                    +      "introduced_in": "v0.10.0",
                                           "type": "global",
                                           "desc": "

                                    The process object is a global that provides information about, and control\nover, the current Node.js process. As a global, it is always available to\nNode.js applications without using require().

                                    \n", "modules": [ @@ -119,7 +120,7 @@ { "textRaw": "Emitting custom warnings", "name": "emitting_custom_warnings", - "desc": "

                                    The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                    \n
                                    // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n  // Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n  // Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n  // Prints: (node 12345) CustomWarning: Something happened!\n
                                    \n", + "desc": "

                                    The process.emitWarning() method can be used to issue\ncustom or application specific warnings.

                                    \n
                                    // Emit a warning using a string...\nprocess.emitWarning('Something happened!');\n// Prints: (node 12345) Warning: Something happened!\n\n// Emit a warning using an object...\nprocess.emitWarning('Something Happened!', 'CustomWarning');\n// Prints: (node 12345) CustomWarning: Something happened!\n\n// Emit a warning using a custom Error object...\nclass CustomWarning extends Error {\n  constructor(message) {\n    super(message);\n    this.name = 'CustomWarning';\n    Error.captureStackTrace(this, CustomWarning);\n  }\n}\nconst myWarning = new CustomWarning('Something happened!');\nprocess.emitWarning(myWarning);\n// Prints: (node 12345) CustomWarning: Something happened!\n
                                    \n", "type": "module", "displayName": "Emitting custom warnings" }, @@ -911,7 +912,7 @@ ] } ], - "desc": "

                                    The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. The old\nmask is return if the mask argument is given, otherwise returns the current\nmask.

                                    \n
                                    const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                    \n" + "desc": "

                                    The process.umask() method sets or returns the Node.js process's file mode\ncreation mask. Child processes inherit the mask from the parent process. Invoked\nwithout an argument, the current mask is returned, otherwise the umask is set to\nthe argument value and the previous mask is returned.

                                    \n
                                    const newmask = 0o022;\nconst oldmask = process.umask(newmask);\nconsole.log(\n  `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`\n);\n
                                    \n" }, { "textRaw": "process.uptime()", diff -Nru nodejs-6.11.2~dfsg/doc/api/process.md nodejs-6.11.4~dfsg/doc/api/process.md --- nodejs-6.11.2~dfsg/doc/api/process.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/process.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,6 @@ # Process + The `process` object is a `global` that provides information about, and control @@ -320,11 +321,11 @@ ```js // Emit a warning using a string... process.emitWarning('Something happened!'); - // Prints: (node 12345) Warning: Something happened! +// Prints: (node 12345) Warning: Something happened! // Emit a warning using an object... process.emitWarning('Something Happened!', 'CustomWarning'); - // Prints: (node 12345) CustomWarning: Something happened! +// Prints: (node 12345) CustomWarning: Something happened! // Emit a warning using a custom Error object... class CustomWarning extends Error { @@ -336,7 +337,7 @@ } const myWarning = new CustomWarning('Something happened!'); process.emitWarning(myWarning); - // Prints: (node 12345) CustomWarning: Something happened! +// Prints: (node 12345) CustomWarning: Something happened! ``` #### Emitting custom deprecation warnings @@ -1654,9 +1655,9 @@ * `mask` {number} The `process.umask()` method sets or returns the Node.js process's file mode -creation mask. Child processes inherit the mask from the parent process. The old -mask is return if the `mask` argument is given, otherwise returns the current -mask. +creation mask. Child processes inherit the mask from the parent process. Invoked +without an argument, the current mask is returned, otherwise the umask is set to +the argument value and the previous mask is returned. ```js const newmask = 0o022; diff -Nru nodejs-6.11.2~dfsg/doc/api/punycode.html nodejs-6.11.4~dfsg/doc/api/punycode.html --- nodejs-6.11.2~dfsg/doc/api/punycode.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/punycode.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - Punycode | Node.js v6.11.2 Documentation + Punycode | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                  • Globals
                                  • HTTP
                                  • HTTPS
                                  • +
                                  • Internationalization
                                  • Modules
                                  • Net
                                  • OS
                                  • @@ -72,13 +73,31 @@
                                    -

                                    Node.js v6.11.2 Documentation

                                    +

                                    Node.js v6.11.4 Documentation


                                    @@ -105,7 +124,8 @@

                                    Punycode#

                                    -
                                    Stability: 0 - Deprecated

                                    The version of the punycode module bundled in Node.js is being deprecated. + +

                                    Stability: 0 - Deprecated

                                    The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js this module will be removed. Users currently depending on the punycode module should switch to using the userland-provided Punycode.js module instead.

                                    diff -Nru nodejs-6.11.2~dfsg/doc/api/punycode.json nodejs-6.11.4~dfsg/doc/api/punycode.json --- nodejs-6.11.2~dfsg/doc/api/punycode.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/punycode.json 2017-10-03 17:11:38.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Punycode", "name": "punycode", + "introduced_in": "v0.10.0", "stability": 0, "stabilityText": "Deprecated", "desc": "

                                    The version of the punycode module bundled in Node.js is being deprecated.\nIn a future major version of Node.js this module will be removed. Users\ncurrently depending on the punycode module should switch to using the\nuserland-provided Punycode.js module instead.

                                    \n

                                    The punycode module is a bundled version of the Punycode.js module. It\ncan be accessed using:

                                    \n
                                    const punycode = require('punycode');\n
                                    \n

                                    Punycode is a character encoding scheme defined by RFC 3492 that is\nprimarily intended for use in Internationalized Domain Names. Because host\nnames in URLs are limited to ASCII characters only, Domain Names that contain\nnon-ASCII characters must be converted into ASCII using the Punycode scheme.\nFor instance, the Japanese character that translates into the English word,\n'example' is '例'. The Internationalized Domain Name, '例.com' (equivalent\nto 'example.com') is represented by Punycode as the ASCII string\n'xn--fsq.com'.

                                    \n

                                    The punycode module provides a simple implementation of the Punycode standard.

                                    \n

                                    Note: The punycode module is a third-party dependency used by Node.js and\nmade available to developers as a convenience. Fixes or other modifications to\nthe module must be directed to the Punycode.js project.

                                    \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/punycode.md nodejs-6.11.4~dfsg/doc/api/punycode.md --- nodejs-6.11.2~dfsg/doc/api/punycode.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/punycode.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Punycode + + > Stability: 0 - Deprecated **The version of the punycode module bundled in Node.js is being deprecated**. diff -Nru nodejs-6.11.2~dfsg/doc/api/querystring.html nodejs-6.11.4~dfsg/doc/api/querystring.html --- nodejs-6.11.2~dfsg/doc/api/querystring.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/querystring.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - Query String | Node.js v6.11.2 Documentation + Query String | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                  • Globals
                                  • HTTP
                                  • HTTPS
                                  • +
                                  • Internationalization
                                  • Modules
                                  • Net
                                  • OS
                                  • @@ -72,13 +73,31 @@
                                    -

                                    Node.js v6.11.2 Documentation

                                    +

                                    Node.js v6.11.4 Documentation


                                    @@ -99,7 +118,8 @@

                                    Query String#

                                    -
                                    Stability: 2 - Stable
                                    + +
                                    Stability: 2 - Stable

                                    The querystring module provides utilities for parsing and formatting URL query strings. It can be accessed using:

                                    const querystring = require('querystring');
                                    @@ -155,7 +175,7 @@
                                     
                                    // Assuming gbkDecodeURIComponent function already exists...
                                     
                                     querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
                                    -  { decodeURIComponent: gbkDecodeURIComponent });
                                    +                  { decodeURIComponent: gbkDecodeURIComponent });
                                     

                                    querystring.stringify(obj[, sep[, eq[, options]]])#

                                @@ -189,7 +209,8 @@

                                Stream#

                                -
                                Stability: 2 - Stable

                                A stream is an abstract interface for working with streaming data in Node.js. + +

                                Stability: 2 - Stable

                                A stream is an abstract interface for working with streaming data in Node.js. The stream module provides a base API that makes it easy to build objects that implement the stream interface.

                                There are many stream objects provided by Node.js. For instance, a @@ -237,8 +258,8 @@ readable._readableState.buffer, respectively.

                                The amount of data potentially buffered depends on the highWaterMark option passed into the streams constructor. For normal streams, the highWaterMark -option specifies a total number of bytes. For streams operating in object mode, -the highWaterMark specifies a total number of objects.

                                +option specifies a total number of bytes. For streams operating +in object mode, the highWaterMark specifies a total number of objects.

                                Data is buffered in Readable streams when the implementation calls stream.push(chunk). If the consumer of the Stream does not call stream.read(), the data will sit in the internal @@ -876,7 +897,7 @@

                                The optional size argument specifies a specific number of bytes to read. If size bytes are not available to be read, null will be returned unless the stream has ended, in which case all of the data remaining in the internal -buffer will be returned (even if it exceeds size bytes).

                                +buffer will be returned.

                                If the size argument is not specified, all of the data contained in the internal buffer will be returned.

                                The readable.read() method should only be called on Readable streams operating @@ -1334,9 +1355,9 @@

                                new stream.Readable([options])#

                                • options <Object>
                                    -
                                  • highWaterMark <number> The maximum number of bytes to store in -the internal buffer before ceasing to read from the underlying -resource. Defaults to 16384 (16kb), or 16 for objectMode streams
                                  • +
                                  • highWaterMark <number> The maximum number of bytes to store +in the internal buffer before ceasing to read from the underlying resource. +Defaults to 16384 (16kb), or 16 for objectMode streams
                                  • encoding <string> If specified, then buffers will be decoded to strings using the specified encoding. Defaults to null
                                  • objectMode <boolean> Whether this stream should behave @@ -1518,8 +1539,8 @@
                                  • options <Object> Passed to both Writable and Readable constructors. Also has the following fields:
                                    • allowHalfOpen <boolean> Defaults to true. If set to false, then -the stream will automatically end the readable side when the -writable side ends and vice versa.
                                    • +the stream will automatically end the writable side when the +readable side ends.
                                    • readableObjectMode <boolean> Defaults to false. Sets objectMode for readable side of the stream. Has no effect if objectMode is true.
                                    • @@ -1761,6 +1782,9 @@

                                      The transform._transform() method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs.

                                      +

                                      transform._transform() is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, callback must be +called, either synchronously or asynchronously.

                                      Class: stream.PassThrough#

                                      The stream.PassThrough class is a trivial implementation of a Transform stream that simply passes the input bytes across to the output. Its purpose is @@ -1845,6 +1869,15 @@ readable.push(), the call will end the reading process. However, because the argument is an empty string, no data is added to the readable buffer so there is nothing for a user to consume.

                                      +

                                      highWaterMark discrepency after calling readable.setEncoding()#

                                      +

                                      The use of readable.setEncoding() will change the behavior of how the +highWaterMark operates in non-object mode.

                                      +

                                      Typically, the size of the current buffer is measured against the +highWaterMark in bytes. However, after setEncoding() is called, the +comparison function will begin to measure the buffer's size in characters.

                                      +

                                      This is not a problem in common cases with latin1 or ascii. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters.

                                diff -Nru nodejs-6.11.2~dfsg/doc/api/stream.json nodejs-6.11.4~dfsg/doc/api/stream.json --- nodejs-6.11.2~dfsg/doc/api/stream.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/stream.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Stream", "name": "stream", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                A stream is an abstract interface for working with streaming data in Node.js.\nThe stream module provides a base API that makes it easy to build objects\nthat implement the stream interface.

                                \n

                                There are many stream objects provided by Node.js. For instance, a\nrequest to an HTTP server and process.stdout\nare both stream instances.

                                \n

                                Streams can be readable, writable, or both. All streams are instances of\nEventEmitter.

                                \n

                                The stream module can be accessed using:

                                \n
                                const stream = require('stream');\n
                                \n

                                While it is important for all Node.js users to understand how streams work,\nthe stream module itself is most useful for developers that are creating new\ntypes of stream instances. Developers who are primarily consuming stream\nobjects will rarely (if ever) have need to use the stream module directly.

                                \n", @@ -33,7 +34,7 @@ "textRaw": "Buffering", "name": "Buffering", "type": "misc", - "desc": "

                                Both Writable and Readable streams will store data in an internal\nbuffer that can be retrieved using writable._writableState.getBuffer() or\nreadable._readableState.buffer, respectively.

                                \n

                                The amount of data potentially buffered depends on the highWaterMark option\npassed into the streams constructor. For normal streams, the highWaterMark\noption specifies a total number of bytes. For streams operating in object mode,\nthe highWaterMark specifies a total number of objects.

                                \n

                                Data is buffered in Readable streams when the implementation calls\nstream.push(chunk). If the consumer of the Stream does not\ncall stream.read(), the data will sit in the internal\nqueue until it is consumed.

                                \n

                                Once the total size of the internal read buffer reaches the threshold specified\nby highWaterMark, the stream will temporarily stop reading data from the\nunderlying resource until the data currently buffered can be consumed (that is,\nthe stream will stop calling the internal readable._read() method that is\nused to fill the read buffer).

                                \n

                                Data is buffered in Writable streams when the\nwritable.write(chunk) method is called repeatedly. While the\ntotal size of the internal write buffer is below the threshold set by\nhighWaterMark, calls to writable.write() will return true. Once\nthe size of the internal buffer reaches or exceeds the highWaterMark, false\nwill be returned.

                                \n

                                A key goal of the stream API, particularly the stream.pipe() method,\nis to limit the buffering of data to acceptable levels such that sources and\ndestinations of differing speeds will not overwhelm the available memory.

                                \n

                                Because Duplex and Transform streams are both Readable and Writable,\neach maintain two separate internal buffers used for reading and writing,\nallowing each side to operate independently of the other while maintaining an\nappropriate and efficient flow of data. For example, net.Socket instances\nare Duplex streams whose Readable side allows consumption of data received\nfrom the socket and whose Writable side allows writing data to the socket.\nBecause data may be written to the socket at a faster or slower rate than data\nis received, it is important for each side to operate (and buffer) independently\nof the other.

                                \n" + "desc": "

                                Both Writable and Readable streams will store data in an internal\nbuffer that can be retrieved using writable._writableState.getBuffer() or\nreadable._readableState.buffer, respectively.

                                \n

                                The amount of data potentially buffered depends on the highWaterMark option\npassed into the streams constructor. For normal streams, the highWaterMark\noption specifies a total number of bytes. For streams operating\nin object mode, the highWaterMark specifies a total number of objects.

                                \n

                                Data is buffered in Readable streams when the implementation calls\nstream.push(chunk). If the consumer of the Stream does not\ncall stream.read(), the data will sit in the internal\nqueue until it is consumed.

                                \n

                                Once the total size of the internal read buffer reaches the threshold specified\nby highWaterMark, the stream will temporarily stop reading data from the\nunderlying resource until the data currently buffered can be consumed (that is,\nthe stream will stop calling the internal readable._read() method that is\nused to fill the read buffer).

                                \n

                                Data is buffered in Writable streams when the\nwritable.write(chunk) method is called repeatedly. While the\ntotal size of the internal write buffer is below the threshold set by\nhighWaterMark, calls to writable.write() will return true. Once\nthe size of the internal buffer reaches or exceeds the highWaterMark, false\nwill be returned.

                                \n

                                A key goal of the stream API, particularly the stream.pipe() method,\nis to limit the buffering of data to acceptable levels such that sources and\ndestinations of differing speeds will not overwhelm the available memory.

                                \n

                                Because Duplex and Transform streams are both Readable and Writable,\neach maintain two separate internal buffers used for reading and writing,\nallowing each side to operate independently of the other while maintaining an\nappropriate and efficient flow of data. For example, net.Socket instances\nare Duplex streams whose Readable side allows consumption of data received\nfrom the socket and whose Writable side allows writing data to the socket.\nBecause data may be written to the socket at a faster or slower rate than data\nis received, it is important for each side to operate (and buffer) independently\nof the other.

                                \n" } ], "type": "module", @@ -553,7 +554,7 @@ ] } ], - "desc": "

                                The readable.read() method pulls some data out of the internal buffer and\nreturns it. If no data available to be read, null is returned. By default,\nthe data will be returned as a Buffer object unless an encoding has been\nspecified using the readable.setEncoding() method or the stream is operating\nin object mode.

                                \n

                                The optional size argument specifies a specific number of bytes to read. If\nsize bytes are not available to be read, null will be returned unless\nthe stream has ended, in which case all of the data remaining in the internal\nbuffer will be returned (even if it exceeds size bytes).

                                \n

                                If the size argument is not specified, all of the data contained in the\ninternal buffer will be returned.

                                \n

                                The readable.read() method should only be called on Readable streams operating\nin paused mode. In flowing mode, readable.read() is called automatically until\nthe internal buffer is fully drained.

                                \n
                                const readable = getReadableStreamSomehow();\nreadable.on('readable', () => {\n  let chunk;\n  while (null !== (chunk = readable.read())) {\n    console.log(`Received ${chunk.length} bytes of data.`);\n  }\n});\n
                                \n

                                In general, it is recommended that developers avoid the use of the 'readable'\nevent and the readable.read() method in favor of using either\nreadable.pipe() or the 'data' event.

                                \n

                                A Readable stream in object mode will always return a single item from\na call to readable.read(size), regardless of the value of the\nsize argument.

                                \n

                                Note: If the readable.read() method returns a chunk of data, a 'data'\nevent will also be emitted.

                                \n

                                Note: Calling stream.read([size]) after the 'end'\nevent has been emitted will return null. No runtime error will be raised.

                                \n" + "desc": "

                                The readable.read() method pulls some data out of the internal buffer and\nreturns it. If no data available to be read, null is returned. By default,\nthe data will be returned as a Buffer object unless an encoding has been\nspecified using the readable.setEncoding() method or the stream is operating\nin object mode.

                                \n

                                The optional size argument specifies a specific number of bytes to read. If\nsize bytes are not available to be read, null will be returned unless\nthe stream has ended, in which case all of the data remaining in the internal\nbuffer will be returned.

                                \n

                                If the size argument is not specified, all of the data contained in the\ninternal buffer will be returned.

                                \n

                                The readable.read() method should only be called on Readable streams operating\nin paused mode. In flowing mode, readable.read() is called automatically until\nthe internal buffer is fully drained.

                                \n
                                const readable = getReadableStreamSomehow();\nreadable.on('readable', () => {\n  let chunk;\n  while (null !== (chunk = readable.read())) {\n    console.log(`Received ${chunk.length} bytes of data.`);\n  }\n});\n
                                \n

                                In general, it is recommended that developers avoid the use of the 'readable'\nevent and the readable.read() method in favor of using either\nreadable.pipe() or the 'data' event.

                                \n

                                A Readable stream in object mode will always return a single item from\na call to readable.read(size), regardless of the value of the\nsize argument.

                                \n

                                Note: If the readable.read() method returns a chunk of data, a 'data'\nevent will also be emitted.

                                \n

                                Note: Calling stream.read([size]) after the 'end'\nevent has been emitted will return null. No runtime error will be raised.

                                \n" }, { "textRaw": "readable.resume()", @@ -933,10 +934,10 @@ "textRaw": "`options` {Object} ", "options": [ { - "textRaw": "`highWaterMark` {number} The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams ", + "textRaw": "`highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams ", "name": "highWaterMark", "type": "number", - "desc": "The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams" + "desc": "The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams" }, { "textRaw": "`encoding` {string} If specified, then buffers will be decoded to strings using the specified encoding. Defaults to `null` ", @@ -1078,10 +1079,10 @@ "textRaw": "`options` {Object} Passed to both Writable and Readable constructors. Also has the following fields: ", "options": [ { - "textRaw": "`allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then the stream will automatically end the readable side when the writable side ends and vice versa. ", + "textRaw": "`allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then the stream will automatically end the writable side when the readable side ends. ", "name": "allowHalfOpen", "type": "boolean", - "desc": "Defaults to `true`. If set to `false`, then the stream will automatically end the readable side when the writable side ends and vice versa." + "desc": "Defaults to `true`. If set to `false`, then the stream will automatically end the writable side when the readable side ends." }, { "textRaw": "`readableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` for readable side of the stream. Has no effect if `objectMode` is `true`. ", @@ -1244,7 +1245,7 @@ ] } ], - "desc": "

                                Note: This function MUST NOT be called by application code directly. It\nshould be implemented by child classes, and called only by the internal Readable\nclass methods only.

                                \n

                                All Transform stream implementations must provide a _transform()\nmethod to accept input and produce output. The transform._transform()\nimplementation handles the bytes being written, computes an output, then passes\nthat output off to the readable portion using the readable.push() method.

                                \n

                                The transform.push() method may be called zero or more times to generate\noutput from a single input chunk, depending on how much is to be output\nas a result of the chunk.

                                \n

                                It is possible that no output is generated from any given chunk of input data.

                                \n

                                The callback function must be called only when the current chunk is completely\nconsumed. The first argument passed to the callback must be an Error object\nif an error occurred while processing the input or null otherwise. If a second\nargument is passed to the callback, it will be forwarded on to the\nreadable.push() method. In other words the following are equivalent:

                                \n
                                transform.prototype._transform = function(data, encoding, callback) {\n  this.push(data);\n  callback();\n};\n\ntransform.prototype._transform = function(data, encoding, callback) {\n  callback(null, data);\n};\n
                                \n

                                The transform._transform() method is prefixed with an underscore because it\nis internal to the class that defines it, and should never be called directly by\nuser programs.

                                \n" + "desc": "

                                Note: This function MUST NOT be called by application code directly. It\nshould be implemented by child classes, and called only by the internal Readable\nclass methods only.

                                \n

                                All Transform stream implementations must provide a _transform()\nmethod to accept input and produce output. The transform._transform()\nimplementation handles the bytes being written, computes an output, then passes\nthat output off to the readable portion using the readable.push() method.

                                \n

                                The transform.push() method may be called zero or more times to generate\noutput from a single input chunk, depending on how much is to be output\nas a result of the chunk.

                                \n

                                It is possible that no output is generated from any given chunk of input data.

                                \n

                                The callback function must be called only when the current chunk is completely\nconsumed. The first argument passed to the callback must be an Error object\nif an error occurred while processing the input or null otherwise. If a second\nargument is passed to the callback, it will be forwarded on to the\nreadable.push() method. In other words the following are equivalent:

                                \n
                                transform.prototype._transform = function(data, encoding, callback) {\n  this.push(data);\n  callback();\n};\n\ntransform.prototype._transform = function(data, encoding, callback) {\n  callback(null, data);\n};\n
                                \n

                                The transform._transform() method is prefixed with an underscore because it\nis internal to the class that defines it, and should never be called directly by\nuser programs.

                                \n

                                transform._transform() is never called in parallel; streams implement a\nqueue mechanism, and to receive the next chunk, callback must be\ncalled, either synchronously or asynchronously.

                                \n" } ], "modules": [ @@ -1293,6 +1294,13 @@ "desc": "

                                Use of readable.push('') is not recommended.

                                \n

                                Pushing a zero-byte string or Buffer to a stream that is not in object mode\nhas an interesting side effect. Because it is a call to\nreadable.push(), the call will end the reading process.\nHowever, because the argument is an empty string, no data is added to the\nreadable buffer so there is nothing for a user to consume.

                                \n", "type": "misc", "displayName": "`readable.push('')`" + }, + { + "textRaw": "`highWaterMark` discrepency after calling `readable.setEncoding()`", + "name": "`highwatermark`_discrepency_after_calling_`readable.setencoding()`", + "desc": "

                                The use of readable.setEncoding() will change the behavior of how the\nhighWaterMark operates in non-object mode.

                                \n

                                Typically, the size of the current buffer is measured against the\nhighWaterMark in bytes. However, after setEncoding() is called, the\ncomparison function will begin to measure the buffer's size in characters.

                                \n

                                This is not a problem in common cases with latin1 or ascii. But it is\nadvised to be mindful about this behavior when working with strings that could\ncontain multi-byte characters.

                                \n", + "type": "misc", + "displayName": "`highWaterMark` discrepency after calling `readable.setEncoding()`" } ] } diff -Nru nodejs-6.11.2~dfsg/doc/api/stream.md nodejs-6.11.4~dfsg/doc/api/stream.md --- nodejs-6.11.2~dfsg/doc/api/stream.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/stream.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Stream + + > Stability: 2 - Stable A stream is an abstract interface for working with streaming data in Node.js. @@ -66,8 +68,8 @@ The amount of data potentially buffered depends on the `highWaterMark` option passed into the streams constructor. For normal streams, the `highWaterMark` -option specifies a total number of bytes. For streams operating in object mode, -the `highWaterMark` specifies a total number of objects. +option specifies a [total number of bytes][hwm-gotcha]. For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. Data is buffered in Readable streams when the implementation calls [`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not @@ -863,7 +865,7 @@ The optional `size` argument specifies a specific number of bytes to read. If `size` bytes are not available to be read, `null` will be returned *unless* the stream has ended, in which case all of the data remaining in the internal -buffer will be returned (*even if it exceeds `size` bytes*). +buffer will be returned. If the `size` argument is not specified, all of the data contained in the internal buffer will be returned. @@ -1415,9 +1417,9 @@ #### new stream.Readable([options]) * `options` {Object} - * `highWaterMark` {number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams + * `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store + in the internal buffer before ceasing to read from the underlying resource. + Defaults to `16384` (16kb), or `16` for `objectMode` streams * `encoding` {string} If specified, then buffers will be decoded to strings using the specified encoding. Defaults to `null` * `objectMode` {boolean} Whether this stream should behave @@ -1632,8 +1634,8 @@ * `options` {Object} Passed to both Writable and Readable constructors. Also has the following fields: * `allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. + the stream will automatically end the writable side when the + readable side ends. * `readableObjectMode` {boolean} Defaults to `false`. Sets `objectMode` for readable side of the stream. Has no effect if `objectMode` is `true`. @@ -1920,6 +1922,10 @@ is internal to the class that defines it, and should never be called directly by user programs. +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + #### Class: stream.PassThrough The `stream.PassThrough` class is a trivial implementation of a [Transform][] @@ -2027,6 +2033,19 @@ However, because the argument is an empty string, no data is added to the readable buffer so there is nothing for a user to consume. +### `highWaterMark` discrepency after calling `readable.setEncoding()` + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in _bytes_. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in _characters_. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. + [`'data'`]: #stream_event_data [`'drain'`]: #stream_event_drain [`'end'`]: #stream_event_end @@ -2060,6 +2079,9 @@ [HTTP responses, on the server]: http.html#http_class_http_serverresponse [http-incoming-message]: http.html#http_class_http_incomingmessage [Readable]: #stream_class_stream_readable +[zlib]: zlib.html +[hwm-gotcha]: #stream_highWaterMark_discrepency_after_calling_readable_setencoding +[Readable]: #stream_class_stream_readable [stream-_flush]: #stream_transform_flush_callback [stream-_read]: #stream_readable_read_size_1 [stream-_transform]: #stream_transform_transform_chunk_encoding_callback diff -Nru nodejs-6.11.2~dfsg/doc/api/string_decoder.html nodejs-6.11.4~dfsg/doc/api/string_decoder.html --- nodejs-6.11.2~dfsg/doc/api/string_decoder.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/string_decoder.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - String Decoder | Node.js v6.11.2 Documentation + String Decoder | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                              • Globals
                              • HTTP
                              • HTTPS
                              • +
                              • Internationalization
                              • Modules
                              • Net
                              • OS
                              • @@ -72,13 +73,31 @@
                                -

                                Node.js v6.11.2 Documentation

                                +

                                Node.js v6.11.4 Documentation


                                @@ -100,7 +119,8 @@

                                String Decoder#

                                -
                                Stability: 2 - Stable

                                The string_decoder module provides an API for decoding Buffer objects into + +

                                Stability: 2 - Stable

                                The string_decoder module provides an API for decoding Buffer objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. It can be accessed using:

                                const StringDecoder = require('string_decoder').StringDecoder;
                                diff -Nru nodejs-6.11.2~dfsg/doc/api/string_decoder.json nodejs-6.11.4~dfsg/doc/api/string_decoder.json
                                --- nodejs-6.11.2~dfsg/doc/api/string_decoder.json	2017-08-01 05:39:18.000000000 +0000
                                +++ nodejs-6.11.4~dfsg/doc/api/string_decoder.json	2017-10-03 17:11:39.000000000 +0000
                                @@ -4,6 +4,7 @@
                                     {
                                       "textRaw": "String Decoder",
                                       "name": "string_decoder",
                                +      "introduced_in": "v0.10.0",
                                       "stability": 2,
                                       "stabilityText": "Stable",
                                       "desc": "

                                The string_decoder module provides an API for decoding Buffer objects into\nstrings in a manner that preserves encoded multi-byte UTF-8 and UTF-16\ncharacters. It can be accessed using:

                                \n
                                const StringDecoder = require('string_decoder').StringDecoder;\n
                                \n

                                The following example shows the basic use of the StringDecoder class.

                                \n
                                const StringDecoder = require('string_decoder').StringDecoder;\nconst decoder = new StringDecoder('utf8');\n\nconst cent = Buffer.from([0xC2, 0xA2]);\nconsole.log(decoder.write(cent));\n\nconst euro = Buffer.from([0xE2, 0x82, 0xAC]);\nconsole.log(decoder.write(euro));\n
                                \n

                                When a Buffer instance is written to the StringDecoder instance, an\ninternal buffer is used to ensure that the decoded string does not contain\nany incomplete multibyte characters. These are held in the buffer until the\nnext call to stringDecoder.write() or until stringDecoder.end() is called.

                                \n

                                In the following example, the three UTF-8 encoded bytes of the European Euro\nsymbol () are written over three separate operations:

                                \n
                                const StringDecoder = require('string_decoder').StringDecoder;\nconst decoder = new StringDecoder('utf8');\n\ndecoder.write(Buffer.from([0xE2]));\ndecoder.write(Buffer.from([0x82]));\nconsole.log(decoder.end(Buffer.from([0xAC])));\n
                                \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/string_decoder.md nodejs-6.11.4~dfsg/doc/api/string_decoder.md --- nodejs-6.11.2~dfsg/doc/api/string_decoder.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/string_decoder.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # String Decoder + + > Stability: 2 - Stable The `string_decoder` module provides an API for decoding `Buffer` objects into diff -Nru nodejs-6.11.2~dfsg/doc/api/synopsis.html nodejs-6.11.4~dfsg/doc/api/synopsis.html --- nodejs-6.11.2~dfsg/doc/api/synopsis.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/synopsis.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - Usage | Node.js v6.11.2 Documentation + Usage | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                              • Globals
                              • HTTP
                              • HTTPS
                              • +
                              • Internationalization
                              • Modules
                              • Net
                              • OS
                              • @@ -72,13 +73,31 @@
                                -

                                Node.js v6.11.2 Documentation

                                +

                                Node.js v6.11.4 Documentation


                                @@ -96,6 +115,7 @@

                                Usage#

                                +

                                node [options] [v8 options] [script.js | -e "script"] [arguments]

                                Please see the Command Line Options document for information about diff -Nru nodejs-6.11.2~dfsg/doc/api/synopsis.json nodejs-6.11.4~dfsg/doc/api/synopsis.json --- nodejs-6.11.2~dfsg/doc/api/synopsis.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/synopsis.json 2017-10-03 17:11:39.000000000 +0000 @@ -1,9 +1,11 @@ { "source": "doc/api/synopsis.md", + "introduced_in": "v0.10.0", "miscs": [ { "textRaw": "Usage", "name": "Usage", + "introduced_in": "v0.10.0", "type": "misc", "desc": "

                                node [options] [v8 options] [script.js | -e "script"] [arguments]

                                \n

                                Please see the Command Line Options document for information about\ndifferent options and ways to run scripts with Node.js.

                                \n

                                Example

                                \n

                                An example of a web server written with Node.js which responds with\n'Hello World':

                                \n
                                const http = require('http');\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\nconst server = http.createServer((req, res) => {\n  res.statusCode = 200;\n  res.setHeader('Content-Type', 'text/plain');\n  res.end('Hello World\\n');\n});\n\nserver.listen(port, hostname, () => {\n  console.log(`Server running at http://${hostname}:${port}/`);\n});\n
                                \n

                                To run the server, put the code into a file called example.js and execute\nit with Node.js:

                                \n
                                $ node example.js\nServer running at http://127.0.0.1:3000/\n
                                \n

                                All of the examples in the documentation can be run similarly.

                                \n" } diff -Nru nodejs-6.11.2~dfsg/doc/api/synopsis.md nodejs-6.11.4~dfsg/doc/api/synopsis.md --- nodejs-6.11.2~dfsg/doc/api/synopsis.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/synopsis.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,6 @@ # Usage + `node [options] [v8 options] [script.js | -e "script"] [arguments]` diff -Nru nodejs-6.11.2~dfsg/doc/api/timers.html nodejs-6.11.4~dfsg/doc/api/timers.html --- nodejs-6.11.2~dfsg/doc/api/timers.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/timers.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - Timers | Node.js v6.11.2 Documentation + Timers | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                              • Globals
                              • HTTP
                              • HTTPS
                              • +
                              • Internationalization
                              • Modules
                              • Net
                              • OS
                              • @@ -72,13 +73,31 @@
                                -

                                Node.js v6.11.2 Documentation

                                +

                                Node.js v6.11.4 Documentation


                                @@ -113,7 +132,8 @@

                                Timers#

                                -
                                Stability: 2 - Stable

                                The timer module exposes a global API for scheduling functions to + +

                                Stability: 2 - Stable

                                The timer module exposes a global API for scheduling functions to be called at some future period of time. Because the timer functions are globals, there is no need to call require('timers') to use the API.

                                The timer functions within Node.js implement a similar API as the timers API diff -Nru nodejs-6.11.2~dfsg/doc/api/timers.json nodejs-6.11.4~dfsg/doc/api/timers.json --- nodejs-6.11.2~dfsg/doc/api/timers.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/timers.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Timers", "name": "timers", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                The timer module exposes a global API for scheduling functions to\nbe called at some future period of time. Because the timer functions are\nglobals, there is no need to call require('timers') to use the API.

                                \n

                                The timer functions within Node.js implement a similar API as the timers API\nprovided by Web Browsers but use a different internal implementation that is\nbuilt around the Node.js Event Loop.

                                \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/timers.md nodejs-6.11.4~dfsg/doc/api/timers.md --- nodejs-6.11.2~dfsg/doc/api/timers.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/timers.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Timers + + > Stability: 2 - Stable The `timer` module exposes a global API for scheduling functions to diff -Nru nodejs-6.11.2~dfsg/doc/api/tls.html nodejs-6.11.4~dfsg/doc/api/tls.html --- nodejs-6.11.2~dfsg/doc/api/tls.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/tls.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - TLS (SSL) | Node.js v6.11.2 Documentation + TLS (SSL) | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                              • Globals
                              • HTTP
                              • HTTPS
                              • +
                              • Internationalization
                              • Modules
                              • Net
                              • OS
                              • @@ -72,13 +73,31 @@
                                -

                                Node.js v6.11.2 Documentation

                                +

                                Node.js v6.11.4 Documentation


                                @@ -159,7 +178,8 @@

                                TLS (SSL)#

                                -
                                Stability: 2 - Stable

                                The tls module provides an implementation of the Transport Layer Security + +

                                Stability: 2 - Stable

                                The tls module provides an implementation of the Transport Layer Security (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. The module can be accessed using:

                                const tls = require('tls');
                                @@ -1056,7 +1076,7 @@
                                 
                                Stability: 0 - Deprecated: Use tls.TLSSocket instead.

                                The tls.CryptoStream class represents a stream of encrypted data. This class +

                                Stability: 0 - Deprecated: Use tls.TLSSocket instead.

                                The tls.CryptoStream class represents a stream of encrypted data. This class has been deprecated and should no longer be used.

                                cryptoStream.bytesWritten#

                                Stability: 0 - Deprecated: Use tls.TLSSocket instead.

                                Returned by tls.createSecurePair().

                                Event: 'secure'#

                                Stability: 0 - Deprecated: Use tls.TLSSocket instead.
                                • context <Object> A secure context object as returned by tls.createSecureContext()
                                • isServer <boolean> true to specify that this TLS connection should be diff -Nru nodejs-6.11.2~dfsg/doc/api/tls.json nodejs-6.11.4~dfsg/doc/api/tls.json --- nodejs-6.11.2~dfsg/doc/api/tls.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/tls.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "TLS (SSL)", "name": "tls_(ssl)", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                  The tls module provides an implementation of the Transport Layer Security\n(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.\nThe module can be accessed using:

                                  \n
                                  const tls = require('tls');\n
                                  \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/tls.md nodejs-6.11.4~dfsg/doc/api/tls.md --- nodejs-6.11.2~dfsg/doc/api/tls.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/tls.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # TLS (SSL) + + > Stability: 2 - Stable The `tls` module provides an implementation of the Transport Layer Security diff -Nru nodejs-6.11.2~dfsg/doc/api/_toc.html nodejs-6.11.4~dfsg/doc/api/_toc.html --- nodejs-6.11.2~dfsg/doc/api/_toc.html 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/_toc.html 2017-10-03 17:11:38.000000000 +0000 @@ -2,7 +2,7 @@ - Index | Node.js v6.11.2 Documentation + Index | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                • Globals
                                • HTTP
                                • HTTPS
                                • +
                                • Internationalization
                                • Modules
                                • Net
                                • OS
                                • @@ -72,13 +73,20 @@
                                  -

                                  Node.js v6.11.2 Documentation

                                  +

                                  Node.js v6.11.4 Documentation


                                  @@ -113,6 +121,7 @@
                                • Globals
                                • HTTP
                                • HTTPS
                                • +
                                • Internationalization
                                • Modules
                                • Net
                                • OS
                                • diff -Nru nodejs-6.11.2~dfsg/doc/api/_toc.json nodejs-6.11.4~dfsg/doc/api/_toc.json --- nodejs-6.11.2~dfsg/doc/api/_toc.json 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/_toc.json 2017-10-03 17:11:38.000000000 +0000 @@ -218,6 +218,16 @@ }, { "type": "text", + "text": "[Internationalization](intl.html)" + }, + { + "type": "list_item_end" + }, + { + "type": "list_item_start" + }, + { + "type": "text", "text": "[Modules](modules.html)" }, { diff -Nru nodejs-6.11.2~dfsg/doc/api/_toc.md nodejs-6.11.4~dfsg/doc/api/_toc.md --- nodejs-6.11.2~dfsg/doc/api/_toc.md 2017-08-01 05:39:13.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/_toc.md 2017-10-03 17:11:27.000000000 +0000 @@ -22,6 +22,7 @@ * [Globals](globals.html) * [HTTP](http.html) * [HTTPS](https.html) +* [Internationalization](intl.html) * [Modules](modules.html) * [Net](net.html) * [OS](os.html) diff -Nru nodejs-6.11.2~dfsg/doc/api/tty.html nodejs-6.11.4~dfsg/doc/api/tty.html --- nodejs-6.11.2~dfsg/doc/api/tty.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/tty.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - TTY | Node.js v6.11.2 Documentation + TTY | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                • Globals
                                • HTTP
                                • HTTPS
                                • +
                                • Internationalization
                                • Modules
                                • Net
                                • OS
                                • @@ -72,13 +73,31 @@
                                  -

                                  Node.js v6.11.2 Documentation

                                  +

                                  Node.js v6.11.4 Documentation


                                  @@ -107,7 +126,8 @@

                                  TTY#

                                  -
                                  Stability: 2 - Stable

                                  The tty module provides the tty.ReadStream and tty.WriteStream classes. + +

                                  Stability: 2 - Stable

                                  The tty module provides the tty.ReadStream and tty.WriteStream classes. In most cases, it will not be necessary or possible to use this module directly. However, it can be accessed using:

                                  const tty = require('tty');
                                  @@ -169,6 +189,14 @@
                                     console.log(`${process.stdout.columns}x${process.stdout.rows}`);
                                   });
                                   
                                  +

                                  Note: On Windows resize events will be emitted only if stdin is unpaused +(by a call to resume() or by adding a data listener) and in raw mode. It can +also be triggered if a terminal control sequence that moves the cursor is +written to the screen. Also, the resize event will only be signaled if the +console screen buffer height was also changed. For example shrinking the +console window height will not cause the resize event to be emitted. Increasing +the console window height will only be registered when the new console window +height is greater than the current console buffer size.

                                  writeStream.columns#

                                  Stability: 0 - Deprecated
                                  • object <any>

                                  Internal alias for Array.isArray.

                                  @@ -472,7 +493,7 @@
                                  Stability: 0 - Deprecated
                                    +
                                  Stability: 0 - Deprecated
                                  • object <any>

                                  Returns true if the given object is a Boolean. Otherwise, returns false.

                                  @@ -489,7 +510,7 @@
                                  Stability: 0 - Deprecated: Use Buffer.isBuffer() instead.
                                    +
                                  Stability: 0 - Deprecated: Use Buffer.isBuffer() instead.
                                  • object <any>

                                  Returns true if the given object is a Buffer. Otherwise, returns false.

                                  @@ -506,7 +527,7 @@
                                  Stability: 0 - Deprecated
                                    +
                                  Stability: 0 - Deprecated
                                  • object <any>

                                  Returns true if the given object is a Date. Otherwise, returns false.

                                  @@ -523,7 +544,7 @@
                                  Stability: 0 - Deprecated
                                    +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is an Error. Otherwise, returns @@ -553,7 +574,7 @@

                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is a Function. Otherwise, returns @@ -574,7 +595,7 @@

                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is strictly null. Otherwise, returns @@ -592,7 +613,7 @@

                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is null or undefined. Otherwise, @@ -610,7 +631,7 @@

                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is a Number. Otherwise, returns false.

                                @@ -629,7 +650,7 @@
                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is strictly an Object and not a @@ -649,7 +670,7 @@

                                Stability: 0 - Deprecated
                                  +
                                Stability: 0 - Deprecated
                                • object <any>

                                Returns true if the given object is a primitive type. Otherwise, returns @@ -679,7 +700,7 @@

                                Stability: 0 - Deprecated
                                  +
                                  Stability: 0 - Deprecated
                                  • object <any>

                                  Returns true if the given object is a RegExp. Otherwise, returns false.

                                  @@ -696,7 +717,7 @@
                                  Stability: 0 - Deprecated
                                    +
                                    Stability: 0 - Deprecated
                                    • object <any>

                                    Returns true if the given object is a string. Otherwise, returns false.

                                    @@ -715,7 +736,7 @@
                                    Stability: 0 - Deprecated
                                      +
                                      Stability: 0 - Deprecated
                                      • object <any>

                                      Returns true if the given object is a Symbol. Otherwise, returns false.

                                      @@ -732,7 +753,7 @@
                                      Stability: 0 - Deprecated
                                        +
                                        Stability: 0 - Deprecated
                                        • object <any>

                                        Returns true if the given object is undefined. Otherwise, returns false.

                                        @@ -750,7 +771,7 @@
                                        Stability: 0 - Deprecated: Use a third party module instead.
                                          +
                                          Stability: 0 - Deprecated: Use a third party module instead.

                                          The util.log() method prints the given string to stdout with an included @@ -763,17 +784,17 @@

                                          Stability: 0 - Deprecated: Use console.log() instead.

                                          Deprecated predecessor of console.log.

                                          +
                                          Stability: 0 - Deprecated: Use console.log() instead.

                                          Deprecated predecessor of console.log.

                                          util.puts([...strings])#

                                          Stability: 0 - Deprecated: Use console.log() instead.

                                          Deprecated predecessor of console.log.

                                          +
                                          Stability: 0 - Deprecated: Use console.log() instead.

                                          Deprecated predecessor of console.log.

                                          util._extend(target, source)#

                                          Stability: 0 - Deprecated: Use Object.assign() instead.

                                          The util._extend() method was never intended to be used outside of internal +

                                          Stability: 0 - Deprecated: Use Object.assign() instead.

                                          The util._extend() method was never intended to be used outside of internal Node.js modules. The community found and used it anyway.

                                          It is deprecated and should not be used in new code. JavaScript comes with very similar built-in functionality through Object.assign().

                                          diff -Nru nodejs-6.11.2~dfsg/doc/api/util.json nodejs-6.11.4~dfsg/doc/api/util.json --- nodejs-6.11.2~dfsg/doc/api/util.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/util.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Util", "name": "util", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                          The util module is primarily designed to support the needs of Node.js' own\ninternal APIs. However, many of the utilities are useful for application and\nmodule developers as well. It can be accessed using:

                                          \n
                                          const util = require('util');\n
                                          \n", @@ -103,7 +104,7 @@ ] } ], - "desc": "

                                          The util.format() method returns a formatted string using the first argument\nas a printf-like format.

                                          \n

                                          The first argument is a string containing zero or more placeholder tokens.\nEach placeholder token is replaced with the converted value from the\ncorresponding argument. Supported placeholders are:

                                          \n
                                            \n
                                          • %s - String.
                                          • \n
                                          • %d - Number (both integer and float).
                                          • \n
                                          • %j - JSON. Replaced with the string '[Circular]' if the argument\ncontains circular references.
                                          • \n
                                          • %% - single percent sign ('%'). This does not consume an argument.
                                          • \n
                                          \n

                                          If the placeholder does not have a corresponding argument, the placeholder is\nnot replaced.

                                          \n
                                          util.format('%s:%s', 'foo');\n// Returns: 'foo:%s'\n
                                          \n

                                          If there are more arguments passed to the util.format() method than the\nnumber of placeholders, the extra arguments are coerced into strings (for\nobjects and symbols, util.inspect() is used) then concatenated to the\nreturned string, each delimited by a space.

                                          \n
                                          util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'\n
                                          \n

                                          If the first argument is not a format string then util.format() returns\na string that is the concatenation of all arguments separated by spaces.\nEach argument is converted to a string using util.inspect().

                                          \n
                                          util.format(1, 2, 3); // '1 2 3'\n
                                          \n

                                          If only one argument is passed to util.format(), it is returned as it is\nwithout any formatting.

                                          \n
                                          util.format('%% %s'); // '%% %s'\n
                                          \n" + "desc": "

                                          The util.format() method returns a formatted string using the first argument\nas a printf-like format.

                                          \n

                                          The first argument is a string containing zero or more placeholder tokens.\nEach placeholder token is replaced with the converted value from the\ncorresponding argument. Supported placeholders are:

                                          \n
                                            \n
                                          • %s - String.
                                          • \n
                                          • %d - Number (both integer and float).
                                          • \n
                                          • %j - JSON. Replaced with the string '[Circular]' if the argument\ncontains circular references.
                                          • \n
                                          • %% - single percent sign ('%'). This does not consume an argument.
                                          • \n
                                          \n

                                          If the placeholder does not have a corresponding argument, the placeholder is\nnot replaced.

                                          \n
                                          util.format('%s:%s', 'foo');\n// Returns: 'foo:%s'\n
                                          \n

                                          If there are more arguments passed to the util.format() method than the number\nof placeholders, the extra arguments are coerced into strings then concatenated\nto the returned string, each delimited by a space. Excessive arguments whose\ntypeof is 'object' or 'symbol' (except null) will be transformed by\nutil.inspect().

                                          \n
                                          util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'\n
                                          \n

                                          If the first argument is not a string then util.format() returns\na string that is the concatenation of all arguments separated by spaces.\nEach argument is converted to a string using util.inspect().

                                          \n
                                          util.format(1, 2, 3); // '1 2 3'\n
                                          \n

                                          If only one argument is passed to util.format(), it is returned as it is\nwithout any formatting.

                                          \n
                                          util.format('%% %s'); // '%% %s'\n
                                          \n" }, { "textRaw": "util.inherits(constructor, superConstructor)", diff -Nru nodejs-6.11.2~dfsg/doc/api/util.md nodejs-6.11.4~dfsg/doc/api/util.md --- nodejs-6.11.2~dfsg/doc/api/util.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/util.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Util + + > Stability: 2 - Stable The `util` module is primarily designed to support the needs of Node.js' own @@ -116,16 +118,17 @@ // Returns: 'foo:%s' ``` -If there are more arguments passed to the `util.format()` method than the -number of placeholders, the extra arguments are coerced into strings (for -objects and symbols, `util.inspect()` is used) then concatenated to the -returned string, each delimited by a space. +If there are more arguments passed to the `util.format()` method than the number +of placeholders, the extra arguments are coerced into strings then concatenated +to the returned string, each delimited by a space. Excessive arguments whose +`typeof` is `'object'` or `'symbol'` (except `null`) will be transformed by +`util.inspect()`. ```js util.format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz' ``` -If the first argument is not a format string then `util.format()` returns +If the first argument is not a string then `util.format()` returns a string that is the concatenation of all arguments separated by spaces. Each argument is converted to a string using `util.inspect()`. diff -Nru nodejs-6.11.2~dfsg/doc/api/v8.html nodejs-6.11.4~dfsg/doc/api/v8.html --- nodejs-6.11.2~dfsg/doc/api/v8.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/v8.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - V8 | Node.js v6.11.2 Documentation + V8 | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                        • Globals
                                        • HTTP
                                        • HTTPS
                                        • +
                                        • Internationalization
                                        • Modules
                                        • Net
                                        • OS
                                        • @@ -72,13 +73,28 @@
                                          -

                                          Node.js v6.11.2 Documentation

                                          +

                                          Node.js v6.11.4 Documentation


                                          @@ -98,6 +114,7 @@

                                          V8#

                                          +

                                          The v8 module exposes APIs that are specific to the version of V8 built into the Node.js binary. It can be accessed using:

                                          const v8 = require('v8');
                                          @@ -132,7 +149,7 @@
                                           

                                          Returns statistics about the V8 heap spaces, i.e. the segments which make up the V8 heap. Neither the ordering of heap spaces, nor the availability of a heap space can be guaranteed as the statistics are provided via the V8 -GetHeapSpaceStatistics function and may change from one V8 version to the +GetHeapSpaceStatistics function and may change from one V8 version to the next.

                                          The value returned is an array of objects containing the following properties:

                                            diff -Nru nodejs-6.11.2~dfsg/doc/api/v8.json nodejs-6.11.4~dfsg/doc/api/v8.json --- nodejs-6.11.2~dfsg/doc/api/v8.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/v8.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "V8", "name": "v8", + "introduced_in": "v4.0.0", "desc": "

                                            The v8 module exposes APIs that are specific to the version of V8\nbuilt into the Node.js binary. It can be accessed using:

                                            \n
                                            const v8 = require('v8');\n
                                            \n

                                            Note: The APIs and implementation are subject to change at any time.

                                            \n", "methods": [ { @@ -31,7 +32,7 @@ "v6.0.0" ] }, - "desc": "

                                            Returns statistics about the V8 heap spaces, i.e. the segments which make up\nthe V8 heap. Neither the ordering of heap spaces, nor the availability of a\nheap space can be guaranteed as the statistics are provided via the V8\nGetHeapSpaceStatistics function and may change from one V8 version to the\nnext.

                                            \n

                                            The value returned is an array of objects containing the following properties:

                                            \n
                                              \n
                                            • space_name {string}
                                            • \n
                                            • space_size {number}
                                            • \n
                                            • space_used_size {number}
                                            • \n
                                            • space_available_size {number}
                                            • \n
                                            • physical_space_size {number}
                                            • \n
                                            \n

                                            For example:

                                            \n
                                            [\n  {\n    "space_name": "new_space",\n    "space_size": 2063872,\n    "space_used_size": 951112,\n    "space_available_size": 80824,\n    "physical_space_size": 2063872\n  },\n  {\n    "space_name": "old_space",\n    "space_size": 3090560,\n    "space_used_size": 2493792,\n    "space_available_size": 0,\n    "physical_space_size": 3090560\n  },\n  {\n    "space_name": "code_space",\n    "space_size": 1260160,\n    "space_used_size": 644256,\n    "space_available_size": 960,\n    "physical_space_size": 1260160\n  },\n  {\n    "space_name": "map_space",\n    "space_size": 1094160,\n    "space_used_size": 201608,\n    "space_available_size": 0,\n    "physical_space_size": 1094160\n  },\n  {\n    "space_name": "large_object_space",\n    "space_size": 0,\n    "space_used_size": 0,\n    "space_available_size": 1490980608,\n    "physical_space_size": 0\n  }\n]\n
                                            \n", + "desc": "

                                            Returns statistics about the V8 heap spaces, i.e. the segments which make up\nthe V8 heap. Neither the ordering of heap spaces, nor the availability of a\nheap space can be guaranteed as the statistics are provided via the V8\nGetHeapSpaceStatistics function and may change from one V8 version to the\nnext.

                                            \n

                                            The value returned is an array of objects containing the following properties:

                                            \n
                                              \n
                                            • space_name {string}
                                            • \n
                                            • space_size {number}
                                            • \n
                                            • space_used_size {number}
                                            • \n
                                            • space_available_size {number}
                                            • \n
                                            • physical_space_size {number}
                                            • \n
                                            \n

                                            For example:

                                            \n
                                            [\n  {\n    "space_name": "new_space",\n    "space_size": 2063872,\n    "space_used_size": 951112,\n    "space_available_size": 80824,\n    "physical_space_size": 2063872\n  },\n  {\n    "space_name": "old_space",\n    "space_size": 3090560,\n    "space_used_size": 2493792,\n    "space_available_size": 0,\n    "physical_space_size": 3090560\n  },\n  {\n    "space_name": "code_space",\n    "space_size": 1260160,\n    "space_used_size": 644256,\n    "space_available_size": 960,\n    "physical_space_size": 1260160\n  },\n  {\n    "space_name": "map_space",\n    "space_size": 1094160,\n    "space_used_size": 201608,\n    "space_available_size": 0,\n    "physical_space_size": 1094160\n  },\n  {\n    "space_name": "large_object_space",\n    "space_size": 0,\n    "space_used_size": 0,\n    "space_available_size": 1490980608,\n    "physical_space_size": 0\n  }\n]\n
                                            \n", "signatures": [ { "params": [] diff -Nru nodejs-6.11.2~dfsg/doc/api/v8.md nodejs-6.11.4~dfsg/doc/api/v8.md --- nodejs-6.11.2~dfsg/doc/api/v8.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/v8.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # V8 + + The `v8` module exposes APIs that are specific to the version of [V8][] built into the Node.js binary. It can be accessed using: @@ -122,4 +124,4 @@ [V8]: https://developers.google.com/v8/ [here]: https://github.com/thlorenz/v8-flags/blob/master/flags-0.11.md -[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-5.0/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 +[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-8.0/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 diff -Nru nodejs-6.11.2~dfsg/doc/api/vm.html nodejs-6.11.4~dfsg/doc/api/vm.html --- nodejs-6.11.2~dfsg/doc/api/vm.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/vm.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - VM (Executing JavaScript) | Node.js v6.11.2 Documentation + VM (Executing JavaScript) | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                          • Globals
                                          • HTTP
                                          • HTTPS
                                          • +
                                          • Internationalization
                                          • Modules
                                          • Net
                                          • OS
                                          • @@ -72,13 +73,31 @@
                                            -

                                            Node.js v6.11.2 Documentation

                                            +

                                            Node.js v6.11.4 Documentation


                                            @@ -110,7 +129,8 @@

                                            VM (Executing JavaScript)#

                                            -
                                            Stability: 2 - Stable
                                            + +
                                            Stability: 2 - Stable

                                            The vm module provides APIs for compiling and running code within V8 Virtual Machine contexts. It can be accessed using:

                                            const vm = require('vm');
                                            diff -Nru nodejs-6.11.2~dfsg/doc/api/vm.json nodejs-6.11.4~dfsg/doc/api/vm.json
                                            --- nodejs-6.11.2~dfsg/doc/api/vm.json	2017-08-01 05:39:18.000000000 +0000
                                            +++ nodejs-6.11.4~dfsg/doc/api/vm.json	2017-10-03 17:11:39.000000000 +0000
                                            @@ -4,6 +4,7 @@
                                                 {
                                                   "textRaw": "VM (Executing JavaScript)",
                                                   "name": "vm",
                                            +      "introduced_in": "v0.10.0",
                                                   "stability": 2,
                                                   "stabilityText": "Stable",
                                                   "desc": "

                                            The vm module provides APIs for compiling and running code within V8 Virtual\nMachine contexts. It can be accessed using:

                                            \n
                                            const vm = require('vm');\n
                                            \n

                                            JavaScript code can be compiled and run immediately or compiled, saved, and run\nlater.

                                            \n

                                            Note: The vm module is not a security mechanism.\nDo not use it to run untrusted code.

                                            \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/vm.md nodejs-6.11.4~dfsg/doc/api/vm.md --- nodejs-6.11.2~dfsg/doc/api/vm.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/vm.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # VM (Executing JavaScript) + + > Stability: 2 - Stable diff -Nru nodejs-6.11.2~dfsg/doc/api/zlib.html nodejs-6.11.4~dfsg/doc/api/zlib.html --- nodejs-6.11.2~dfsg/doc/api/zlib.html 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/zlib.html 2017-10-03 17:11:39.000000000 +0000 @@ -2,7 +2,7 @@ - Zlib | Node.js v6.11.2 Documentation + Zlib | Node.js v6.11.4 Documentation @@ -40,6 +40,7 @@
                                          • Globals
                                          • HTTP
                                          • HTTPS
                                          • +
                                          • Internationalization
                                          • Modules
                                          • Net
                                          • OS
                                          • @@ -72,13 +73,31 @@
                                            -

                                            Node.js v6.11.2 Documentation

                                            +

                                            Node.js v6.11.4 Documentation


                                            @@ -138,7 +157,8 @@

                                            Zlib#

                                            -
                                            Stability: 2 - Stable

                                            The zlib module provides compression functionality implemented using Gzip and + +

                                            Stability: 2 - Stable

                                            The zlib module provides compression functionality implemented using Gzip and Deflate/Inflate. It can be accessed using:

                                            const zlib = require('zlib');
                                             
                                            diff -Nru nodejs-6.11.2~dfsg/doc/api/zlib.json nodejs-6.11.4~dfsg/doc/api/zlib.json --- nodejs-6.11.2~dfsg/doc/api/zlib.json 2017-08-01 05:39:18.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/zlib.json 2017-10-03 17:11:39.000000000 +0000 @@ -4,6 +4,7 @@ { "textRaw": "Zlib", "name": "zlib", + "introduced_in": "v0.10.0", "stability": 2, "stabilityText": "Stable", "desc": "

                                            The zlib module provides compression functionality implemented using Gzip and\nDeflate/Inflate. It can be accessed using:

                                            \n
                                            const zlib = require('zlib');\n
                                            \n

                                            Compressing or decompressing a stream (such as a file) can be accomplished by\npiping the source stream data through a zlib stream into a destination stream:

                                            \n
                                            const gzip = zlib.createGzip();\nconst fs = require('fs');\nconst inp = fs.createReadStream('input.txt');\nconst out = fs.createWriteStream('input.txt.gz');\n\ninp.pipe(gzip).pipe(out);\n
                                            \n

                                            It is also possible to compress or decompress data in a single step:

                                            \n
                                            const input = '.................................';\nzlib.deflate(input, (err, buffer) => {\n  if (!err) {\n    console.log(buffer.toString('base64'));\n  } else {\n    // handle error\n  }\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nzlib.unzip(buffer, (err, buffer) => {\n  if (!err) {\n    console.log(buffer.toString());\n  } else {\n    // handle error\n  }\n});\n
                                            \n", diff -Nru nodejs-6.11.2~dfsg/doc/api/zlib.md nodejs-6.11.4~dfsg/doc/api/zlib.md --- nodejs-6.11.2~dfsg/doc/api/zlib.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api/zlib.md 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ # Zlib + + > Stability: 2 - Stable The `zlib` module provides compression functionality implemented using Gzip and diff -Nru nodejs-6.11.2~dfsg/doc/api_assets/style.css nodejs-6.11.4~dfsg/doc/api_assets/style.css --- nodejs-6.11.2~dfsg/doc/api_assets/style.css 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/api_assets/style.css 2017-10-03 17:11:27.000000000 +0000 @@ -81,6 +81,73 @@ #gtoc { font-size: .8em; + margin-bottom: 1em; +} + +#gtoc ul { + list-style: none; + margin-left: 0; +} + +#gtoc li { + display: inline; + border-right: 1px #000 solid; + margin-right: 0.4em; + padding-right: 0.4em; +} + +#gtoc li:last-child { + border-right: none; + margin-right: 0; + padding-right: 0; +} + +li.version-picker { + position: relative; +} + +li.version-picker:hover > ol { + display: block; +} + +li.version-picker a span { + font-size: .7em; +} + +ol.version-picker { + background: #fff; + border: 1px #43853d solid; + border-radius: 2px; + display: none; + list-style: none; + position: absolute; + right: -2px; + width: 101%; +} + +#gtoc ol.version-picker li { + display: block; + border-right: 0; + margin-right: 0; + width: 100%; +} + +ol.version-picker li a { + border-radius: 0; + display: block; + margin: 0; + padding: .1em; + padding-left: 1em; +} + +ol.version-picker li:first-child a { + border-top-right-radius: 1px; + border-top-left-radius: 1px; +} + +ol.version-picker li:last-child a { + border-bottom-right-radius: 1px; + border-bottom-left-radius: 1px; } .line { @@ -93,7 +160,8 @@ color: white !important; margin: 0 0 1em 0; font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif; - font-weight: 700; + padding: 1em; + line-height: 1.5; } .api_stability * { @@ -495,6 +563,9 @@ #content { font-size: 3.5em; } + #gtoc { + font-size: 0.6em; + } } @media print { diff -Nru nodejs-6.11.2~dfsg/doc/changelogs/CHANGELOG_V6.md nodejs-6.11.4~dfsg/doc/changelogs/CHANGELOG_V6.md --- nodejs-6.11.2~dfsg/doc/changelogs/CHANGELOG_V6.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/changelogs/CHANGELOG_V6.md 2017-10-03 17:11:27.000000000 +0000 @@ -7,6 +7,8 @@ +6.11.4
                                            +6.11.3
                                            6.11.2
                                            6.11.1
                                            6.11.0
                                            @@ -51,6 +53,283 @@ [Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and will be supported actively until April 2018 and maintained until April 2019. + +## 2017-10-03, Version 6.11.4 'Boron' (LTS), @MylesBorins + +This LTS release comes with 91 commits. This includes 29 which are test related, +28 which are doc related, 11 which are build / tool related and 3 commits which are updates to dependencies. + +### Notable Changes + +* **net**: + - support passing undefined to listen() to match behavior in v4.x and v8.x (Sam Roberts) [#14234](https://github.com/nodejs/node/pull/14234) + +### Commits + +* [[`73416b46e4`](https://github.com/nodejs/node/commit/73416b46e4)] - **assert**: refactor the code (Ruben Bridgewater) [#13862](https://github.com/nodejs/node/pull/13862) +* [[`a8b917ee2f`](https://github.com/nodejs/node/commit/a8b917ee2f)] - **benchmark**: fix dgram/bind-params.js benchmark (Rich Trott) [#14948](https://github.com/nodejs/node/pull/14948) +* [[`855d7ae326`](https://github.com/nodejs/node/commit/855d7ae326)] - **benchmark**: convert var to es6 const (Sebastian Murphy) [#12886](https://github.com/nodejs/node/pull/12886) +* [[`6a7e46ed9c`](https://github.com/nodejs/node/commit/6a7e46ed9c)] - **build**: add NetBSD support to opensslconf.h (Roy Marples) [#14313](https://github.com/nodejs/node/pull/14313) +* [[`66dd898be8`](https://github.com/nodejs/node/commit/66dd898be8)] - **build**: better support for python3 systems (Ben Noordhuis) [#14737](https://github.com/nodejs/node/pull/14737) +* [[`14cc1abb56`](https://github.com/nodejs/node/commit/14cc1abb56)] - **build**: split up cpplint to avoid long cmd lines (Kyle Farnung) [#14116](https://github.com/nodejs/node/pull/14116) +* [[`c9ae894277`](https://github.com/nodejs/node/commit/c9ae894277)] - **build**: add lint option to vcbuild.bat help (Morgan Brenner) [#11992](https://github.com/nodejs/node/pull/11992) +* [[`66cdcd9d5b`](https://github.com/nodejs/node/commit/66cdcd9d5b)] - **build**: add cpp linting to windows build (liusi) [#11856](https://github.com/nodejs/node/pull/11856) +* [[`25be2a3be3`](https://github.com/nodejs/node/commit/25be2a3be3)] - **crypto**: naming anonymous functions. (solebox) [#8993](https://github.com/nodejs/node/pull/8993) +* [[`4e1a50a079`](https://github.com/nodejs/node/commit/4e1a50a079)] - **deps**: backport 0353a1e from V8 upstream (jBarz) [#15287](https://github.com/nodejs/node/pull/15287) +* [[`921876dcd1`](https://github.com/nodejs/node/commit/921876dcd1)] - **deps**: backport 071b655 from V8 upstream (Michaël Zasso) [#15215](https://github.com/nodejs/node/pull/15215) +* [[`a13ac69ff9`](https://github.com/nodejs/node/commit/a13ac69ff9)] - **doc**: prevent displaying empty version picker (Chris Young) [#15420](https://github.com/nodejs/node/pull/15420) +* [[`ecea33b277`](https://github.com/nodejs/node/commit/ecea33b277)] - **doc**: add links to alternative versions of doc (Chris Young) [#10958](https://github.com/nodejs/node/pull/10958) +* [[`feb6863a5c`](https://github.com/nodejs/node/commit/feb6863a5c)] - **doc**: document bytes to chars after setEncoding (Jessica Quynh Tran) [#13442](https://github.com/nodejs/node/pull/13442) +* [[`33fdbb5417`](https://github.com/nodejs/node/commit/33fdbb5417)] - **doc**: describe what security issues are (Sam Roberts) [#14485](https://github.com/nodejs/node/pull/14485) +* [[`a260190717`](https://github.com/nodejs/node/commit/a260190717)] - **doc**: instructions for generating coverage reports (Simon Brewster) [#15190](https://github.com/nodejs/node/pull/15190) +* [[`1b0e660c25`](https://github.com/nodejs/node/commit/1b0e660c25)] - **doc**: /s/SHASUM256/SHASUMS256 (Jon Moss) [#15101](https://github.com/nodejs/node/pull/15101) +* [[`5696223534`](https://github.com/nodejs/node/commit/5696223534)] - **doc**: clarify http.get data consumption requirement (AJ Jordan) [#15049](https://github.com/nodejs/node/pull/15049) +* [[`4c26913dab`](https://github.com/nodejs/node/commit/4c26913dab)] - **doc**: crypto.randomBytes does not block when async (Sam Roberts) [#14993](https://github.com/nodejs/node/pull/14993) +* [[`605a02b613`](https://github.com/nodejs/node/commit/605a02b613)] - **doc**: environmental-\>environment & NodeJS-\>Node.js (Rod Vagg) [#14974](https://github.com/nodejs/node/pull/14974) +* [[`b10bc31030`](https://github.com/nodejs/node/commit/b10bc31030)] - **doc**: fix typo in Buffer.from(string, \[encoding\]) (Michał Wadas) [#15013](https://github.com/nodejs/node/pull/15013) +* [[`29de000938`](https://github.com/nodejs/node/commit/29de000938)] - **doc**: add note for Windows build path (Kyle Lamse) [#14354](https://github.com/nodejs/node/pull/14354) +* [[`7546eef262`](https://github.com/nodejs/node/commit/7546eef262)] - **doc**: rephrase text of child_process.execSync() (hafiz) [#14953](https://github.com/nodejs/node/pull/14953) +* [[`70e9a6ece3`](https://github.com/nodejs/node/commit/70e9a6ece3)] - **doc**: link to correct "OS Constants" heading in docs (James Kyle) [#14969](https://github.com/nodejs/node/pull/14969) +* [[`55dc14ec61`](https://github.com/nodejs/node/commit/55dc14ec61)] - **doc**: remove misterdjules from the CTC members list (Julien Gilli) [#1498](https://github.com/nodejs/node/pull/1498) +* [[`c76a54f318`](https://github.com/nodejs/node/commit/c76a54f318)] - **doc**: add missing word (Jon Moss) [#14924](https://github.com/nodejs/node/pull/14924) +* [[`27b6737d85`](https://github.com/nodejs/node/commit/27b6737d85)] - **doc**: explain what to do if git push is rejected (Rich Trott) [#14848](https://github.com/nodejs/node/pull/14848) +* [[`d75e9b7d44`](https://github.com/nodejs/node/commit/d75e9b7d44)] - **doc**: add BridgeAR to collaborators (Ruben Bridgewater) [#14862](https://github.com/nodejs/node/pull/14862) +* [[`a63cd82003`](https://github.com/nodejs/node/commit/a63cd82003)] - **doc**: fix word wrapping for api stability boxes (Saad Quadri) [#14809](https://github.com/nodejs/node/pull/14809) +* [[`f8fbac7842`](https://github.com/nodejs/node/commit/f8fbac7842)] - **doc**: improve fs.read() doc text (Rich Trott) [#14631](https://github.com/nodejs/node/pull/14631) +* [[`5a7a49f505`](https://github.com/nodejs/node/commit/5a7a49f505)] - **doc**: clarify the position argument for fs.read (dcharbonnier) [#14631](https://github.com/nodejs/node/pull/14631) +* [[`b5904a2054`](https://github.com/nodejs/node/commit/b5904a2054)] - **doc**: remove undef NDEBUG from addons.md (Daniel Bevenius) [#14048](https://github.com/nodejs/node/pull/14048) +* [[`c0e47e4f22`](https://github.com/nodejs/node/commit/c0e47e4f22)] - **doc**: fix order of AtExit callbacks in addons.md (Daniel Bevenius) [#14048](https://github.com/nodejs/node/pull/14048) +* [[`dcdc9053b4`](https://github.com/nodejs/node/commit/dcdc9053b4)] - **doc**: fix typo in stream.md (Marc Hernández Cabot) [#14364](https://github.com/nodejs/node/pull/14364) +* [[`594e3c2115`](https://github.com/nodejs/node/commit/594e3c2115)] - **doc**: add readline.emitKeypressEvents note (Samuel Reed) [#9447](https://github.com/nodejs/node/pull/9447) +* [[`90fcccd7a3`](https://github.com/nodejs/node/commit/90fcccd7a3)] - **doc**: add documentation on ICU (Timothy Gu) [#13916](https://github.com/nodejs/node/pull/13916) +* [[`38ae5c4e34`](https://github.com/nodejs/node/commit/38ae5c4e34)] - **doc, lib, test**: do not re-require needlessly (Vse Mozhet Byt) [#14244](https://github.com/nodejs/node/pull/14244) +* [[`abf6355936`](https://github.com/nodejs/node/commit/abf6355936)] - **doc,assert**: document stackStartFunction in fail (Ruben Bridgewater) [#13862](https://github.com/nodejs/node/pull/13862) +* [[`f0328f631a`](https://github.com/nodejs/node/commit/f0328f631a)] - **doc,stream**: remove wrong remark on readable.read (Jan Schär) [#15014](https://github.com/nodejs/node/pull/15014) +* [[`0c670e0339`](https://github.com/nodejs/node/commit/0c670e0339)] - **http**: eliminate capture of ClientRequest in Agent (Evan Torrie) [#10134](https://github.com/nodejs/node/pull/10134) +* [[`67074113dc`](https://github.com/nodejs/node/commit/67074113dc)] - **http**: reset stream to unconsumed in `unconsume()` (Anna Henningsen) [#14410](https://github.com/nodejs/node/pull/14410) +* [[`e65c9ec7f4`](https://github.com/nodejs/node/commit/e65c9ec7f4)] - **http**: assert parser.consume argument's type (Gireesh Punathil) [#12288](https://github.com/nodejs/node/pull/12288) +* [[`4e717820a0`](https://github.com/nodejs/node/commit/4e717820a0)] - **lib**: clean up usage of threw (Jackson Tian) [#10534](https://github.com/nodejs/node/pull/10534) +* [[`e014178362`](https://github.com/nodejs/node/commit/e014178362)] - **meta**: merge TSC and CTC back into a single body (James M Snell) [#14973](https://github.com/nodejs/node/pull/14973) +* [[`4ee066eaba`](https://github.com/nodejs/node/commit/4ee066eaba)] - **meta**: considerations for new core modules (James M Snell) [#15022](https://github.com/nodejs/node/pull/15022) +* [[`948a7d70e7`](https://github.com/nodejs/node/commit/948a7d70e7)] - **meta**: improve definition of a collaborator (James M Snell) [#14981](https://github.com/nodejs/node/pull/14981) +* [[`caeee38b1d`](https://github.com/nodejs/node/commit/caeee38b1d)] - **net**: support passing undefined to listen() (Sam Roberts) [#14234](https://github.com/nodejs/node/pull/14234) +* [[`792acc17bf`](https://github.com/nodejs/node/commit/792acc17bf)] - **net**: fix abort on bad address input (Ruben Bridgewater) [#13726](https://github.com/nodejs/node/pull/13726) +* [[`8604772960`](https://github.com/nodejs/node/commit/8604772960)] - **readline**: remove max limit of crlfDelay (Azard) [#13497](https://github.com/nodejs/node/pull/13497) +* [[`362a7c0d8b`](https://github.com/nodejs/node/commit/362a7c0d8b)] - **repl**: do not consider `...` as a REPL command (Shivanth MP) [#14467](https://github.com/nodejs/node/pull/14467) +* [[`968121bbfe`](https://github.com/nodejs/node/commit/968121bbfe)] - **src**: remove unnecessary helper function (Brian White) [#14959](https://github.com/nodejs/node/pull/14959) +* [[`b2112f8d36`](https://github.com/nodejs/node/commit/b2112f8d36)] - **src**: detect nul bytes in InternalModuleReadFile() (Ben Noordhuis) [#14854](https://github.com/nodejs/node/pull/14854) +* [[`d20b7bfb6e`](https://github.com/nodejs/node/commit/d20b7bfb6e)] - **src**: use local isolate instead of args.GetIsolate (Daniel Bevenius) [#14768](https://github.com/nodejs/node/pull/14768) +* [[`66187fa044`](https://github.com/nodejs/node/commit/66187fa044)] - **stream**: fix Writable instanceof for subclasses (Anna Henningsen) [#14945](https://github.com/nodejs/node/pull/14945) +* [[`2c8fe9748c`](https://github.com/nodejs/node/commit/2c8fe9748c)] - **test**: remove envPlus, use Object.assign everywhere (Gibson Fahnestock) [#14845](https://github.com/nodejs/node/pull/14845) +* [[`8e00315506`](https://github.com/nodejs/node/commit/8e00315506)] - **test**: check zlib version for createDeflateRaw (Daniel Bevenius) [#13697](https://github.com/nodejs/node/pull/13697) +* [[`2babae4cd4`](https://github.com/nodejs/node/commit/2babae4cd4)] - **test**: refactor test-fs-readfile-unlink (Rich Trott) [#15173](https://github.com/nodejs/node/pull/15173) +* [[`8b045747e0`](https://github.com/nodejs/node/commit/8b045747e0)] - **test**: pipe some error output if npm fails (Jeremiah Senkpiel) [#12490](https://github.com/nodejs/node/pull/12490) +* [[`6540e99547`](https://github.com/nodejs/node/commit/6540e99547)] - **test**: simplify test-tls-client-default-ciphers (Jon Moss) [#14928](https://github.com/nodejs/node/pull/14928) +* [[`ad1d745498`](https://github.com/nodejs/node/commit/ad1d745498)] - **test**: extend async addon test (Anna Henningsen) [#14922](https://github.com/nodejs/node/pull/14922) +* [[`1e231ba8c7`](https://github.com/nodejs/node/commit/1e231ba8c7)] - **test**: add known issue for vm module (Franziska Hinkelmann) [#14661](https://github.com/nodejs/node/pull/14661) +* [[`644d9905a0`](https://github.com/nodejs/node/commit/644d9905a0)] - **test**: do not modify fixtures in test-fs-chmod (Rich Trott) [#14926](https://github.com/nodejs/node/pull/14926) +* [[`168f73c5f4`](https://github.com/nodejs/node/commit/168f73c5f4)] - **test**: improve assertion fail messages (Refael Ackermann) [#14949](https://github.com/nodejs/node/pull/14949) +* [[`915b56b963`](https://github.com/nodejs/node/commit/915b56b963)] - **test**: remove unused arguments from function (Ankit Parashar) [#14931](https://github.com/nodejs/node/pull/14931) +* [[`724508295d`](https://github.com/nodejs/node/commit/724508295d)] - **test**: make timers-blocking-callback more reliable (Rich Trott) [#14831](https://github.com/nodejs/node/pull/14831) +* [[`4fb4fbea1c`](https://github.com/nodejs/node/commit/4fb4fbea1c)] - **test**: add missing console.error to exec-maxBuffer (Beth Griggs) [#14796](https://github.com/nodejs/node/pull/14796) +* [[`a284ee6129`](https://github.com/nodejs/node/commit/a284ee6129)] - **test**: invoke callback with common.mustCall() (Griffith Tchenpan) [#8597](https://github.com/nodejs/node/pull/8597) +* [[`32260b91f2`](https://github.com/nodejs/node/commit/32260b91f2)] - **test**: check crypto before requiring tls module (Daniel Bevenius) [#14708](https://github.com/nodejs/node/pull/14708) +* [[`68cf7f0b30`](https://github.com/nodejs/node/commit/68cf7f0b30)] - **test**: improve multiple zlib tests (James M Snell) [#14455](https://github.com/nodejs/node/pull/14455) +* [[`f35f06d04c`](https://github.com/nodejs/node/commit/f35f06d04c)] - **test**: improve multiple vm tests (James M Snell) [#14458](https://github.com/nodejs/node/pull/14458) +* [[`1aac05b087`](https://github.com/nodejs/node/commit/1aac05b087)] - **test**: cover all HTTP methods that parser supports (Oky Antoro) [#14773](https://github.com/nodejs/node/pull/14773) +* [[`9f330250b5`](https://github.com/nodejs/node/commit/9f330250b5)] - **test**: remove redundant `using` in cctest (XadillaX) [#14739](https://github.com/nodejs/node/pull/14739) +* [[`91649b913c`](https://github.com/nodejs/node/commit/91649b913c)] - **test**: make test-tls-connect checks more strict (Rich Trott) [#14695](https://github.com/nodejs/node/pull/14695) +* [[`9ed2c4cb0e`](https://github.com/nodejs/node/commit/9ed2c4cb0e)] - **test**: add block scoping to test-readline-interface (Rich Trott) [#14615](https://github.com/nodejs/node/pull/14615) +* [[`4fb755c432`](https://github.com/nodejs/node/commit/4fb755c432)] - **test**: set module loading error for aix (Prakash Palaniappan) [#14511](https://github.com/nodejs/node/pull/14511) +* [[`9d8464161e`](https://github.com/nodejs/node/commit/9d8464161e)] - **test**: fix conversion of microseconds in test (Nick Stanish) [#14706](https://github.com/nodejs/node/pull/14706) +* [[`28b77d1f8b`](https://github.com/nodejs/node/commit/28b77d1f8b)] - **test**: improve check in test-os (Rich Trott) [#14655](https://github.com/nodejs/node/pull/14655) +* [[`fc49cf41ea`](https://github.com/nodejs/node/commit/fc49cf41ea)] - **test**: improve multiple timers tests (James M Snell) [#14616](https://github.com/nodejs/node/pull/14616) +* [[`c88f99f1f3`](https://github.com/nodejs/node/commit/c88f99f1f3)] - **test**: improvements to various http tests (James M Snell) [#14315](https://github.com/nodejs/node/pull/14315) +* [[`860c6198c0`](https://github.com/nodejs/node/commit/860c6198c0)] - **test**: use ciphers supported by shared OpenSSL (Jérémy Lal) [#14566](https://github.com/nodejs/node/pull/14566) +* [[`8b9a05c04b`](https://github.com/nodejs/node/commit/8b9a05c04b)] - **test**: read proper inspector message size (Bartosz Sosnowski) [#14596](https://github.com/nodejs/node/pull/14596) +* [[`86497f1acc`](https://github.com/nodejs/node/commit/86497f1acc)] - **test**: mark inspector-port-zero-cluster as flaky (Refael Ackermann) +* [[`8dfc2838c8`](https://github.com/nodejs/node/commit/8dfc2838c8)] - **test**: fix test-readline-interface (Azard) [#14677](https://github.com/nodejs/node/pull/14677) +* [[`3a6392b283`](https://github.com/nodejs/node/commit/3a6392b283)] - **tls**: fix empty issuer/subject/infoAccess parsing (Ben Noordhuis) [#14473](https://github.com/nodejs/node/pull/14473) +* [[`37dd2adbac`](https://github.com/nodejs/node/commit/37dd2adbac)] - **tools**: fix linter error in html.js (Michaël Zasso) [#15063](https://github.com/nodejs/node/pull/15063) +* [[`8b3ac4b2a2`](https://github.com/nodejs/node/commit/8b3ac4b2a2)] - **tools**: add custom private key option (Ruslan Bekenev) [#14401](https://github.com/nodejs/node/pull/14401) +* [[`cac4beb764`](https://github.com/nodejs/node/commit/cac4beb764)] - **tools**: fix update-eslint.sh (Myles Borins) [#14850](https://github.com/nodejs/node/pull/14850) +* [[`debea1c531`](https://github.com/nodejs/node/commit/debea1c531)] - **tools**: delete an unused argument (phisixersai) [#14251](https://github.com/nodejs/node/pull/14251) +* [[`ca61f3bd80`](https://github.com/nodejs/node/commit/ca61f3bd80)] - **tools**: fix tools/addon-verify.js (Daniel Bevenius) [#14048](https://github.com/nodejs/node/pull/14048) +* [[`f7b6d198b9`](https://github.com/nodejs/node/commit/f7b6d198b9)] - **tools**: eslint - use `error` and `off` (Refael Ackermann) [#14061](https://github.com/nodejs/node/pull/14061) +* [[`f8b85e16cd`](https://github.com/nodejs/node/commit/f8b85e16cd)] - **tools**: replace assert-throw-arguments custom lint (Rich Trott) [#14547](https://github.com/nodejs/node/pull/14547) + + +## 2017-09-05, Version 6.11.3 'Boron' (LTS), @MylesBorins + +This LTS release comes with 152 commits. This includes 75 which are test related, +25 which are doc related, 21 which are build / tool related and 3 commits which are updates to dependencies. + +### Notable Changes + +* **build**: + - Codesigning is fixed on macOS (Evan Lucas) [#14179](https://github.com/nodejs/node/pull/14179) +* **deps**: + - Snapshots are turned back on!!! (Yang Guo) [#14385](https://github.com/nodejs/node/pull/14385) +* **path**: + - win32 volume-relative paths are working again! (Timothy Gu) [#14440](https://github.com/nodejs/node/pull/14440) +* **tools**: + - v6.x can now build with ICU 59 (Steven R. Loomis) [#12078](https://github.com/nodejs/node/pull/12078) + +### Commits + +* [[`95be08e3d2`](https://github.com/nodejs/node/commit/95be08e3d2)] - **benchmark**: fix typo in inspect-proxy (Vse Mozhet Byt) [#14237](https://github.com/nodejs/node/pull/14237) +* [[`dbb65203f1`](https://github.com/nodejs/node/commit/dbb65203f1)] - **buffer**: remove a wrongly added attribute specifier (Jiajie Hu) [#14466](https://github.com/nodejs/node/pull/14466) +* [[`977fdce406`](https://github.com/nodejs/node/commit/977fdce406)] - **build**: codesign tarball binary on macOS (Evan Lucas) [#14179](https://github.com/nodejs/node/pull/14179) +* [[`a04d4ea8d7`](https://github.com/nodejs/node/commit/a04d4ea8d7)] - **build**: clean up config_fips.gypi (Daniel Bevenius) [#13837](https://github.com/nodejs/node/pull/13837) +* [[`c7025de6e2`](https://github.com/nodejs/node/commit/c7025de6e2)] - **build**: support dtrace on ARM (Bradley T. Hughes) [#12193](https://github.com/nodejs/node/pull/12193) +* [[`efc0f64c17`](https://github.com/nodejs/node/commit/efc0f64c17)] - **build**: reduce one level of spawning in node_gyp (Refael Ackermann) [#12653](https://github.com/nodejs/node/pull/12653) +* [[`1a7e872302`](https://github.com/nodejs/node/commit/1a7e872302)] - **build,tools**: do not force codesign prefix (Evan Lucas) [#14179](https://github.com/nodejs/node/pull/14179) +* [[`325813ea97`](https://github.com/nodejs/node/commit/325813ea97)] - **build,win**: fix python detection script (Jason Ginchereau) [#14546](https://github.com/nodejs/node/pull/14546) +* [[`c2090a0634`](https://github.com/nodejs/node/commit/c2090a0634)] - **build,windows**: restore DISTTYPEDIR (Refael Ackermann) [#13969](https://github.com/nodejs/node/pull/13969) +* [[`2a1a93dcbf`](https://github.com/nodejs/node/commit/2a1a93dcbf)] - **build,windows**: implement PEP514 python detection (Refael Ackermann) [#13900](https://github.com/nodejs/node/pull/13900) +* [[`2bc7c3a8dd`](https://github.com/nodejs/node/commit/2bc7c3a8dd)] - **child_process**: fix handleless NODE_HANDLE handling (Santiago Gimeno) [#13235](https://github.com/nodejs/node/pull/13235) +* [[`5900ebe9e4`](https://github.com/nodejs/node/commit/5900ebe9e4)] - **crypto**: remove root_cert_store from node_crypto.h (Daniel Bevenius) [#13194](https://github.com/nodejs/node/pull/13194) +* [[`987332abdf`](https://github.com/nodejs/node/commit/987332abdf)] - **deps**: cherry-pick 18ea996 from c-ares upstream (Anna Henningsen) [#13883](https://github.com/nodejs/node/pull/13883) +* [[`7fed989deb`](https://github.com/nodejs/node/commit/7fed989deb)] - **deps**: cherry-pick f5fad6d from upstream v8 (daniel.bevenius) [#12826](https://github.com/nodejs/node/pull/12826) +* [[`67ce52c740`](https://github.com/nodejs/node/commit/67ce52c740)] - **deps**: backport rehash strings after deserialization (Yang Guo) [#14385](https://github.com/nodejs/node/pull/14385) +* [[`6518932466`](https://github.com/nodejs/node/commit/6518932466)] - **dns**: fix `resolve` failed starts without network (XadillaX) [#13076](https://github.com/nodejs/node/pull/13076) +* [[`438a6427e5`](https://github.com/nodejs/node/commit/438a6427e5)] - **doc**: add gabrielschulhof to collaborators (Gabriel Schulhof) [#14692](https://github.com/nodejs/node/pull/14692) +* [[`c013c545a4`](https://github.com/nodejs/node/commit/c013c545a4)] - **doc**: update experimental status to reflect use (James M Snell) [#12723](https://github.com/nodejs/node/pull/12723) +* [[`ad2431ce28`](https://github.com/nodejs/node/commit/ad2431ce28)] - **doc**: describe labelling process for backports (Anna Henningsen) [#12431](https://github.com/nodejs/node/pull/12431) +* [[`013155d0b4`](https://github.com/nodejs/node/commit/013155d0b4)] - **doc**: add XadillaX to collaborators (XadillaX) [#14388](https://github.com/nodejs/node/pull/14388) +* [[`226ef71a1b`](https://github.com/nodejs/node/commit/226ef71a1b)] - **doc**: replace dead link in v8 module (Devin Boyer) [#14372](https://github.com/nodejs/node/pull/14372) +* [[`8b69504e17`](https://github.com/nodejs/node/commit/8b69504e17)] - **doc**: move LTS README link to increase prominence (Gibson Fahnestock) [#14259](https://github.com/nodejs/node/pull/14259) +* [[`b0286acd52`](https://github.com/nodejs/node/commit/b0286acd52)] - **doc**: update umask for clarity (James Sumners) [#14170](https://github.com/nodejs/node/pull/14170) +* [[`49d3dee0c2`](https://github.com/nodejs/node/commit/49d3dee0c2)] - **doc**: correct stream Duplex allowHalfOpen doc (Rich Trott) [#14127](https://github.com/nodejs/node/pull/14127) +* [[`9599faae18`](https://github.com/nodejs/node/commit/9599faae18)] - **doc**: note 'resize' event conditions on Windows (Dean Coakley) [#13576](https://github.com/nodejs/node/pull/13576) +* [[`8dbf827de3`](https://github.com/nodejs/node/commit/8dbf827de3)] - **doc**: fix mistake in http.md (Moogen Tian) [#14126](https://github.com/nodejs/node/pull/14126) +* [[`a3cd733dea`](https://github.com/nodejs/node/commit/a3cd733dea)] - **doc**: fix indentation issues in sample code (Rich Trott) [#13950](https://github.com/nodejs/node/pull/13950) +* [[`3b3d47c483`](https://github.com/nodejs/node/commit/3b3d47c483)] - **doc**: add CTC members to Collaborators list (Rich Trott) [#13284](https://github.com/nodejs/node/pull/13284) +* [[`f1d91ce3d2`](https://github.com/nodejs/node/commit/f1d91ce3d2)] - **doc**: fix example in child_process.md (Ruslan Iusupov) [#13716](https://github.com/nodejs/node/pull/13716) +* [[`db4fabae27`](https://github.com/nodejs/node/commit/db4fabae27)] - **doc**: note that fs.futimes only works on AIX \>7.1 (Gibson Fahnestock) [#13659](https://github.com/nodejs/node/pull/13659) +* [[`7648cca3de`](https://github.com/nodejs/node/commit/7648cca3de)] - **doc**: add @nodejs/documentation to CC table (Vse Mozhet Byt) [#13952](https://github.com/nodejs/node/pull/13952) +* [[`b03430b4ec`](https://github.com/nodejs/node/commit/b03430b4ec)] - **doc**: add gireeshpunathil to collaborators (Gireesh Punathil) [#13967](https://github.com/nodejs/node/pull/13967) +* [[`c34a7472d2`](https://github.com/nodejs/node/commit/c34a7472d2)] - **doc**: fix mistake in path.relative (Tobias Nießen) [#13912](https://github.com/nodejs/node/pull/13912) +* [[`7142c92dd6`](https://github.com/nodejs/node/commit/7142c92dd6)] - **doc**: fixed formatting issue in cli docs (Chris Young) [#13808](https://github.com/nodejs/node/pull/13808) +* [[`87906d25d4`](https://github.com/nodejs/node/commit/87906d25d4)] - **doc**: add missing zlib link to stream API docs (Rob Wu) [#13838](https://github.com/nodejs/node/pull/13838) +* [[`5ba65f2870`](https://github.com/nodejs/node/commit/5ba65f2870)] - **doc**: add entry for subprocess.killed property (Rich Trott) [#14578](https://github.com/nodejs/node/pull/14578) +* [[`73c720dd9e`](https://github.com/nodejs/node/commit/73c720dd9e)] - **doc**: change `child` to `subprocess` (Rich Trott) [#14578](https://github.com/nodejs/node/pull/14578) +* [[`7f6f1c2ddc`](https://github.com/nodejs/node/commit/7f6f1c2ddc)] - **doc, util, console**: clarify ambiguous docs (Natanael Log) [#14027](https://github.com/nodejs/node/pull/14027) +* [[`d6ab8e2f43`](https://github.com/nodejs/node/commit/d6ab8e2f43)] - **doc,stream**: _transform happens one at a time (Matteo Collina) [#14321](https://github.com/nodejs/node/pull/14321) +* [[`c307f03b2b`](https://github.com/nodejs/node/commit/c307f03b2b)] - **doc,test**: fs - reserved characters under win32 (XadillaX) [#13875](https://github.com/nodejs/node/pull/13875) +* [[`1d5ba9c8e9`](https://github.com/nodejs/node/commit/1d5ba9c8e9)] - **docs**: add note about fs.rmdir() (Oleksandr Kushchak) [#14323](https://github.com/nodejs/node/pull/14323) +* [[`f8b60e40a4`](https://github.com/nodejs/node/commit/f8b60e40a4)] - **gyp**: implement LD/LDXX for ninja and FIPS (Sam Roberts) +* [[`963ea0e99b`](https://github.com/nodejs/node/commit/963ea0e99b)] - **lib**: update indentation of ternaries (Rich Trott) [#14247](https://github.com/nodejs/node/pull/14247) +* [[`0cacd6c89e`](https://github.com/nodejs/node/commit/0cacd6c89e)] - **lib**: normalize indentation in parentheses (Rich Trott) [#14125](https://github.com/nodejs/node/pull/14125) +* [[`4dabeeecdd`](https://github.com/nodejs/node/commit/4dabeeecdd)] - **lib**: remove excess indentation (Rich Trott) [#14090](https://github.com/nodejs/node/pull/14090) +* [[`f20ed49b5e`](https://github.com/nodejs/node/commit/f20ed49b5e)] - **lib**: use consistent indentation for ternaries (Rich Trott) [#14078](https://github.com/nodejs/node/pull/14078) +* [[`81edf592ae`](https://github.com/nodejs/node/commit/81edf592ae)] - **lib**: fix typos (Ruben Bridgewater) [#14044](https://github.com/nodejs/node/pull/14044) +* [[`39f62403c7`](https://github.com/nodejs/node/commit/39f62403c7)] - **linkedlist**: correct grammar in comments (alexbostock) [#14546](https://github.com/nodejs/node/pull/14546) +* [[`e82a9144ed`](https://github.com/nodejs/node/commit/e82a9144ed)] - **path**: remove unnecessary string copies (Tobias Nießen) [#14438](https://github.com/nodejs/node/pull/14438) +* [[`eefd32264e`](https://github.com/nodejs/node/commit/eefd32264e)] - **path**: fix win32 volume-relative paths (Timothy Gu) [#14440](https://github.com/nodejs/node/pull/14440) +* [[`fe6735cc19`](https://github.com/nodejs/node/commit/fe6735cc19)] - **src**: use existing strings over creating new ones (Anna Henningsen) [#14587](https://github.com/nodejs/node/pull/14587) +* [[`4d3b76d2be`](https://github.com/nodejs/node/commit/4d3b76d2be)] - **src**: remove GTEST_DONT_DEFINE_ASSERT_EQ in util.h (Daniel Bevenius) [#12638](https://github.com/nodejs/node/pull/12638) +* [[`51364b746f`](https://github.com/nodejs/node/commit/51364b746f)] - **src**: move crypto_bio/clienthello to crypto ns (Daniel Bevenius) [#13957](https://github.com/nodejs/node/pull/13957) +* [[`35f911152a`](https://github.com/nodejs/node/commit/35f911152a)] - **src**: add missing new line to printed message (Timothy Gu) [#13940](https://github.com/nodejs/node/pull/13940) +* [[`135e1e3b0b`](https://github.com/nodejs/node/commit/135e1e3b0b)] - **src**: merge `fn_name` in NODE_SET_PROTOTYPE_METHOD (XadillaX) [#13547](https://github.com/nodejs/node/pull/13547) +* [[`403c45fcc9`](https://github.com/nodejs/node/commit/403c45fcc9)] - **src**: only call FatalException if not verbose (Daniel Bevenius) [#12826](https://github.com/nodejs/node/pull/12826) +* [[`547e74bb22`](https://github.com/nodejs/node/commit/547e74bb22)] - **src**: use option parser for expose_internals (Sam Roberts) [#12245](https://github.com/nodejs/node/pull/12245) +* [[`f9e427945b`](https://github.com/nodejs/node/commit/f9e427945b)] - **src**: supply missing comments for CLI options (Sam Roberts) [#12245](https://github.com/nodejs/node/pull/12245) +* [[`9ca67e0147`](https://github.com/nodejs/node/commit/9ca67e0147)] - **src**: make root_cert_vector function scoped (Daniel Bevenius) [#12788](https://github.com/nodejs/node/pull/12788) +* [[`2ce80d97e9`](https://github.com/nodejs/node/commit/2ce80d97e9)] - **test**: refactor test-domain-abort-on-uncaught (Rich Trott) [#14541](https://github.com/nodejs/node/pull/14541) +* [[`4b9de44022`](https://github.com/nodejs/node/commit/4b9de44022)] - **test**: refactor test-vm-new-script-new-context (Rich Trott) [#14536](https://github.com/nodejs/node/pull/14536) +* [[`e5375a97e0`](https://github.com/nodejs/node/commit/e5375a97e0)] - **test**: add check on an addon that does not register (Ezequiel Garcia) [#13954](https://github.com/nodejs/node/pull/13954) +* [[`1a88c3e5f6`](https://github.com/nodejs/node/commit/1a88c3e5f6)] - **test**: improve error logging for inspector test (Rich Trott) [#14508](https://github.com/nodejs/node/pull/14508) +* [[`95a95cced3`](https://github.com/nodejs/node/commit/95a95cced3)] - **test**: fix flaky test-force-repl (Rich Trott) [#14439](https://github.com/nodejs/node/pull/14439) +* [[`6fd3dd20c0`](https://github.com/nodejs/node/commit/6fd3dd20c0)] - **test**: replace concatenation with template literal (rockcoder23) [#14270](https://github.com/nodejs/node/pull/14270) +* [[`3ba55d8c47`](https://github.com/nodejs/node/commit/3ba55d8c47)] - **test**: replace concatenation with template literal (Ching Hsu) [#14284](https://github.com/nodejs/node/pull/14284) +* [[`7f7a0709be`](https://github.com/nodejs/node/commit/7f7a0709be)] - **test**: replace concatenation with template literals (Zongmin Lei) [#14298](https://github.com/nodejs/node/pull/14298) +* [[`11ed4c2823`](https://github.com/nodejs/node/commit/11ed4c2823)] - **test**: replace string concatenation with template (ziyun) [#14286](https://github.com/nodejs/node/pull/14286) +* [[`bbd1c791f5`](https://github.com/nodejs/node/commit/bbd1c791f5)] - **test**: use path.join for long path concatenation (zzz) [#14280](https://github.com/nodejs/node/pull/14280) +* [[`c4f21b37a1`](https://github.com/nodejs/node/commit/c4f21b37a1)] - **test**: replace concatenation with template literals (SkyAo) [#14296](https://github.com/nodejs/node/pull/14296) +* [[`d7afa17939`](https://github.com/nodejs/node/commit/d7afa17939)] - **test**: fix error handling test-http-full-response (Rich Trott) [#14252](https://github.com/nodejs/node/pull/14252) +* [[`7a8eddf015`](https://github.com/nodejs/node/commit/7a8eddf015)] - **test**: use regex error check in test-crypto-random (Zhang Weijie) [#14273](https://github.com/nodejs/node/pull/14273) +* [[`3047cf1b48`](https://github.com/nodejs/node/commit/3047cf1b48)] - **test**: check error with regex in test-signal-safety (shaman) [#14285](https://github.com/nodejs/node/pull/14285) +* [[`bbe328830f`](https://github.com/nodejs/node/commit/bbe328830f)] - **test**: use regex error checks in test-util-format (Superwoods) [#14299](https://github.com/nodejs/node/pull/14299) +* [[`a696e2ecae`](https://github.com/nodejs/node/commit/a696e2ecae)] - **test**: use template literal for string concat (tobewhatwewant) [#14288](https://github.com/nodejs/node/pull/14288) +* [[`77506e48b0`](https://github.com/nodejs/node/commit/77506e48b0)] - **test**: simplify string concatenation (jiangplus) [#14278](https://github.com/nodejs/node/pull/14278) +* [[`b9b343c412`](https://github.com/nodejs/node/commit/b9b343c412)] - **test**: use regexp to confir error message (Bang Wu) [#14268](https://github.com/nodejs/node/pull/14268) +* [[`94ff5918b6`](https://github.com/nodejs/node/commit/94ff5918b6)] - **test**: use regluar expression in vm test (akira.xue) [#14266](https://github.com/nodejs/node/pull/14266) +* [[`8b945e7649`](https://github.com/nodejs/node/commit/8b945e7649)] - **test**: use regular expression to match error msg (Flandre) [#14265](https://github.com/nodejs/node/pull/14265) +* [[`a168361eb9`](https://github.com/nodejs/node/commit/a168361eb9)] - **test**: check complete error message (Fraser Xu) [#14264](https://github.com/nodejs/node/pull/14264) +* [[`1e403902ba`](https://github.com/nodejs/node/commit/1e403902ba)] - **test**: fix flaky test-net-can-reset-timeout (Rich Trott) [#14257](https://github.com/nodejs/node/pull/14257) +* [[`688e5ed6fd`](https://github.com/nodejs/node/commit/688e5ed6fd)] - **test**: remove common.noop (Rich Trott) [#12822](https://github.com/nodejs/node/pull/12822) +* [[`40a61e1399`](https://github.com/nodejs/node/commit/40a61e1399)] - **test**: add get/set effective uid/gid tests (Evan Lucas) [#14091](https://github.com/nodejs/node/pull/14091) +* [[`1633f8b243`](https://github.com/nodejs/node/commit/1633f8b243)] - **test**: simplify test skipping (Vse Mozhet Byt) [#14021](https://github.com/nodejs/node/pull/14021) +* [[`b7b38bdbaf`](https://github.com/nodejs/node/commit/b7b38bdbaf)] - **test**: adjust indentation for stricter linting (Rich Trott) [#14431](https://github.com/nodejs/node/pull/14431) +* [[`46e4a026b6`](https://github.com/nodejs/node/commit/46e4a026b6)] - **test**: skip test-fs-readdir-ucs2 if no support (Rich Trott) [#14029](https://github.com/nodejs/node/pull/14029) +* [[`49632287d1`](https://github.com/nodejs/node/commit/49632287d1)] - **test**: fix flaky http(s)-set-server-timeout tests (Rich Trott) [#14380](https://github.com/nodejs/node/pull/14380) +* [[`ae7eeff489`](https://github.com/nodejs/node/commit/ae7eeff489)] - **test**: fix flaky test-https-set-timeout-server (Rich Trott) [#14134](https://github.com/nodejs/node/pull/14134) +* [[`c5c65c8ce9`](https://github.com/nodejs/node/commit/c5c65c8ce9)] - **test**: fix require nits in some test-tls-* tests (Vse Mozhet Byt) [#14008](https://github.com/nodejs/node/pull/14008) +* [[`346f199e28`](https://github.com/nodejs/node/commit/346f199e28)] - **test**: refactor test-http(s)-set-timeout-server (Alexey Orlenko) [#13935](https://github.com/nodejs/node/pull/13935) +* [[`ac851c482c`](https://github.com/nodejs/node/commit/ac851c482c)] - **test**: refactor test-http-invalidheaderfield (Rich Trott) [#13996](https://github.com/nodejs/node/pull/13996) +* [[`49e786628f`](https://github.com/nodejs/node/commit/49e786628f)] - **test**: replace indexOf with includes and startsWith (Nataly Shrits) [#13852](https://github.com/nodejs/node/pull/13852) +* [[`2eb926b487`](https://github.com/nodejs/node/commit/2eb926b487)] - **test**: remove undef NDEBUG from at-exit addons test (Daniel Bevenius) [#13998](https://github.com/nodejs/node/pull/13998) +* [[`0bcbcca21c`](https://github.com/nodejs/node/commit/0bcbcca21c)] - **test**: refactor test-fs-watchfile (Rich Trott) [#13721](https://github.com/nodejs/node/pull/13721) +* [[`bd8574ccee`](https://github.com/nodejs/node/commit/bd8574ccee)] - **test**: refactor test-child-process-send-type-error (Rich Trott) [#13904](https://github.com/nodejs/node/pull/13904) +* [[`74945dd18a`](https://github.com/nodejs/node/commit/74945dd18a)] - **test**: refactor test-cluster-basic (Rich Trott) [#13905](https://github.com/nodejs/node/pull/13905) +* [[`dc3d29519d`](https://github.com/nodejs/node/commit/dc3d29519d)] - **test**: remove unneeded HandleScope usage (Ezequiel Garcia) [#13859](https://github.com/nodejs/node/pull/13859) +* [[`beca25ab9e`](https://github.com/nodejs/node/commit/beca25ab9e)] - **test**: skip fips tests using OpenSSL config file (Daniel Bevenius) [#13786](https://github.com/nodejs/node/pull/13786) +* [[`d3c85a4806`](https://github.com/nodejs/node/commit/d3c85a4806)] - **test**: refactor test-tls-invoked-queued (Rich Trott) [#13893](https://github.com/nodejs/node/pull/13893) +* [[`676a94e44d`](https://github.com/nodejs/node/commit/676a94e44d)] - **test**: refactor test-tls-env-extra-ca (Rich Trott) [#13886](https://github.com/nodejs/node/pull/13886) +* [[`fd6bbc098e`](https://github.com/nodejs/node/commit/fd6bbc098e)] - **test**: make http(s)-set-timeout-server more similar (Julien Klepatch) [#13822](https://github.com/nodejs/node/pull/13822) +* [[`8ba784383c`](https://github.com/nodejs/node/commit/8ba784383c)] - **test**: remove `require('buffer')` from 4 test files (XadillaX) [#13844](https://github.com/nodejs/node/pull/13844) +* [[`cd962e6de3`](https://github.com/nodejs/node/commit/cd962e6de3)] - **test**: remove unnecessary require('buffer').Buffer (lena) [#13851](https://github.com/nodejs/node/pull/13851) +* [[`fff0b83f1b`](https://github.com/nodejs/node/commit/fff0b83f1b)] - **test**: remove `require('buffer')` from 4 test files (Zongmin Lei) [#13846](https://github.com/nodejs/node/pull/13846) +* [[`6d02bf40d0`](https://github.com/nodejs/node/commit/6d02bf40d0)] - **test**: remove require('buffer') from 4 buffer tests (OriLev) [#13855](https://github.com/nodejs/node/pull/13855) +* [[`0abc82db50`](https://github.com/nodejs/node/commit/0abc82db50)] - **test**: remove require('buffer') on 6 fs test files (sallen450) [#13845](https://github.com/nodejs/node/pull/13845) +* [[`1fb19ac0c5`](https://github.com/nodejs/node/commit/1fb19ac0c5)] - **test**: remove unnecessary Buffer import (Steven Winston) [#13860](https://github.com/nodejs/node/pull/13860) +* [[`5a9d7b3bf5`](https://github.com/nodejs/node/commit/5a9d7b3bf5)] - **test**: use string instead of RegExp in split() (Vse Mozhet Byt) [#13710](https://github.com/nodejs/node/pull/13710) +* [[`6731d1b067`](https://github.com/nodejs/node/commit/6731d1b067)] - **test**: remove needless RegExp flags (Vse Mozhet Byt) [#13690](https://github.com/nodejs/node/pull/13690) +* [[`842b84c4e7`](https://github.com/nodejs/node/commit/842b84c4e7)] - **test**: refactor test-http-set-timeout-server (Rich Trott) [#13802](https://github.com/nodejs/node/pull/13802) +* [[`389f29406a`](https://github.com/nodejs/node/commit/389f29406a)] - **test**: make test-http(s)-set-timeout-server alike (jklepatch) [#13625](https://github.com/nodejs/node/pull/13625) +* [[`5e9b2030b9`](https://github.com/nodejs/node/commit/5e9b2030b9)] - **test**: use mustNotCall() in test-fs-watch (Rich Trott) [#13595](https://github.com/nodejs/node/pull/13595) +* [[`9356e9667d`](https://github.com/nodejs/node/commit/9356e9667d)] - **test**: add mustCall() to child-process test (Rich Trott) [#13605](https://github.com/nodejs/node/pull/13605) +* [[`406b3c0371`](https://github.com/nodejs/node/commit/406b3c0371)] - **test**: use mustNotCall in test-http-eof-on-connect (Rich Trott) [#13587](https://github.com/nodejs/node/pull/13587) +* [[`2f19dcddaa`](https://github.com/nodejs/node/commit/2f19dcddaa)] - **test**: refactor test-fs-read-* (Rich Trott) [#13501](https://github.com/nodejs/node/pull/13501) +* [[`3bdf7bf9e9`](https://github.com/nodejs/node/commit/3bdf7bf9e9)] - **test**: refactor domain tests (Rich Trott) [#13480](https://github.com/nodejs/node/pull/13480) +* [[`543d2de700`](https://github.com/nodejs/node/commit/543d2de700)] - **test**: check callback not invoked on lookup error (Rich Trott) [#13456](https://github.com/nodejs/node/pull/13456) +* [[`91fb0cb6b0`](https://github.com/nodejs/node/commit/91fb0cb6b0)] - **test**: refactor test-dgram-oob-buffer (Rich Trott) [#13443](https://github.com/nodejs/node/pull/13443) +* [[`08f7cca3b3`](https://github.com/nodejs/node/commit/08f7cca3b3)] - **test**: add documentation for common.mustNotCall() (Rich Trott) [#13359](https://github.com/nodejs/node/pull/13359) +* [[`55c96cf8a8`](https://github.com/nodejs/node/commit/55c96cf8a8)] - **test**: refactor test-net-server-bind (Rich Trott) [#13273](https://github.com/nodejs/node/pull/13273) +* [[`371b648d1b`](https://github.com/nodejs/node/commit/371b648d1b)] - **test**: use mustCall() in test-readline-interface (Rich Trott) [#13259](https://github.com/nodejs/node/pull/13259) +* [[`3808e3701c`](https://github.com/nodejs/node/commit/3808e3701c)] - **test**: use mustNotCall() in test-stream2-objects (Rich Trott) [#13249](https://github.com/nodejs/node/pull/13249) +* [[`b793fc6cf6`](https://github.com/nodejs/node/commit/b793fc6cf6)] - **test**: replace `indexOf` with `includes` (Aditya Anand) [#13215](https://github.com/nodejs/node/pull/13215) +* [[`b7c7112d7b`](https://github.com/nodejs/node/commit/b7c7112d7b)] - **test**: move stream2 test from pummel to parallel (Rich Trott) [#13146](https://github.com/nodejs/node/pull/13146) +* [[`7a5248d172`](https://github.com/nodejs/node/commit/7a5248d172)] - **test**: simplify assert usage in test-stream2-basic (Rich Trott) [#13146](https://github.com/nodejs/node/pull/13146) +* [[`e15e2e7a30`](https://github.com/nodejs/node/commit/e15e2e7a30)] - **test**: check noop function invocations (Rich Trott) [#13146](https://github.com/nodejs/node/pull/13146) +* [[`4a3e089984`](https://github.com/nodejs/node/commit/4a3e089984)] - **test**: confirm callback is invoked in fs test (Rich Trott) [#13132](https://github.com/nodejs/node/pull/13132) +* [[`8b161e0a78`](https://github.com/nodejs/node/commit/8b161e0a78)] - **test**: check number of message events (Rich Trott) [#13125](https://github.com/nodejs/node/pull/13125) +* [[`c2a0a936e1`](https://github.com/nodejs/node/commit/c2a0a936e1)] - **test**: increase coverage for path.parse (Tobias Nießen) [#14438](https://github.com/nodejs/node/pull/14438) +* [[`202bfcc1c0`](https://github.com/nodejs/node/commit/202bfcc1c0)] - **test**: mark test-fs-read-buffer-to-string-fail as flaky (jeyanthinath) [#14495](https://github.com/nodejs/node/pull/14495) +* [[`a1cef1fc8f`](https://github.com/nodejs/node/commit/a1cef1fc8f)] - **test**: harden test-dgram-bind-shared-ports (Refael Ackermann) [#13100](https://github.com/nodejs/node/pull/13100) +* [[`f578c9bbb6`](https://github.com/nodejs/node/commit/f578c9bbb6)] - **test**: add mustCallAtLeast (Refael Ackermann) [#12935](https://github.com/nodejs/node/pull/12935) +* [[`a7b94500f2`](https://github.com/nodejs/node/commit/a7b94500f2)] - **test**: add common.noop, default for common.mustCall() (James M Snell) [#12027](https://github.com/nodejs/node/pull/12027) +* [[`f3c0b8cd6e`](https://github.com/nodejs/node/commit/f3c0b8cd6e)] - **test,fs**: delay unlink in test-regress-GH-4027.js (Jaime Bernardo) [#14010](https://github.com/nodejs/node/pull/14010) +* [[`e8438c1b22`](https://github.com/nodejs/node/commit/e8438c1b22)] - **timers**: do not use user object call/apply (Rich Trott) [#12960](https://github.com/nodejs/node/pull/12960) +* [[`31f572c3ea`](https://github.com/nodejs/node/commit/31f572c3ea)] - **tools**: update to ESLint 4.3.0 (Rich Trott) [#14417](https://github.com/nodejs/node/pull/14417) +* [[`7d851e3b6a`](https://github.com/nodejs/node/commit/7d851e3b6a)] - **tools**: update package.json `engine` field (AJ Jordan) [#14165](https://github.com/nodejs/node/pull/14165) +* [[`c5adb5f008`](https://github.com/nodejs/node/commit/c5adb5f008)] - **tools**: update ESLint to 4.2.0 (Rich Trott) [#14155](https://github.com/nodejs/node/pull/14155) +* [[`2af21650d6`](https://github.com/nodejs/node/commit/2af21650d6)] - **tools**: generate template literal for addon tests (Rich Trott) [#14094](https://github.com/nodejs/node/pull/14094) +* [[`62de339327`](https://github.com/nodejs/node/commit/62de339327)] - **tools**: remove legacy indentation linting (Rich Trott) [#14515](https://github.com/nodejs/node/pull/14515) +* [[`8b7c4fc06f`](https://github.com/nodejs/node/commit/8b7c4fc06f)] - **tools**: remove align-multiline-assignment lint rule (Rich Trott) [#14079](https://github.com/nodejs/node/pull/14079) +* [[`509205fddd`](https://github.com/nodejs/node/commit/509205fddd)] - **tools**: update to ESLint 4.1.1 (Rich Trott) [#13946](https://github.com/nodejs/node/pull/13946) +* [[`8f664e52d9`](https://github.com/nodejs/node/commit/8f664e52d9)] - **tools**: add script to update ESLint (Rich Trott) [#13895](https://github.com/nodejs/node/pull/13895) +* [[`d34bc78fd4`](https://github.com/nodejs/node/commit/d34bc78fd4)] - **tools**: update to ESLint 4.1.0 (Rich Trott) [#13895](https://github.com/nodejs/node/pull/13895) +* [[`01d82d843b`](https://github.com/nodejs/node/commit/01d82d843b)] - **tools**: use no-use-before-define ESLint rule (Vse Mozhet Byt) [#14032](https://github.com/nodejs/node/pull/14032) +* [[`70901b271c`](https://github.com/nodejs/node/commit/70901b271c)] - **tools**: remove comment in eslint rule (Daniel Bevenius) [#13945](https://github.com/nodejs/node/pull/13945) +* [[`74d5cba007`](https://github.com/nodejs/node/commit/74d5cba007)] - **tools**: add missing #include "unicode/putil.h" (Steven R. Loomis) [#12078](https://github.com/nodejs/node/pull/12078) +* [[`7bb200f624`](https://github.com/nodejs/node/commit/7bb200f624)] - **tools**: add rule prefering common.mustNotCall() (James M Snell) [#12027](https://github.com/nodejs/node/pull/12027) +* [[`d5bf1379b5`](https://github.com/nodejs/node/commit/d5bf1379b5)] - **v8**: fix RegExp nits in v8_prof_polyfill.js (Vse Mozhet Byt) [#13709](https://github.com/nodejs/node/pull/13709) +* [[`9e2d85e441`](https://github.com/nodejs/node/commit/9e2d85e441)] - **v8**: handle proxy objects in MakeMirror(), v2 (Ben Noordhuis) [#14343](https://github.com/nodejs/node/pull/14343) +* [[`bccd2f59b0`](https://github.com/nodejs/node/commit/bccd2f59b0)] - **v8**: handle proxy objects in MakeMirror(), v1 (Ben Noordhuis) [#14343](https://github.com/nodejs/node/pull/14343) +* [[`e79c054f76`](https://github.com/nodejs/node/commit/e79c054f76)] - **zlib**: fix crash when initializing failed (Anna Henningsen) [#14666](https://github.com/nodejs/node/pull/14666) + ## 2017-08-01, Version 6.11.2 'Boron' (LTS), @MylesBorins diff -Nru nodejs-6.11.2~dfsg/doc/guides/writing-tests.md nodejs-6.11.4~dfsg/doc/guides/writing-tests.md --- nodejs-6.11.2~dfsg/doc/guides/writing-tests.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/guides/writing-tests.md 2017-10-03 17:11:27.000000000 +0000 @@ -25,13 +25,13 @@ ```javascript 'use strict'; // 1 const common = require('../common'); // 2 - // 3 + // This test ensures that the http-parser can handle UTF-8 characters // 4 // in the http header. // 5 - // 6 + const assert = require('assert'); // 7 const http = require('http'); // 8 - // 9 + const server = http.createServer(common.mustCall((req, res) => { // 10 res.end('ok'); // 11 })); // 12 diff -Nru nodejs-6.11.2~dfsg/doc/node.1 nodejs-6.11.4~dfsg/doc/node.1 --- nodejs-6.11.2~dfsg/doc/node.1 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/node.1 2017-10-03 17:11:38.000000000 +0000 @@ -175,15 +175,15 @@ .TP .BR \-\-use\-openssl\-ca,\-\-use\-bundled\-ca Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by -current NodeJS version. The default store is selectable at build-time. +current Node.js version. The default store is selectable at build-time. Using OpenSSL store allows for external modifications of the store. For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators. OpenSSL CA store location is dependent on configuration of the OpenSSL library but this can be altered at runtime using -environmental variables. +environment variables. -The bundled CA store, as supplied by NodeJS, is a snapshot of Mozilla CA store +The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store that is fixed at release time. It is identical on all supported platforms. See \fBSSL_CERT_DIR\fR and \fBSSL_CERT_FILE\fR. diff -Nru nodejs-6.11.2~dfsg/doc/onboarding-extras.md nodejs-6.11.4~dfsg/doc/onboarding-extras.md --- nodejs-6.11.2~dfsg/doc/onboarding-extras.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/onboarding-extras.md 2017-10-03 17:11:27.000000000 +0000 @@ -6,6 +6,7 @@ | --- | --- | | `benchmark/*` | @nodejs/benchmarking, @mscdex | | `bootstrap_node.js` | @fishrock123 | +| `doc/*`, `*.md` | @nodejs/documentation | | `lib/assert` | @nodejs/testing | | `lib/buffer` | @nodejs/buffer | | `lib/child_process` | @bnoordhuis, @cjihrig | @@ -76,6 +77,33 @@ git checkout $(git show -s --pretty='%T' $(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}')) -- test; make -j4 test ``` +### LTS/Version labels + +We use labels to keep track of which branches a commit should land on: + +* `dont-land-on-v?.x` + * For changes that do not apply to a certain release line + * Also used when the work of backporting a change outweighs the benefits +* `land-on-v?.x` + * Used by releasers to mark a PR as scheduled for inclusion in an LTS release + * Applied to the original PR for clean cherry-picks, to the backport PR otherwise +* `backport-requested-v?.x` + * Used to indicate that a PR needs a manual backport to a branch in order to land the changes on that branch + * Typically applied by a releaser when the PR does not apply cleanly or it breaks the tests after applying + * Will be replaced by either `dont-land-on-v?.x` or `backported-to-v?.x` +* `backported-to-v?.x` + * Applied to PRs for which a backport PR has been merged +* `lts-watch-v?.x` + * Applied to PRs which the LTS working group should consider including in a LTS release + * Does not indicate that any specific action will be taken, but can be effective as messaging to non-collaborators +* `lts-agenda` + * For things that need discussion by the LTS working group + * (for example semver-minor changes that need or should go into an LTS release) +* `v?.x` + * Automatically applied to changes that do not target `master` but rather the `v?.x-staging` branch + +Once a release line enters maintenance mode, the corresponding labels do not +need to be attached anymore, as only important bugfixes will be included. ### Other Labels @@ -85,10 +113,6 @@ * Architecture labels * `arm`, `mips` * No x86{_64}, since that is the implied default -* `lts-agenda`, `lts-watch-v*` - * tag things that should be discussed to go into LTS or should go into a specific LTS branch - * (usually only semver-patch things) - * will come more naturally over time ## Updating Node.js from Upstream diff -Nru nodejs-6.11.2~dfsg/doc/onboarding.md nodejs-6.11.4~dfsg/doc/onboarding.md --- nodejs-6.11.2~dfsg/doc/onboarding.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/onboarding.md 2017-10-03 17:11:27.000000000 +0000 @@ -43,7 +43,7 @@ * Use [https://github.com/notifications](https://github.com/notifications) or set up email * Watching the main repo will flood your inbox (several hundred notifications on typical weekdays), so be prepared - * `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is the best place to interact with the CTC / other Collaborators + * `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is the best place to interact with the TSC / other Collaborators * If there are any questions after the session, a good place to ask is there! * Presence is not mandatory, but please drop a note there if force-pushing to `master` @@ -67,7 +67,7 @@ * [**See "Labels"**](./onboarding-extras.md#labels) * There is [a bot](https://github.com/nodejs-github-bot/github-bot) that applies subsystem labels (for example, `doc`, `test`, `assert`, or `buffer`) so that we know what parts of the code base the pull request modifies. It is not perfect, of course. Feel free to apply relevant labels and remove irrelevant labels from pull requests and issues. - * Use the `ctc-review` label if a topic is controversial or isn't coming to + * Use the `tsc-review` label if a topic is controversial or isn't coming to a conclusion after an extended time. * `semver-{minor,major}`: * If a change has the remote *chance* of breaking something, use the `semver-major` label @@ -166,7 +166,7 @@ * Almost any mistake you could make can be fixed or reverted. * The existing Collaborators trust you and are grateful for your help! * Other repositories: - * [https://github.com/nodejs/CTC](https://github.com/nodejs/CTC) + * [https://github.com/nodejs/TSC](https://github.com/nodejs/TSC) * [https://github.com/nodejs/build](https://github.com/nodejs/build) * [https://github.com/nodejs/nodejs.org](https://github.com/nodejs/nodejs.org) * [https://github.com/nodejs/readable-stream](https://github.com/nodejs/readable-stream) diff -Nru nodejs-6.11.2~dfsg/doc/template.html nodejs-6.11.4~dfsg/doc/template.html --- nodejs-6.11.2~dfsg/doc/template.html 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/doc/template.html 2017-10-03 17:11:27.000000000 +0000 @@ -23,11 +23,18 @@

                                            Node.js __VERSION__ Documentation

                                            -

                                            - Index | - View on single page | - View as JSON -

                                            +

                                            diff -Nru nodejs-6.11.2~dfsg/GOVERNANCE.md nodejs-6.11.4~dfsg/GOVERNANCE.md --- nodejs-6.11.2~dfsg/GOVERNANCE.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/GOVERNANCE.md 2017-10-03 17:11:11.000000000 +0000 @@ -1,17 +1,30 @@ # Node.js Project Governance -The Node.js project is governed by its Collaborators, including a Core Technical -Committee (CTC) which is responsible for high-level guidance of the project. +The Node.js project is governed by its Collaborators, including a Technical +Steering Committee (TSC) which is responsible for high-level guidance of the +project. ## Collaborators The [nodejs/node](https://github.com/nodejs/node) GitHub repository is -maintained by Collaborators who are added by the CTC on an ongoing basis. +maintained by Collaborators who are added by the TSC on an ongoing basis. -Individuals identified by the CTC as making significant and valuable -contributions are made Collaborators and given commit access to the project. If -you make a significant contribution and are not considered for commit access, -log an issue or contact a CTC member directly. +Individuals identified by the TSC as making significant and valuable +contributions across any Node.js repository may be made Collaborators and given +commit access to the project. Activities taken into consideration include (but +are not limited to) the quality of: + +* code commits and pull requests +* documentation commits and pull requests +* comments on issues and pull requests +* contributions to the Node.js website +* assistance provided to end users and novice contributors +* participation in Working Groups +* other participation in the wider Node.js community + +If individuals making valuable contributions do not believe they have been +considered for commit access, they may log an issue or contact a TSC member +directly. Modifications of the contents of the nodejs/node repository are made on a collaborative basis. Anybody with a GitHub account may propose a @@ -28,13 +41,13 @@ * Discussions and/or additional changes result in no Collaborators objecting to the change. Previously-objecting Collaborators do not necessarily have to sign-off on the change, but they should not be opposed to it. -* The change is escalated to the CTC and the CTC votes to approve the change. +* The change is escalated to the TSC and the TSC votes to approve the change. This should only happen if disagreements between Collaborators cannot be resolved through discussion. Collaborators may opt to elevate significant or controversial modifications to -the CTC by assigning the `ctc-review` label to a pull request or issue. The -CTC should serve as the final arbiter where required. +the TSC by assigning the `tsc-review` label to a pull request or issue. The +TSC should serve as the final arbiter where required. * [Current list of Collaborators](./README.md#current-project-team-members) * [A guide for Collaborators](./COLLABORATOR_GUIDE.md) @@ -49,13 +62,13 @@ * participation in working groups * merging pull requests -The CTC periodically reviews the Collaborator list to identify inactive +The TSC periodically reviews the Collaborator list to identify inactive Collaborators. Past Collaborators are typically given _Emeritus_ status. Emeriti -may request that the CTC restore them to active status. +may request that the TSC restore them to active status. -## Core Technical Committee +## Technical Steering Committee -The Core Technical Committee (CTC) has final authority over this project +The Technical Steering Committee (TSC) has final authority over this project including: * Technical direction @@ -65,59 +78,19 @@ * Conduct guidelines * Maintaining the list of additional Collaborators -* [Current list of CTC members](./README.md#current-project-team-members) +* [Current list of TSC members](./README.md#current-project-team-members) -## CTC Membership +The operations of the TSC are governed by the [TSC Charter][] as approved by +the Node.js Foundation Board of Directors. -CTC seats are not time-limited. There is no fixed size of the CTC. The CTC -should be of such a size as to ensure adequate coverage of important areas of -expertise balanced with the ability to make decisions efficiently. +### TSC Meetings -There is no specific set of requirements or qualifications for CTC -membership beyond these rules. - -The CTC may add additional members to the CTC by a standard CTC motion. - -When a CTC member's participation in [CTC activities](#ctc-activities) has -become minimal for a sustained period of time, the CTC will request that the -member either indicate an intention to increase participation or voluntarily -resign. - -CTC members may only be removed by voluntary resignation or through a standard -CTC motion. - -Changes to CTC membership should be posted in the agenda, and may be -suggested as any other agenda item (see [CTC Meetings](#ctc-meetings) below). - -No more than 1/3 of the CTC members may be affiliated with the same -employer. If removal or resignation of a CTC member, or a change of -employment by a CTC member, creates a situation where more than 1/3 of -the CTC membership shares an employer, then the situation must be -immediately remedied by the resignation or removal of one or more CTC -members affiliated with the over-represented employer(s). - -### CTC Activities - -Typical activities of a CTC member include: - -* attending the weekly meeting -* commenting on the weekly CTC meeting issue and issues labeled `ctc-review` -* participating in CTC email threads -* volunteering for tasks that arise from CTC meetings and related discussions -* other activities (beyond those typical of Collaborators) that facilitate the - smooth day-to-day operation of the Node.js project - -Note that CTC members are also Collaborators and therefore typically perform -Collaborator activities as well. - -### CTC Meetings - -The CTC meets weekly in a voice conference call. The meeting is run by a -designated meeting chair approved by the CTC. Each meeting is streamed on +The TSC meets regularly in a voice conference call. The meeting is run by a +designated meeting chair approved by the TSC. Each meeting is streamed on YouTube. -Items are added to the CTC agenda which are considered contentious or -are modifications of governance, contribution policy, CTC membership, +Items are added to the TSC agenda which are considered contentious or +are modifications of governance, contribution policy, TSC membership, or release process. The intention of the agenda is not to approve or review all patches. @@ -125,49 +98,40 @@ group of Collaborators. Any community member or contributor can ask that something be reviewed -by the CTC by logging a GitHub issue. Any Collaborator, CTC member, or the -meeting chair can bring the issue to the CTC's attention by applying the -`ctc-review` label. If consensus-seeking among CTC members fails for a -particular issue, it may be added to the CTC meeting agenda by adding the -`ctc-agenda` label. - -Prior to each CTC meeting, the meeting chair will share the agenda with -members of the CTC. CTC members can also add items to the agenda at the -beginning of each meeting. The meeting chair and the CTC cannot veto or remove +by the TSC by logging a GitHub issue. Any Collaborator, TSC member, or the +meeting chair can bring the issue to the TSC's attention by applying the +`tsc-review` label. If consensus-seeking among TSC members fails for a +particular issue, it may be added to the TSC meeting agenda by adding the +`tsc-agenda` label. + +Prior to each TSC meeting, the meeting chair will share the agenda with +members of the TSC. TSC members can also add items to the agenda at the +beginning of each meeting. The meeting chair and the TSC cannot veto or remove items. -The CTC may invite persons or representatives from certain projects to -participate in a non-voting capacity. +The TSC may invite additional persons to participate in a non-voting capacity. The meeting chair is responsible for ensuring that minutes are taken and that a pull request with the minutes is submitted after the meeting. Due to the challenges of scheduling a global meeting with participants in -several timezones, the CTC will seek to resolve as many agenda items as possible +several timezones, the TSC will seek to resolve as many agenda items as possible outside of meetings using -[the CTC issue tracker](https://github.com/nodejs/CTC/issues). The process in +[the TSC issue tracker](https://github.com/nodejs/TSC/issues). The process in the issue tracker is: -* A CTC member opens an issue explaining the proposal/issue and @-mentions - @nodejs/ctc. -* After 72 hours, if there are two or more `LGTM`s from other CTC members and no - explicit opposition from other CTC members, then the proposal is approved. -* If there are any CTC members objecting, then a conversation ensues until +* A TSC member opens an issue explaining the proposal/issue and @-mentions + @nodejs/tsc. +* After 72 hours, if there are two or more `LGTM`s from other TSC members and no + explicit opposition from other TSC members, then the proposal is approved. +* If there are any TSC members objecting, then a conversation ensues until either the proposal is dropped or the objecting members are persuaded. If there is an extended impasse, a motion for a vote may be made. ## Consensus Seeking Process -The CTC follows a -[Consensus Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) -decision making model. - -When an agenda item has appeared to reach a consensus, the meeting chair will -ask "Does anyone object?" as a final call for dissent from the consensus. - -If an agenda item cannot reach a consensus, a CTC member can call for either a -closing vote or a vote to table the issue to the next meeting. All votes -(including votes to close or table) pass if and only if more than 50% of the CTC -members (excluding individuals who explicitly abstain) vote in favor. For -example, if there are 20 CTC members, and 5 of those members indicate that they -abstain, then 8 votes in favor are required for a resolution to pass. +The TSC follows a [Consensus Seeking][] decision making model as described by +the [TSC Charter][]. + +[TSC Charter]: https://github.com/nodejs/TSC/blob/master/TSC-Charter.md +[Consensus Seeking]: http://en.wikipedia.org/wiki/Consensus-seeking_decision-making diff -Nru nodejs-6.11.2~dfsg/lib/assert.js nodejs-6.11.4~dfsg/lib/assert.js --- nodejs-6.11.2~dfsg/lib/assert.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/assert.js 2017-10-03 17:11:27.000000000 +0000 @@ -20,8 +20,7 @@ 'use strict'; -// UTILITY -const compare = process.binding('buffer').compare; +const { compare } = process.binding('buffer'); const util = require('util'); const Buffer = require('buffer').Buffer; const pToString = (obj) => Object.prototype.toString.call(obj); @@ -49,7 +48,7 @@ this.message = getMessage(this); this.generatedMessage = true; } - var stackStartFunction = options.stackStartFunction || fail; + const stackStartFunction = options.stackStartFunction || fail; Error.captureStackTrace(this, stackStartFunction); }; @@ -73,7 +72,7 @@ // All of the following functions must throw an AssertionError // when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide +// may be undefined if not provided. All assertion methods provide // both the actual and expected values to the assertion error for // display purposes. @@ -86,25 +85,16 @@ stackStartFunction: stackStartFunction }); } - -// EXTENSION! allows for well behaved errors defined elsewhere. assert.fail = fail; // Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - +// by !!value. function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); + if (!value) fail(value, true, message, '==', ok); } assert.ok = ok; -// The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); +// The equality assertion tests shallow, coercive equality with ==. /* eslint-disable no-restricted-properties */ assert.equal = function equal(actual, expected, message) { if (actual != expected) fail(actual, expected, message, '==', assert.equal); @@ -112,31 +102,27 @@ // The non-equality assertion tests for whether two objects are not // equal with !=. -// assert.notEqual(actual, expected, message_opt); - assert.notEqual = function notEqual(actual, expected, message) { if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); + fail(actual, expected, message, '!=', notEqual); } }; // The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); + if (!innerDeepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', deepEqual); } }; /* eslint-enable */ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + if (!innerDeepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', deepStrictEqual); } }; -function _deepEqual(actual, expected, strict, memos) { +function innerDeepEqual(actual, expected, strict, memos) { // All identical values are equivalent, as determined by ===. if (actual === expected) { return true; @@ -247,45 +233,40 @@ // Possibly expensive deep test: for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) + if (!innerDeepEqual(a[key], b[key], strict, actualVisitedObjects)) return false; } return true; } // The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + if (innerDeepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', notDeepEqual); } }; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + if (innerDeepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', + notDeepStrictEqual); } } // The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - assert.strictEqual = function strictEqual(actual, expected, message) { if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); + fail(actual, expected, message, '===', strictEqual); } }; // The strict non-equality assertion tests for strict inequality, as // determined by !==. -// assert.notStrictEqual(actual, expected, message_opt); - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); + fail(actual, expected, message, '!==', notStrictEqual); } }; @@ -314,7 +295,7 @@ return expected.call({}, actual) === true; } -function _tryBlock(block) { +function tryBlock(block) { var error; try { block(); @@ -324,9 +305,7 @@ return error; } -function _throws(shouldThrow, block, expected, message) { - var actual; - +function innerThrows(shouldThrow, block, expected, message) { if (typeof block !== 'function') { throw new TypeError('"block" argument must be a function'); } @@ -336,13 +315,13 @@ expected = null; } - actual = _tryBlock(block); + const actual = tryBlock(block); message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + (message ? ' ' + message : '.'); if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); + fail(actual, expected, 'Missing expected exception' + message, fail); } const userProvidedMessage = typeof message === 'string'; @@ -353,7 +332,7 @@ userProvidedMessage && expectedException(actual, expected)) || isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); + fail(actual, expected, 'Got unwanted exception' + message, fail); } if ((shouldThrow && actual && expected && @@ -363,15 +342,12 @@ } // Expected to throw an error. -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); +assert.throws = function throws(block, error, message) { + innerThrows(true, block, error, message); }; -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); +assert.doesNotThrow = function doesNotThrow(block, error, message) { + innerThrows(false, block, error, message); }; -assert.ifError = function(err) { if (err) throw err; }; +assert.ifError = function ifError(err) { if (err) throw err; }; diff -Nru nodejs-6.11.2~dfsg/lib/buffer.js nodejs-6.11.4~dfsg/lib/buffer.js --- nodejs-6.11.2~dfsg/lib/buffer.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/buffer.js 2017-10-03 17:11:27.000000000 +0000 @@ -58,7 +58,7 @@ } /** - * The Buffer() construtor is "soft deprecated" ... that is, it is deprecated + * The Buffer() constructor is "soft deprecated" ... that is, it is deprecated * in the documentation and should not be used moving forward. Rather, * developers should use one of the three new factory APIs: Buffer.from(), * Buffer.allocUnsafe() or Buffer.alloc() based on their specific needs. There @@ -124,7 +124,7 @@ // Since we are filling anyway, don't zero fill initially. // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would - // be interpretted as a start offset. + // be interpreted as a start offset. if (typeof encoding !== 'string') encoding = undefined; return createUnsafeBuffer(size).fill(fill, encoding); @@ -626,7 +626,7 @@ case 'ascii': case 'hex': return binding.indexOfBuffer( - buffer, Buffer.from(val, encoding), byteOffset, encoding, dir); + buffer, Buffer.from(val, encoding), byteOffset, encoding, dir); default: if (loweredCase) { diff -Nru nodejs-6.11.2~dfsg/lib/child_process.js nodejs-6.11.4~dfsg/lib/child_process.js --- nodejs-6.11.2~dfsg/lib/child_process.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/child_process.js 2017-10-03 17:11:27.000000000 +0000 @@ -48,7 +48,7 @@ // Use a separate fd=3 for the IPC channel. Inherit stdin, stdout, // and stderr from the parent if silent isn't set. options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] : - [0, 1, 2, 'ipc']; + [0, 1, 2, 'ipc']; } else if (options.stdio.indexOf('ipc') === -1) { throw new TypeError('Forked processes must have an IPC channel'); } @@ -321,7 +321,7 @@ if (process.platform === 'win32') { file = typeof options.shell === 'string' ? options.shell : - process.env.comspec || 'cmd.exe'; + process.env.comspec || 'cmd.exe'; args = ['/s', '/c', '"' + command + '"']; options.windowsVerbatimArguments = true; } else { @@ -427,9 +427,9 @@ pipe.input = Buffer.from(input, options.encoding); else throw new TypeError(util.format( - 'stdio[%d] should be Buffer or string not %s', - i, - typeof input)); + 'stdio[%d] should be Buffer or string not %s', + i, + typeof input)); } } diff -Nru nodejs-6.11.2~dfsg/lib/crypto.js nodejs-6.11.4~dfsg/lib/crypto.js --- nodejs-6.11.2~dfsg/lib/crypto.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/crypto.js 2017-10-03 17:11:27.000000000 +0000 @@ -59,24 +59,24 @@ util.inherits(Hash, LazyTransform); -Hash.prototype._transform = function(chunk, encoding, callback) { +Hash.prototype._transform = function _transform(chunk, encoding, callback) { this._handle.update(chunk, encoding); callback(); }; -Hash.prototype._flush = function(callback) { +Hash.prototype._flush = function _flush(callback) { this.push(this._handle.digest()); callback(); }; -Hash.prototype.update = function(data, encoding) { +Hash.prototype.update = function update(data, encoding) { encoding = encoding || exports.DEFAULT_ENCODING; this._handle.update(data, encoding); return this; }; -Hash.prototype.digest = function(outputEncoding) { +Hash.prototype.digest = function digest(outputEncoding) { outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; // Explicit conversion for backward compatibility. return this._handle.digest(`${outputEncoding}`); @@ -123,12 +123,12 @@ util.inherits(Cipher, LazyTransform); -Cipher.prototype._transform = function(chunk, encoding, callback) { +Cipher.prototype._transform = function _transform(chunk, encoding, callback) { this.push(this._handle.update(chunk, encoding)); callback(); }; -Cipher.prototype._flush = function(callback) { +Cipher.prototype._flush = function _flush(callback) { try { this.push(this._handle.final()); } catch (e) { @@ -138,7 +138,7 @@ callback(); }; -Cipher.prototype.update = function(data, inputEncoding, outputEncoding) { +Cipher.prototype.update = function update(data, inputEncoding, outputEncoding) { inputEncoding = inputEncoding || exports.DEFAULT_ENCODING; outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; @@ -153,7 +153,7 @@ }; -Cipher.prototype.final = function(outputEncoding) { +Cipher.prototype.final = function final(outputEncoding) { outputEncoding = outputEncoding || exports.DEFAULT_ENCODING; var ret = this._handle.final(); @@ -166,22 +166,22 @@ }; -Cipher.prototype.setAutoPadding = function(ap) { +Cipher.prototype.setAutoPadding = function setAutoPadding(ap) { this._handle.setAutoPadding(ap); return this; }; -Cipher.prototype.getAuthTag = function() { +Cipher.prototype.getAuthTag = function getAuthTag() { return this._handle.getAuthTag(); }; -Cipher.prototype.setAuthTag = function(tagbuf) { +Cipher.prototype.setAuthTag = function setAuthTag(tagbuf) { this._handle.setAuthTag(tagbuf); return this; }; -Cipher.prototype.setAAD = function(aadbuf) { +Cipher.prototype.setAAD = function setAAD(aadbuf) { this._handle.setAAD(aadbuf); return this; }; @@ -270,14 +270,14 @@ util.inherits(Sign, stream.Writable); -Sign.prototype._write = function(chunk, encoding, callback) { +Sign.prototype._write = function _write(chunk, encoding, callback) { this._handle.update(chunk, encoding); callback(); }; Sign.prototype.update = Hash.prototype.update; -Sign.prototype.sign = function(options, encoding) { +Sign.prototype.sign = function sign(options, encoding) { if (!options) throw new Error('No key provided to sign'); @@ -309,7 +309,7 @@ Verify.prototype._write = Sign.prototype._write; Verify.prototype.update = Sign.prototype.update; -Verify.prototype.verify = function(object, signature, sigEncoding) { +Verify.prototype.verify = function verify(object, signature, sigEncoding) { sigEncoding = sigEncoding || exports.DEFAULT_ENCODING; return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding)); }; @@ -477,14 +477,14 @@ } -DiffieHellman.prototype.setPublicKey = function(key, encoding) { +DiffieHellman.prototype.setPublicKey = function setPublicKey(key, encoding) { encoding = encoding || exports.DEFAULT_ENCODING; this._handle.setPublicKey(toBuf(key, encoding)); return this; }; -DiffieHellman.prototype.setPrivateKey = function(key, encoding) { +DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) { encoding = encoding || exports.DEFAULT_ENCODING; this._handle.setPrivateKey(toBuf(key, encoding)); return this; @@ -602,19 +602,21 @@ } -Certificate.prototype.verifySpkac = function(object) { +Certificate.prototype.verifySpkac = function verifySpkac(object) { return binding.certVerifySpkac(object); }; -Certificate.prototype.exportPublicKey = function(object, encoding) { - return binding.certExportPublicKey(toBuf(object, encoding)); -}; +Certificate.prototype.exportPublicKey = + function exportPublicKey(object, encoding) { + return binding.certExportPublicKey(toBuf(object, encoding)); + }; -Certificate.prototype.exportChallenge = function(object, encoding) { - return binding.certExportChallenge(toBuf(object, encoding)); -}; +Certificate.prototype.exportChallenge = + function exportChallenge(object, encoding) { + return binding.certExportChallenge(toBuf(object, encoding)); + }; exports.setEngine = function setEngine(id, flags) { diff -Nru nodejs-6.11.2~dfsg/lib/_debugger.js nodejs-6.11.4~dfsg/lib/_debugger.js --- nodejs-6.11.2~dfsg/lib/_debugger.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_debugger.js 2017-10-03 17:11:27.000000000 +0000 @@ -992,8 +992,8 @@ client.reqScopes(callback); return; } - - var frame = client.currentFrame === NO_FRAME ? frame : undefined; + var frame; + frame = client.currentFrame === NO_FRAME ? frame : undefined; self.pause(); @@ -1206,7 +1206,7 @@ script.name === client.currentScript || !script.isNative) { scripts.push( - (script.name === client.currentScript ? '* ' : ' ') + + (script.name === client.currentScript ? '* ' : ' ') + id + ': ' + path.basename(script.name) ); diff -Nru nodejs-6.11.2~dfsg/lib/events.js nodejs-6.11.4~dfsg/lib/events.js --- nodejs-6.11.2~dfsg/lib/events.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/events.js 2017-10-03 17:11:27.000000000 +0000 @@ -240,8 +240,8 @@ } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. - existing = events[type] = prepend ? [listener, existing] : - [existing, listener]; + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; } else { // If we've already got an array, just append. if (prepend) { diff -Nru nodejs-6.11.2~dfsg/lib/fs.js nodejs-6.11.4~dfsg/lib/fs.js --- nodejs-6.11.2~dfsg/lib/fs.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/fs.js 2017-10-03 17:11:27.000000000 +0000 @@ -148,20 +148,21 @@ // Static method to set the stats properties on a Stats object. function Stats( - dev, - mode, - nlink, - uid, - gid, - rdev, - blksize, - ino, - size, - blocks, - atim_msec, - mtim_msec, - ctim_msec, - birthtim_msec) { + dev, + mode, + nlink, + uid, + gid, + rdev, + blksize, + ino, + size, + blocks, + atim_msec, + mtim_msec, + ctim_msec, + birthtim_msec +) { this.dev = dev; this.mode = mode; this.nlink = nlink; @@ -1324,7 +1325,7 @@ function writeFd(fd, isUserFd) { var buffer = (data instanceof Buffer) ? - data : Buffer.from('' + data, options.encoding || 'utf8'); + data : Buffer.from('' + data, options.encoding || 'utf8'); var position = /a/.test(flag) ? null : 0; writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback); @@ -1417,9 +1418,8 @@ if (status < 0) { self._handle.close(); const error = !filename ? - errnoException(status, 'Error watching file for changes:') : - errnoException(status, - `Error watching file ${filename} for changes:`); + errnoException(status, 'Error watching file for changes:') : + errnoException(status, `Error watching file ${filename} for changes:`); error.filename = filename; self.emit('error', error); } else { @@ -1651,7 +1651,7 @@ } } - // walk down the path, swapping out linked pathparts for their real + // walk down the path, swapping out linked path parts for their real // values // NB: p.length changes. while (pos < p.length) { @@ -1765,7 +1765,7 @@ } } - // walk down the path, swapping out linked pathparts for their real + // walk down the path, swapping out linked path parts for their real // values function LOOP() { // stop if scanned past end of path diff -Nru nodejs-6.11.2~dfsg/lib/_http_agent.js nodejs-6.11.4~dfsg/lib/_http_agent.js --- nodejs-6.11.2~dfsg/lib/_http_agent.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_http_agent.js 2017-10-03 17:11:27.000000000 +0000 @@ -206,37 +206,41 @@ } self.sockets[name].push(s); debug('sockets', name, self.sockets[name].length); + installListeners(self, s, options); + cb(null, s); + } +}; - function onFree() { - self.emit('free', s, options); - } - s.on('free', onFree); +function installListeners(agent, s, options) { + function onFree() { + debug('CLIENT socket onFree'); + agent.emit('free', s, options); + } + s.on('free', onFree); - function onClose(err) { - debug('CLIENT socket onClose'); - // This is the only place where sockets get removed from the Agent. - // If you want to remove a socket from the pool, just close it. - // All socket errors end in a close event anyway. - self.removeSocket(s, options); - } - s.on('close', onClose); + function onClose(err) { + debug('CLIENT socket onClose'); + // This is the only place where sockets get removed from the Agent. + // If you want to remove a socket from the pool, just close it. + // All socket errors end in a close event anyway. + agent.removeSocket(s, options); + } + s.on('close', onClose); - function onRemove() { - // We need this function for cases like HTTP 'upgrade' - // (defined by WebSockets) where we need to remove a socket from the - // pool because it'll be locked up indefinitely - debug('CLIENT socket onRemove'); - self.removeSocket(s, options); - s.removeListener('close', onClose); - s.removeListener('free', onFree); - s.removeListener('agentRemove', onRemove); - } - s.on('agentRemove', onRemove); - cb(null, s); + function onRemove() { + // We need this function for cases like HTTP 'upgrade' + // (defined by WebSockets) where we need to remove a socket from the + // pool because it'll be locked up indefinitely + debug('CLIENT socket onRemove'); + agent.removeSocket(s, options); + s.removeListener('close', onClose); + s.removeListener('free', onFree); + s.removeListener('agentRemove', onRemove); } -}; + s.on('agentRemove', onRemove); +} -Agent.prototype.removeSocket = function(s, options) { +Agent.prototype.removeSocket = function removeSocket(s, options) { var name = this.getName(options); debug('removeSocket', name, 'writable:', s.writable); var sets = [this.sockets]; diff -Nru nodejs-6.11.2~dfsg/lib/internal/bootstrap_node.js nodejs-6.11.4~dfsg/lib/internal/bootstrap_node.js --- nodejs-6.11.2~dfsg/lib/internal/bootstrap_node.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/bootstrap_node.js 2017-10-03 17:11:27.000000000 +0000 @@ -317,20 +317,14 @@ } function tryGetCwd(path) { - var threw = true; - var cwd; try { - cwd = process.cwd(); - threw = false; - } finally { - if (threw) { - // getcwd(3) can fail if the current working directory has been deleted. - // Fall back to the directory name of the (absolute) executable path. - // It's not really correct but what are the alternatives? - return path.dirname(process.execPath); - } + return process.cwd(); + } catch (ex) { + // getcwd(3) can fail if the current working directory has been deleted. + // Fall back to the directory name of the (absolute) executable path. + // It's not really correct but what are the alternatives? + return path.dirname(process.execPath); } - return cwd; } function evalScript(name) { @@ -443,11 +437,9 @@ return NativeModule._source.hasOwnProperty(id); }; - const EXPOSE_INTERNALS = process.execArgv.some(function(arg) { - return arg.match(/^--expose[-_]internals$/); - }); + const config = process.binding('config'); - if (EXPOSE_INTERNALS) { + if (config.exposeInternals) { NativeModule.nonInternalExists = NativeModule.exists; NativeModule.isInternal = function(id) { diff -Nru nodejs-6.11.2~dfsg/lib/internal/child_process.js nodejs-6.11.4~dfsg/lib/internal/child_process.js --- nodejs-6.11.2~dfsg/lib/internal/child_process.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/child_process.js 2017-10-03 17:11:27.000000000 +0000 @@ -29,6 +29,9 @@ getSocketList }; +const MAX_HANDLE_RETRANSMISSIONS = 3; + + // this object contain function to convert TCP objects to native handle objects // and back again. const handleConversion = { @@ -94,17 +97,18 @@ return handle; }, - postSend: function(handle, options, target) { + postSend: function(message, handle, options, callback, target) { // Store the handle after successfully sending it, so it can be closed // when the NODE_HANDLE_ACK is received. If the handle could not be sent, // just close it. if (handle && !options.keepOpen) { if (target) { - // There can only be one _pendingHandle as passing handles are + // There can only be one _pendingMessage as passing handles are // processed one at a time: handles are stored in _handleQueue while // waiting for the NODE_HANDLE_ACK of the current passing handle. - assert(!target._pendingHandle); - target._pendingHandle = handle; + assert(!target._pendingMessage); + target._pendingMessage = + { callback, message, handle, options, retransmissions: 0 }; } else { handle.close(); } @@ -267,6 +271,11 @@ return false; } +function closePendingHandle(target) { + target._pendingMessage.handle.close(); + target._pendingMessage = null; +} + ChildProcess.prototype.spawn = function(options) { const self = this; @@ -334,7 +343,7 @@ // when i === 0 - we're dealing with stdin // (which is the only one writable pipe) stream.socket = createSocket(self.pid !== 0 ? - stream.handle : null, i > 0); + stream.handle : null, i > 0); if (i > 0 && self.pid !== 0) { self._closesNeeded++; @@ -346,11 +355,11 @@ } this.stdin = stdio.length >= 1 && stdio[0].socket !== undefined ? - stdio[0].socket : null; + stdio[0].socket : null; this.stdout = stdio.length >= 2 && stdio[1].socket !== undefined ? - stdio[1].socket : null; + stdio[1].socket : null; this.stderr = stdio.length >= 3 && stdio[2].socket !== undefined ? - stdio[2].socket : null; + stdio[2].socket : null; this.stdio = stdio.map(function(stdio) { return stdio.socket === undefined ? null : stdio.socket; @@ -437,7 +446,7 @@ function setupChannel(target, channel) { target._channel = channel; target._handleQueue = null; - target._pendingHandle = null; + target._pendingMessage = null; const control = new Control(channel); @@ -489,16 +498,31 @@ // handlers will go through this target.on('internalMessage', function(message, handle) { // Once acknowledged - continue sending handles. - if (message.cmd === 'NODE_HANDLE_ACK') { - if (target._pendingHandle) { - target._pendingHandle.close(); - target._pendingHandle = null; + if (message.cmd === 'NODE_HANDLE_ACK' || + message.cmd === 'NODE_HANDLE_NACK') { + + if (target._pendingMessage) { + if (message.cmd === 'NODE_HANDLE_ACK') { + closePendingHandle(target); + } else if (target._pendingMessage.retransmissions++ === + MAX_HANDLE_RETRANSMISSIONS) { + closePendingHandle(target); + process.emitWarning('Handle did not reach the receiving process ' + + 'correctly', 'SentHandleNotReceivedWarning'); + } } assert(Array.isArray(target._handleQueue)); var queue = target._handleQueue; target._handleQueue = null; + if (target._pendingMessage) { + target._send(target._pendingMessage.message, + target._pendingMessage.handle, + target._pendingMessage.options, + target._pendingMessage.callback); + } + for (var i = 0; i < queue.length; i++) { var args = queue[i]; target._send(args.message, args.handle, args.options, args.callback); @@ -513,6 +537,12 @@ if (message.cmd !== 'NODE_HANDLE') return; + // It is possible that the handle is not received because of some error on + // ancillary data reception such as MSG_CTRUNC. In this case, report the + // sender about it by sending a NODE_HANDLE_NACK message. + if (!handle) + return target._send({ cmd: 'NODE_HANDLE_NACK' }, null, true); + // Acknowledge handle receival. Don't emit error events (for example if // the other side has disconnected) because this call to send() is not // initiated by the user and it shouldn't be fatal to be unable to ACK @@ -623,7 +653,8 @@ net._setSimultaneousAccepts(handle); } } else if (this._handleQueue && - !(message && message.cmd === 'NODE_HANDLE_ACK')) { + !(message && (message.cmd === 'NODE_HANDLE_ACK' || + message.cmd === 'NODE_HANDLE_NACK'))) { // Queue request anyway to avoid out-of-order messages. this._handleQueue.push({ callback: callback, @@ -645,7 +676,7 @@ if (!this._handleQueue) this._handleQueue = []; if (obj && obj.postSend) - obj.postSend(handle, options, target); + obj.postSend(message, handle, options, callback, target); } req.oncomplete = function() { @@ -662,7 +693,7 @@ } else { // Cleanup handle on error if (obj && obj.postSend) - obj.postSend(handle, options); + obj.postSend(message, handle, options, callback); if (!options.swallowErrors) { const ex = errnoException(err, 'write'); @@ -711,10 +742,8 @@ // This marks the fact that the channel is actually disconnected. this._channel = null; - if (this._pendingHandle) { - this._pendingHandle.close(); - this._pendingHandle = null; - } + if (this._pendingMessage) + closePendingHandle(this); var fired = false; function finish() { @@ -845,8 +874,8 @@ } else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) || getHandleWrapType(stdio._handle)) { var handle = getHandleWrapType(stdio) ? - stdio : - getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle; + stdio : + getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle; acc.push({ type: 'wrap', diff -Nru nodejs-6.11.2~dfsg/lib/internal/freelist.js nodejs-6.11.4~dfsg/lib/internal/freelist.js --- nodejs-6.11.2~dfsg/lib/internal/freelist.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/freelist.js 2017-10-03 17:11:27.000000000 +0000 @@ -8,10 +8,9 @@ this.list = []; }; - exports.FreeList.prototype.alloc = function() { return this.list.length ? this.list.pop() : - this.constructor.apply(this, arguments); + this.constructor.apply(this, arguments); }; diff -Nru nodejs-6.11.2~dfsg/lib/internal/linkedlist.js nodejs-6.11.4~dfsg/lib/internal/linkedlist.js --- nodejs-6.11.2~dfsg/lib/internal/linkedlist.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/linkedlist.js 2017-10-03 17:11:27.000000000 +0000 @@ -14,7 +14,7 @@ } exports.create = create; -// show the most idle item +// Show the most idle item. function peek(list) { if (list._idlePrev === list) return null; return list._idlePrev; @@ -31,7 +31,7 @@ exports.shift = shift; -// remove a item from its list +// Remove an item from its list. function remove(item) { if (item._idleNext) { item._idleNext._idlePrev = item._idlePrev; @@ -47,18 +47,18 @@ exports.remove = remove; -// remove a item from its list and place at the end. +// Remove an item from its list and place at the end. function append(list, item) { if (item._idleNext || item._idlePrev) { remove(item); } - // items are linked with _idleNext -> (older) and _idlePrev -> (newer) + // Items are linked with _idleNext -> (older) and _idlePrev -> (newer). // Note: This linkage (next being older) may seem counter-intuitive at first. item._idleNext = list._idleNext; item._idlePrev = list; - // the list _idleNext points to tail (newest) and _idlePrev to head (oldest) + // The list _idleNext points to tail (newest) and _idlePrev to head (oldest). list._idleNext._idlePrev = item; list._idleNext = item; } diff -Nru nodejs-6.11.2~dfsg/lib/internal/process.js nodejs-6.11.4~dfsg/lib/internal/process.js --- nodejs-6.11.2~dfsg/lib/internal/process.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/process.js 2017-10-03 17:11:27.000000000 +0000 @@ -1,5 +1,7 @@ 'use strict'; +const util = require('util'); + var _lazyConstants = null; function lazyConstants() { @@ -185,10 +187,8 @@ } } - if (err) { - const errnoException = require('util')._errnoException; - throw errnoException(err, 'kill'); - } + if (err) + throw util._errnoException(err, 'kill'); return true; }; @@ -220,8 +220,7 @@ const err = wrap.start(signum); if (err) { wrap.close(); - const errnoException = require('util')._errnoException; - throw errnoException(err, 'uv_signal_start'); + throw util._errnoException(err, 'uv_signal_start'); } signalWraps[type] = wrap; @@ -261,9 +260,8 @@ function setupRawDebug() { - const format = require('util').format; const rawDebug = process._rawDebug; process._rawDebug = function() { - rawDebug(format.apply(null, arguments)); + rawDebug(util.format.apply(null, arguments)); }; } diff -Nru nodejs-6.11.2~dfsg/lib/internal/readline.js nodejs-6.11.4~dfsg/lib/internal/readline.js --- nodejs-6.11.2~dfsg/lib/internal/readline.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/readline.js 2017-10-03 17:11:27.000000000 +0000 @@ -56,7 +56,7 @@ // Code points are derived from: // http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt if (code >= 0x1100 && ( - code <= 0x115f || // Hangul Jamo + code <= 0x115f || // Hangul Jamo 0x2329 === code || // LEFT-POINTING ANGLE BRACKET 0x232a === code || // RIGHT-POINTING ANGLE BRACKET // CJK Radicals Supplement .. Enclosed CJK Letters and Months diff -Nru nodejs-6.11.2~dfsg/lib/internal/repl.js nodejs-6.11.4~dfsg/lib/internal/repl.js --- nodejs-6.11.2~dfsg/lib/internal/repl.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/repl.js 2017-10-03 17:11:27.000000000 +0000 @@ -134,14 +134,14 @@ // If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to // ~/.node_repl_history, warn the user about it and proceed. repl._writeToOutput( - '\nThe old repl history file has the same name and location as ' + + '\nThe old repl history file has the same name and location as ' + `the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`); repl._refreshLine(); } else if (oldHistoryPath) { // Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format. repl._writeToOutput( - '\nConverting old JSON repl history to line-separated history.\n' + + '\nConverting old JSON repl history to line-separated history.\n' + `The new repl history file can be found at ${historyPath}.\n`); repl._refreshLine(); @@ -225,7 +225,7 @@ function _replHistoryMessage() { if (this.history.length === 0) { this._writeToOutput( - '\nPersistent history support disabled. ' + + '\nPersistent history support disabled. ' + 'Set the NODE_REPL_HISTORY environment\nvariable to ' + 'a valid, user-writable path to enable.\n' ); diff -Nru nodejs-6.11.2~dfsg/lib/internal/socket_list.js nodejs-6.11.4~dfsg/lib/internal/socket_list.js --- nodejs-6.11.2~dfsg/lib/internal/socket_list.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/socket_list.js 2017-10-03 17:11:27.000000000 +0000 @@ -5,7 +5,7 @@ const EventEmitter = require('events'); const util = require('util'); -// This object keep track of the socket there are sended +// This object keeps track of the sockets that are sent function SocketListSend(slave, key) { EventEmitter.call(this); @@ -54,7 +54,7 @@ }); }; -// This object keep track of the socket there are received +// This object keeps track of the sockets there are received function SocketListReceive(slave, key) { EventEmitter.call(this); @@ -95,7 +95,7 @@ SocketListReceive.prototype.add = function(obj) { this.connections++; - // Notify previous owner of socket about its state change + // Notify the previous owner of the socket about its state change obj.socket.once('close', () => { this.connections--; diff -Nru nodejs-6.11.2~dfsg/lib/internal/v8_prof_polyfill.js nodejs-6.11.4~dfsg/lib/internal/v8_prof_polyfill.js --- nodejs-6.11.2~dfsg/lib/internal/v8_prof_polyfill.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/internal/v8_prof_polyfill.js 2017-10-03 17:11:27.000000000 +0000 @@ -105,12 +105,13 @@ function macCppfiltNm(out) { // Re-grouped copy-paste from `tickprocessor.js` const FUNC_RE = /^([0-9a-fA-F]{8,16} [iItT] )(.*)$/gm; + const CLEAN_RE = /^[0-9a-fA-F]{8,16} [iItT] /; let entries = out.match(FUNC_RE); if (entries === null) return out; entries = entries.map((entry) => { - return entry.replace(/^[0-9a-fA-F]{8,16} [iItT] /, '') + return entry.replace(CLEAN_RE, '') }); let filtered; @@ -123,7 +124,7 @@ } let i = 0; - filtered = filtered.split(/\n/g); + filtered = filtered.split('\n'); return out.replace(FUNC_RE, (all, prefix, postfix) => { return prefix + (filtered[i++] || postfix); }); diff -Nru nodejs-6.11.2~dfsg/lib/net.js nodejs-6.11.4~dfsg/lib/net.js --- nodejs-6.11.2~dfsg/lib/net.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/net.js 2017-10-03 17:11:27.000000000 +0000 @@ -912,8 +912,9 @@ this._sockname = null; } - var pipe = !!options.path; - debug('pipe', pipe, options.path); + const path = options.path; + var pipe = !!path; + debug('pipe', pipe, path); if (!this._handle) { this._handle = pipe ? new Pipe() : new TCP(); @@ -930,7 +931,10 @@ this.writable = true; if (pipe) { - connect(this, options.path); + if (typeof path !== 'string') { + throw new TypeError('"path" option must be a string: ' + path); + } + connect(this, path); } else { lookupAndConnect(this, options); } @@ -1338,7 +1342,7 @@ self.once('listening', lastArg); } - var port = toNumber(arguments[0]); + var port = typeof arguments[0] === 'undefined' ? 0 : toNumber(arguments[0]); // The third optional argument is the backlog size. // When the ip is omitted it can be the second argument. diff -Nru nodejs-6.11.2~dfsg/lib/path.js nodejs-6.11.4~dfsg/lib/path.js --- nodejs-6.11.2~dfsg/lib/path.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/path.js 2017-10-03 17:11:27.000000000 +0000 @@ -767,7 +767,9 @@ } } } else if (code === 47/*/*/ || code === 92/*\*/) { - return path[0]; + // `path` contains just a path separator, exit early to avoid + // unnecessary work + return path; } for (var i = len - 1; i >= offset; --i) { @@ -885,6 +887,7 @@ extname: function extname(path) { assertPath(path); + var start = 0; var startDot = -1; var startPart = 0; var end = -1; @@ -892,7 +895,20 @@ // Track the state of characters (if any) we see before our first dot and // after any path separator we find var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { + + // Check for a drive letter prefix so as not to mistake the following + // path separator as an extra separator at the end of the path that can be + // disregarded + if (path.length >= 2) { + const code = path.charCodeAt(0); + if (path.charCodeAt(1) === 58/*:*/ && + ((code >= 65/*A*/ && code <= 90/*Z*/) || + (code >= 97/*a*/ && code <= 122/*z*/))) { + start = startPart = 2; + } + } + + for (var i = path.length - 1; i >= start; --i) { const code = path.charCodeAt(i); if (code === 47/*/*/ || code === 92/*\*/) { // If we reached a path separator that was not part of a set of path @@ -956,15 +972,12 @@ var len = path.length; var rootEnd = 0; var code = path.charCodeAt(0); - var isAbsolute = false; // Try to match a root if (len > 1) { if (code === 47/*/*/ || code === 92/*\*/) { // Possible UNC root - isAbsolute = true; - code = path.charCodeAt(1); rootEnd = 1; if (code === 47/*/*/ || code === 92/*\*/) { @@ -1020,16 +1033,15 @@ if (len === 3) { // `path` contains just a drive root, exit early to avoid // unnecessary work - ret.root = ret.dir = path.slice(0, 3); + ret.root = ret.dir = path; return ret; } - isAbsolute = true; rootEnd = 3; } } else { // `path` contains just a drive root, exit early to avoid // unnecessary work - ret.root = ret.dir = path.slice(0, 2); + ret.root = ret.dir = path; return ret; } } @@ -1037,7 +1049,7 @@ } else if (code === 47/*/*/ || code === 92/*\*/) { // `path` contains just a path separator, exit early to avoid // unnecessary work - ret.root = ret.dir = path[0]; + ret.root = ret.dir = path; return ret; } @@ -1045,7 +1057,7 @@ ret.root = path.slice(0, rootEnd); var startDot = -1; - var startPart = 0; + var startPart = rootEnd; var end = -1; var matchedSlash = true; var i = path.length - 1; @@ -1094,26 +1106,21 @@ startDot === end - 1 && startDot === startPart + 1)) { if (end !== -1) { - if (startPart === 0 && isAbsolute) - ret.base = ret.name = path.slice(rootEnd, end); - else - ret.base = ret.name = path.slice(startPart, end); + ret.base = ret.name = path.slice(startPart, end); } } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(rootEnd, startDot); - ret.base = path.slice(rootEnd, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); ret.ext = path.slice(startDot, end); } - if (startPart > 0) + // If the directory is the root, use the entire root as the `dir` including + // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the + // trailing slash (`C:\abc\def` -> `C:\abc`). + if (startPart > 0 && startPart !== rootEnd) ret.dir = path.slice(0, startPart - 1); - else if (isAbsolute) - ret.dir = path.slice(0, rootEnd); + else + ret.dir = ret.root; return ret; }, diff -Nru nodejs-6.11.2~dfsg/lib/readline.js nodejs-6.11.4~dfsg/lib/readline.js --- nodejs-6.11.2~dfsg/lib/readline.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/readline.js 2017-10-03 17:11:27.000000000 +0000 @@ -8,7 +8,6 @@ const kHistorySize = 30; const kMincrlfDelay = 100; -const kMaxcrlfDelay = 2000; const util = require('util'); const debug = util.debuglog('readline'); @@ -83,8 +82,8 @@ this.input = input; this.historySize = historySize; this.removeHistoryDuplicates = !!removeHistoryDuplicates; - this.crlfDelay = Math.max(kMincrlfDelay, - Math.min(kMaxcrlfDelay, crlfDelay >>> 0)); + this.crlfDelay = crlfDelay ? + Math.max(kMincrlfDelay, crlfDelay) : kMincrlfDelay; // Check arity, 2 - for async, 1 for sync if (typeof completer === 'function') { @@ -471,8 +470,7 @@ var item = group[idx]; self._writeToOutput(item); if (col < maxColumns - 1) { - for (var s = 0, itemLen = item.length; s < width - itemLen; - s++) { + for (var s = 0, itemLen = item.length; s < width - itemLen; s++) { self._writeToOutput(' '); } } @@ -683,12 +681,12 @@ var diffWidth; if (diffCursor < 0) { diffWidth = -getStringWidth( - this.line.substring(this.cursor, oldcursor) - ); + this.line.substring(this.cursor, oldcursor) + ); } else if (diffCursor > 0) { diffWidth = getStringWidth( - this.line.substring(this.cursor, oldcursor) - ); + this.line.substring(this.cursor, oldcursor) + ); } exports.moveCursor(this.output, diffWidth, 0); this.prevRows = newPos.rows; @@ -1128,5 +1126,5 @@ exports.stripVTControlCharacters = internalUtil.deprecate( - stripVTControlCharacters, - 'stripVTControlCharacters is deprecated and will be removed.'); + stripVTControlCharacters, + 'stripVTControlCharacters is deprecated and will be removed.'); diff -Nru nodejs-6.11.2~dfsg/lib/repl.js nodejs-6.11.4~dfsg/lib/repl.js --- nodejs-6.11.2~dfsg/lib/repl.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/repl.js 2017-10-03 17:11:27.000000000 +0000 @@ -61,7 +61,7 @@ } // hack for repl require to work properly with node_modules folders -module.paths = require('module')._nodeModulePaths(module.filename); +module.paths = Module._nodeModulePaths(module.filename); // If obj.hasOwnProperty has been overridden, then calling // obj.hasOwnProperty(prop) will break. @@ -216,7 +216,7 @@ if (breakEvalOnSigint && eval_) { // Allowing this would not reflect user expectations. - // breakEvalOnSigint affects only the behaviour of the default eval(). + // breakEvalOnSigint affects only the behavior of the default eval(). throw new Error('Cannot specify both breakEvalOnSigint and eval for REPL'); } @@ -519,10 +519,11 @@ // Check to see if a REPL keyword was used. If it returns true, // display next prompt and return. - if (cmd && cmd.charAt(0) === '.' && isNaN(parseFloat(cmd))) { - var matches = cmd.match(/^\.([^\s]+)\s*(.*)$/); - var keyword = matches && matches[1]; - var rest = matches && matches[2]; + if (cmd && cmd.charAt(0) === '.' && cmd.charAt(1) !== '.' && + isNaN(parseFloat(cmd))) { + const matches = cmd.match(/^\.([^\s]+)\s*(.*)$/); + const keyword = matches && matches[1]; + const rest = matches && matches[2]; if (self.parseREPLKeyword(keyword, rest) === true) { return; } else if (!self.bufferedCommand) { @@ -817,7 +818,7 @@ function complete(line, callback) { // There may be local variables to evaluate, try a nested REPL if (this.bufferedCommand !== undefined && this.bufferedCommand.length) { - // Get a new array of inputed lines + // Get a new array of inputted lines var tmp = this.lines.slice(); // Kill off all function declarations to push all local variables into // global scope @@ -846,6 +847,7 @@ var completeOn, i, group, c; // REPL commands (e.g. ".break"). + var filter; var match = null; match = line.match(/^\s*\.(\w*)$/); if (match) { @@ -865,10 +867,10 @@ completeOn = match[1]; var subdir = match[2] || ''; - var filter = match[1]; + filter = match[1]; var dir, files, f, name, base, ext, abs, subfiles, s; group = []; - var paths = module.paths.concat(require('module').globalPaths); + var paths = module.paths.concat(Module.globalPaths); for (i = 0; i < paths.length; i++) { dir = path.resolve(paths[i], subdir); try { diff -Nru nodejs-6.11.2~dfsg/lib/_stream_readable.js nodejs-6.11.4~dfsg/lib/_stream_readable.js --- nodejs-6.11.2~dfsg/lib/_stream_readable.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_stream_readable.js 2017-10-03 17:11:27.000000000 +0000 @@ -877,8 +877,8 @@ } else { // result spans more than one buffer ret = (hasStrings - ? copyFromBufferString(n, list) - : copyFromBuffer(n, list)); + ? copyFromBufferString(n, list) + : copyFromBuffer(n, list)); } return ret; } diff -Nru nodejs-6.11.2~dfsg/lib/_stream_writable.js nodejs-6.11.4~dfsg/lib/_stream_writable.js --- nodejs-6.11.2~dfsg/lib/_stream_writable.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_stream_writable.js 2017-10-03 17:11:27.000000000 +0000 @@ -144,6 +144,8 @@ value: function(object) { if (realHasInstance.call(this, object)) return true; + if (this !== Writable) + return false; return object && object._writableState instanceof WritableState; } diff -Nru nodejs-6.11.2~dfsg/lib/timers.js nodejs-6.11.4~dfsg/lib/timers.js --- nodejs-6.11.2~dfsg/lib/timers.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/timers.js 2017-10-03 17:11:27.000000000 +0000 @@ -367,7 +367,7 @@ function createSingleTimeout(callback, after, args) { after *= 1; // coalesce to number or NaN if (!(after >= 1 && after <= TIMEOUT_MAX)) - after = 1; // schedule on next tick, follows browser behaviour + after = 1; // schedule on next tick, follows browser behavior var timer = new Timeout(after, callback, args); if (process.domain) @@ -383,20 +383,20 @@ var args = timer._timerArgs; var callback = timer._onTimeout; if (!args) - callback.call(timer); + timer._onTimeout(); else { switch (args.length) { case 1: - callback.call(timer, args[0]); + timer._onTimeout(args[0]); break; case 2: - callback.call(timer, args[0], args[1]); + timer._onTimeout(args[0], args[1]); break; case 3: - callback.call(timer, args[0], args[1], args[2]); + timer._onTimeout(args[0], args[1], args[2]); break; default: - callback.apply(timer, args); + Function.prototype.apply.call(callback, timer, args); } } if (timer._repeat) @@ -454,7 +454,7 @@ function createRepeatTimeout(callback, repeat, args) { repeat *= 1; // coalesce to number or NaN if (!(repeat >= 1 && repeat <= TIMEOUT_MAX)) - repeat = 1; // schedule on next tick, follows browser behaviour + repeat = 1; // schedule on next tick, follows browser behavior var timer = new Timeout(repeat, callback, args); timer._repeat = repeat; @@ -678,7 +678,7 @@ return timer._callback(argv[0], argv[1], argv[2]); // more than 3 arguments run slower with .apply default: - return timer._callback.apply(timer, argv); + return Function.prototype.apply.call(timer._callback, timer, argv); } } diff -Nru nodejs-6.11.2~dfsg/lib/_tls_common.js nodejs-6.11.4~dfsg/lib/_tls_common.js --- nodejs-6.11.2~dfsg/lib/_tls_common.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_tls_common.js 2017-10-03 17:11:27.000000000 +0000 @@ -149,12 +149,12 @@ if (!c) return null; - if (c.issuer) c.issuer = tls.parseCertString(c.issuer); - if (c.issuerCertificate && c.issuerCertificate !== c) { + if (c.issuer != null) c.issuer = tls.parseCertString(c.issuer); + if (c.issuerCertificate != null && c.issuerCertificate !== c) { c.issuerCertificate = translatePeerCertificate(c.issuerCertificate); } - if (c.subject) c.subject = tls.parseCertString(c.subject); - if (c.infoAccess) { + if (c.subject != null) c.subject = tls.parseCertString(c.subject); + if (c.infoAccess != null) { var info = c.infoAccess; c.infoAccess = {}; diff -Nru nodejs-6.11.2~dfsg/lib/tls.js nodejs-6.11.4~dfsg/lib/tls.js --- nodejs-6.11.2~dfsg/lib/tls.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/tls.js 2017-10-03 17:11:27.000000000 +0000 @@ -10,7 +10,7 @@ // Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations // every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more -// renegotations are seen. The settings are applied to all remote client +// renegotiations are seen. The settings are applied to all remote client // connections. exports.CLIENT_RENEG_LIMIT = 3; exports.CLIENT_RENEG_WINDOW = 600; @@ -197,7 +197,7 @@ if (!valid) { const err = new Error( - `Hostname/IP doesn't match certificate's altnames: "${reason}"`); + `Hostname/IP doesn't match certificate's altnames: "${reason}"`); err.reason = reason; err.host = host; err.cert = cert; diff -Nru nodejs-6.11.2~dfsg/lib/_tls_legacy.js nodejs-6.11.4~dfsg/lib/_tls_legacy.js --- nodejs-6.11.2~dfsg/lib/_tls_legacy.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_tls_legacy.js 2017-10-03 17:11:27.000000000 +0000 @@ -361,7 +361,7 @@ CryptoStream.prototype.getPeerCertificate = function(detailed) { if (this.pair.ssl) { return common.translatePeerCertificate( - this.pair.ssl.getPeerCertificate(detailed)); + this.pair.ssl.getPeerCertificate(detailed)); } return null; @@ -717,11 +717,12 @@ this._rejectUnauthorized = rejectUnauthorized ? true : false; this._requestCert = requestCert ? true : false; - this.ssl = new Connection(this.credentials.context, - this._isServer ? true : false, - this._isServer ? this._requestCert : - options.servername, - this._rejectUnauthorized); + this.ssl = new Connection( + this.credentials.context, + this._isServer ? true : false, + this._isServer ? this._requestCert : options.servername, + this._rejectUnauthorized + ); if (this._isServer) { this.ssl.onhandshakestart = () => onhandshakestart.call(this); diff -Nru nodejs-6.11.2~dfsg/lib/_tls_wrap.js nodejs-6.11.4~dfsg/lib/_tls_wrap.js --- nodejs-6.11.2~dfsg/lib/_tls_wrap.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/_tls_wrap.js 2017-10-03 17:11:27.000000000 +0000 @@ -402,7 +402,7 @@ // lib/net.js expect this value to be non-zero if write hasn't been flushed // immediately - // TODO(indutny): rewise this solution, it might be 1 before handshake and + // TODO(indutny): revise this solution, it might be 1 before handshake and // represent real writeQueueSize during regular writes. ssl.writeQueueSize = 1; @@ -641,7 +641,7 @@ TLSSocket.prototype.getPeerCertificate = function(detailed) { if (this._handle) { return common.translatePeerCertificate( - this._handle.getPeerCertificate(detailed)); + this._handle.getPeerCertificate(detailed)); } return null; @@ -705,7 +705,7 @@ // outcomes: // // A) verifyError returns null meaning the client's certificate is signed -// by one of the server's CAs. The server know's the client idenity now +// by one of the server's CAs. The server now knows the client's identity // and the client is authorized. // // B) For some reason the client's certificate is not acceptable - @@ -984,7 +984,7 @@ var cb = args[1]; // If args[0] was options, then normalize dealt with it. - // If args[0] is port, or args[0], args[1] is host,port, we need to + // If args[0] is port, or args[0], args[1] is host, port, we need to // find the options and merge them in, normalize's options has only // the host/port/path args that it knows about, not the tls options. // This means that options.host overrides a host arg. diff -Nru nodejs-6.11.2~dfsg/lib/tty.js nodejs-6.11.4~dfsg/lib/tty.js --- nodejs-6.11.2~dfsg/lib/tty.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/tty.js 2017-10-03 17:11:27.000000000 +0000 @@ -50,7 +50,7 @@ // Prevents interleaved or dropped stdout/stderr output for terminals. // As noted in the following reference, local TTYs tend to be quite fast and - // this behaviour has become expected due historical functionality on OS X, + // this behavior has become expected due historical functionality on OS X, // even though it was originally intended to change in v1.0.2 (Libuv 1.2.1). // Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671 this._handle.setBlocking(process.env.NODE_TTY_UNSAFE_ASYNC !== '1'); diff -Nru nodejs-6.11.2~dfsg/lib/url.js nodejs-6.11.4~dfsg/lib/url.js --- nodejs-6.11.2~dfsg/lib/url.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/url.js 2017-10-03 17:11:27.000000000 +0000 @@ -371,8 +371,8 @@ var firstIdx = (questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx) - ? questionIdx - : hashIdx); + ? questionIdx + : hashIdx); if (firstIdx === -1) { if (rest.length > 0) this.pathname = rest; @@ -436,7 +436,7 @@ var lastEscapedPos = 0; for (var i = 0; i < rest.length; ++i) { // Manual switching is faster than using a Map/Object. - // `escaped` contains substring up to the last escaped cahracter. + // `escaped` contains substring up to the last escaped character. switch (rest.charCodeAt(i)) { case 9: // '\t' // Concat if there are ordinary characters in the middle. @@ -567,9 +567,11 @@ if (this.host) { host = auth + this.host; } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? + host = auth + ( + this.hostname.indexOf(':') === -1 ? this.hostname : - '[' + this.hostname + ']'); + '[' + this.hostname + ']' + ); if (this.port) { host += ':' + this.port; } @@ -736,8 +738,7 @@ var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'); var isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' + relative.host || relative.pathname && relative.pathname.charAt(0) === '/' ); var mustEndAbs = (isRelAbs || isSourceAbs || (result.host && relative.pathname)); @@ -804,8 +805,8 @@ //occasionally the auth can get stuck only in host //this especially happens in cases like //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - const authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; + const authInHost = + result.host && result.host.indexOf('@') > 0 && result.host.split('@'); if (authInHost) { result.auth = authInHost.shift(); result.host = result.hostname = authInHost.shift(); @@ -841,8 +842,8 @@ // then it must NOT get a trailing slash. var last = srcPath.slice(-1)[0]; var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); // strip single dots, resolve double dots to parent dir // if the path tries to go above the root, `up` ends up > 0 @@ -881,13 +882,13 @@ // put the host back if (noLeadingSlashes) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; + result.hostname = + result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occasionally the auth can get stuck only in host //this especially happens in cases like //url.resolveObject('mailto:local1@domain1', 'local2@domain2') const authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; + result.host.split('@') : false; if (authInHost) { result.auth = authInHost.shift(); result.host = result.hostname = authInHost.shift(); diff -Nru nodejs-6.11.2~dfsg/lib/util.js nodejs-6.11.4~dfsg/lib/util.js --- nodejs-6.11.2~dfsg/lib/util.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/lib/util.js 2017-10-03 17:11:27.000000000 +0000 @@ -691,7 +691,7 @@ for (const key of keys) { if (typeof key === 'symbol' || !numbersOnlyRE.test(key)) { output.push( - formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); + formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } } return output; diff -Nru nodejs-6.11.2~dfsg/Makefile nodejs-6.11.4~dfsg/Makefile --- nodejs-6.11.2~dfsg/Makefile 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/Makefile 2017-10-03 17:11:11.000000000 +0000 @@ -565,7 +565,8 @@ --release-urlbase=$(RELEASE_URLBASE) \ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) $(MAKE) install V=$(V) DESTDIR=$(PKGDIR) - SIGN="$(CODESIGN_CERT)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh + SIGN="$(CODESIGN_CERT)" PKGDIR="$(PKGDIR)/usr/local" bash \ + tools/osx-codesign.sh cat tools/osx-pkg.pmdoc/index.xml.tmpl \ | sed -E "s/\\{nodeversion\\}/$(FULLVERSION)/g" \ | sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \ @@ -670,6 +671,9 @@ cp README.md $(BINARYNAME) cp LICENSE $(BINARYNAME) cp CHANGELOG.md $(BINARYNAME) +ifeq ($(OSTYPE),darwin) + SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" bash tools/osx-codesign.sh +endif tar -cf $(BINARYNAME).tar $(BINARYNAME) $(RM) -r $(BINARYNAME) gzip -c -f -9 $(BINARYNAME).tar > $(BINARYNAME).tar.gz diff -Nru nodejs-6.11.2~dfsg/node.gyp nodejs-6.11.4~dfsg/node.gyp --- nodejs-6.11.2~dfsg/node.gyp 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/node.gyp 2017-10-03 17:11:27.000000000 +0000 @@ -488,7 +488,7 @@ '<(OBJ_DIR)/node/src/node_dtrace_ustack.o' ], 'conditions': [ - [ 'target_arch=="ia32"', { + [ 'target_arch=="ia32" or target_arch=="arm"', { 'action': [ 'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc', '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)', diff -Nru nodejs-6.11.2~dfsg/README.md nodejs-6.11.4~dfsg/README.md --- nodejs-6.11.2~dfsg/README.md 2017-08-01 05:39:04.000000000 +0000 +++ nodejs-6.11.4~dfsg/README.md 2017-10-03 17:11:11.000000000 +0000 @@ -35,7 +35,7 @@ * [Building Node.js](#building-nodejs) * [Security](#security) * [Current Project Team Members](#current-project-team-members) - * [CTC (Core Technical Committee)](#ctc-core-technical-committee) + * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) * [Collaborators](#collaborators) * [Release Team](#release-team) @@ -55,9 +55,9 @@ channel. _Please note that unofficial resources are neither managed by (nor necessarily -endorsed by) the Node.js TSC/CTC. Specifically, such resources are not +endorsed by) the Node.js TSC. Specifically, such resources are not currently covered by the [Node.js Moderation Policy][] and the selection and -actions of resource operators/moderators are not subject to TSC/CTC oversight._ +actions of resource operators/moderators are not subject to TSC oversight._ ## Release Types @@ -81,12 +81,13 @@ ordered codenames, beginning with v4 Argon. LTS releases are less frequent and will attempt to maintain consistent major and minor version numbers, only incrementing patch version numbers. There are no breaking changes or - feature additions, except in some special circumstances. More information - can be found in the [LTS README](https://github.com/nodejs/LTS/). + feature additions, except in some special circumstances. * **Nightly**: Versions of code in this repository on the current Current branch, automatically built every 24-hours where changes exist. Use with caution. +More information can be found in the [LTS README](https://github.com/nodejs/LTS/). + ## Download Binaries, installers, and source tarballs are available at @@ -113,11 +114,11 @@ ### Verifying Binaries -Current, LTS and Nightly download directories all contain a _SHASUM256.txt_ +Current, LTS and Nightly download directories all contain a _SHASUMS256.txt_ file that lists the SHA checksums for each file available for download. -The _SHASUM256.txt_ can be downloaded using curl. +The _SHASUMS256.txt_ can be downloaded using curl. ```console $ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt @@ -134,10 +135,10 @@ downloaded)_ Additionally, Current and LTS releases (not Nightlies) have GPG signed -copies of SHASUM256.txt files available as SHASUM256.txt.asc. You can use +copies of SHASUMS256.txt files available as SHASUMS256.txt.asc. You can use `gpg` to verify that the file has not been tampered with. -To verify a SHASUM256.txt.asc, you will first need to import all of +To verify a SHASUMS256.txt.asc, you will first need to import all of the GPG keys of individuals authorized to create releases. They are listed at the bottom of this README under [Release Team](#release-team). Use a command such as this to import the keys: @@ -171,14 +172,59 @@ detailed response to your email within 48 hours indicating the next steps in handling your report. +There are no hard and fast rules to determine if a bug is worth reporting as +a security issue. The general rule is any issue worth reporting +must allow an attacker to compromise the confidentiality, integrity +or availability of the Node.js application or its system for which the attacker +does not already have the capability. + +To illustrate the point, here are some examples of past issues and what the +Security Reponse Team thinks of them. When in doubt, however, please do send +us a report nonetheless. + + +### Public disclosure preferred + +- [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain + function can be used to cause segfaults_. Causing program termination using + either the public Javascript APIs or the private bindings layer APIs requires + the ability to execute arbitrary Javascript code, which is already the highest + level of privilege possible. + +- [#12141](https://github.com/nodejs/node/pull/12141): _buffer: zero fill + Buffer(num) by default_. The buffer constructor behaviour was documented, + but found to be prone to [mis-use](https://snyk.io/blog/exploiting-buffer/). + It has since been changed, but despite much debate, was not considered misuse + prone enough to justify fixing in older release lines and breaking our + API stability contract. + +### Private disclosure preferred + +- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/): + _Fix invalid wildcard certificate validation check_. This is a high severity + defect that would allow a malicious TLS server to serve an invalid wildcard + certificate for its hostname and be improperly validated by a Node.js client. + +- [#5507](https://github.com/nodejs/node/pull/5507): _Fix a defect that makes + the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities + in the TLS/SSL protocols also effect Node.js. + +- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/): + _Fix defects in HTTP header parsing for requests and responses that can allow + response splitting_. While the impact of this vulnerability is application and + network dependent, it is remotely exploitable in the HTTP protocol. + +When in doubt, please do send us a report. + + ## Current Project Team Members The Node.js project team comprises a group of core collaborators and a sub-group -that forms the _Core Technical Committee_ (CTC) which governs the project. For -more information about the governance of the Node.js project, see +that forms the _Technical Steering Committee_ (TSC) which governs the project. +For more information about the governance of the Node.js project, see [GOVERNANCE.md](./GOVERNANCE.md). -### CTC (Core Technical Committee) +### TSC (Technical Steering Committee) * [addaleax](https://github.com/addaleax) - **Anna Henningsen** <anna@addaleax.net> (she/her) @@ -198,14 +244,14 @@ **Fedor Indutny** <fedor.indutny@gmail.com> * [jasnell](https://github.com/jasnell) - **James M Snell** <jasnell@gmail.com> (he/him) +* [joshgav](https://github.com/joshgav) - +**Josh Gavant** <josh.gavant@outlook.com> * [joyeecheung](https://github.com/joyeecheung) - **Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [mcollina](https://github.com/mcollina) - **Matteo Collina** <matteo.collina@gmail.com> (he/him) * [mhdawson](https://github.com/mhdawson) - **Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) -* [misterdjules](https://github.com/misterdjules) - -**Julien Gilli** <jgilli@nodejs.org> * [mscdex](https://github.com/mscdex) - **Brian White** <mscdex@mscdex.net> * [MylesBorins](https://github.com/MylesBorins) - @@ -225,7 +271,7 @@ * [Trott](https://github.com/Trott) - **Rich Trott** <rtrott@gmail.com> (he/him) -### CTC Emeriti +### TSC Emeriti * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <christopher.s.dickinson@gmail.com> @@ -235,11 +281,15 @@ **Alexis Campailla** <orangemocha@nodejs.org> * [piscisaureus](https://github.com/piscisaureus) - **Bert Belder** <bertbelder@gmail.com> +* [nebrius](https://github.com/nebrius) - +**Bryan Hughes** <bryan@nebri.us> ### Collaborators * [abouthiroppy](https://github.com/abouthiroppy) - **Yuta Hiroto** <hello@about-hiroppy.com> (he/him) +* [addaleax](https://github.com/addaleax) - +**Anna Henningsen** <anna@addaleax.net> (she/her) * [ak239](https://github.com/ak239) - **Aleksei Koziatinskii** <ak239spb@gmail.com> * [andrasq](https://github.com/andrasq) - @@ -256,12 +306,22 @@ **Benjamin Gruenbaum** <benjamingr@gmail.com> * [bmeck](https://github.com/bmeck) - **Bradley Farias** <bradley.meck@gmail.com> +* [bnoordhuis](https://github.com/bnoordhuis) - +**Ben Noordhuis** <info@bnoordhuis.nl> * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <brendan.ashworth@me.com> +* [BridgeAR](https://github.com/BridgeAR) - +**Ruben Bridgewater** <ruben@bridgewater.de> * [bzoz](https://github.com/bzoz) - **Bartosz Sosnowski** <bartosz@janeasystems.com> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** <calvin.metcalf@gmail.com> +* [ChALkeR](https://github.com/ChALkeR) - +**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) +* [chrisdickinson](https://github.com/chrisdickinson) - +**Chris Dickinson** <christopher.s.dickinson@gmail.com> +* [cjihrig](https://github.com/cjihrig) - +**Colin Ihrig** <cjihrig@gmail.com> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** <cjrodr@yahoo.com> * [danbev](https://github.com/danbev) - @@ -276,22 +336,38 @@ **Alexander Makarenko** <estliberitas@gmail.com> * [eugeneo](https://github.com/eugeneo) - **Eugene Ostroukhov** <eostroukhov@google.com> +* [evanlucas](https://github.com/evanlucas) - +**Evan Lucas** <evanlucas@me.com> (he/him) +* [fhinkel](https://github.com/fhinkel) - +**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> * [firedfox](https://github.com/firedfox) - **Daniel Wang** <wangyang0123@gmail.com> +* [Fishrock123](https://github.com/Fishrock123) - +**Jeremiah Senkpiel** <fishrock123@rocketmail.com> +* [gabrielschulhof](https://github.com/gabrielschulhof) - +**Gabriel Schulhof** <gabriel.schulhof@intel.com> * [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com> * [gibfahn](https://github.com/gibfahn) - **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) +* [gireeshpunathil](https://github.com/gireeshpunathil) - +**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org> * [imran-iq](https://github.com/imran-iq) - **Imran Iqbal** <imran@imraniqbal.org> * [imyller](https://github.com/imyller) - **Ilkka Myller** <ilkka.myller@nodefield.com> +* [indutny](https://github.com/indutny) - +**Fedor Indutny** <fedor.indutny@gmail.com> +* [isaacs](https://github.com/isaacs) - +**Isaac Z. Schlueter** <i@izs.me> * [italoacasas](https://github.com/italoacasas) - **Italo A. Casas** <me@italoacasas.com> (he/him) * [JacksonTian](https://github.com/JacksonTian) - **Jackson Tian** <shyvo1987@gmail.com> +* [jasnell](https://github.com/jasnell) - +**James M Snell** <jasnell@gmail.com> (he/him) * [jasongin](https://github.com/jasongin) - **Jason Ginchereau** <jasongin@microsoft.com> * [jbergstroem](https://github.com/jbergstroem) - @@ -304,6 +380,8 @@ **João Reis** <reis@janeasystems.com> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <josh.gavant@outlook.com> +* [joyeecheung](https://github.com/joyeecheung) - +**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> (he/him) * [JungMinu](https://github.com/JungMinu) - @@ -322,22 +400,38 @@ **Aleksey Smolenchuk** <lxe@lxe.co> * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <mattloring@google.com> +* [mcollina](https://github.com/mcollina) - +**Matteo Collina** <matteo.collina@gmail.com> (he/him) +* [mhdawson](https://github.com/mhdawson) - +**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) * [micnic](https://github.com/micnic) - **Nicu Micleușanu** <micnic90@gmail.com> (he/him) * [mikeal](https://github.com/mikeal) - **Mikeal Rogers** <mikeal.rogers@gmail.com> +* [misterdjules](https://github.com/misterdjules) - +**Julien Gilli** <jgilli@nodejs.org> * [monsanto](https://github.com/monsanto) - **Christopher Monsanto** <chris@monsan.to> +* [mscdex](https://github.com/mscdex) - +**Brian White** <mscdex@mscdex.net> +* [MylesBorins](https://github.com/MylesBorins) - +**Myles Borins** <myles.borins@gmail.com> (he/him) * [not-an-aardvark](https://github.com/not-an-aardvark) - **Teddy Katz** <teddy.katz@gmail.com> +* [ofrobots](https://github.com/ofrobots) - +**Ali Ijaz Sheikh** <ofrobots@google.com> * [Olegas](https://github.com/Olegas) - **Oleg Elifantiev** <oleg@elifantiev.ru> +* [orangemocha](https://github.com/orangemocha) - +**Alexis Campailla** <orangemocha@nodejs.org> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <petka_antonov@hotmail.com> * [phillipj](https://github.com/phillipj) - **Phillip Johnsen** <johphi@gmail.com> +* [piscisaureus](https://github.com/piscisaureus) - +**Bert Belder** <bertbelder@gmail.com> * [pmq20](https://github.com/pmq20) - **Minqi Pan** <pmq2001@gmail.com> * [princejwesley](https://github.com/princejwesley) - @@ -360,6 +454,8 @@ **Ron Korving** <ron@ronkorving.nl> * [RReverser](https://github.com/RReverser) - **Ingvar Stepanyan** <me@rreverser.com> +* [rvagg](https://github.com/rvagg) - +**Rod Vagg** <rod@vagg.org> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <saghul@gmail.com> * [sam-github](https://github.com/sam-github) - @@ -368,14 +464,20 @@ **Santiago Gimeno** <santiago.gimeno@gmail.com> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** <vvnicholas@gmail.com> +* [shigeki](https://github.com/shigeki) - +**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <me@silverwind.io> * [srl295](https://github.com/srl295) - **Steven R Loomis** <srloomis@us.ibm.com> * [stefanmb](https://github.com/stefanmb) - **Stefan Budeanu** <stefan@budeanu.com> +* [targos](https://github.com/targos) - +**Michaël Zasso** <targos@protonmail.com> (he/him) * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <christian@tellnes.no> +* [thefourtheye](https://github.com/thefourtheye) - +**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) * [thekemkid](https://github.com/thekemkid) - **Glen Keane** <glenkeane.94@gmail.com> (he/him) * [thlorenz](https://github.com/thlorenz) - @@ -384,6 +486,10 @@ **Timothy Gu** <timothygu99@gmail.com> (he/him) * [tniessen](https://github.com/tniessen) - **Tobias Nießen** <tniessen@tnie.de> +* [trevnorris](https://github.com/trevnorris) - +**Trevor Norris** <trev.norris@gmail.com> +* [Trott](https://github.com/Trott) - +**Rich Trott** <rtrott@gmail.com> (he/him) * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> * [vkurchatkin](https://github.com/vkurchatkin) - @@ -394,14 +500,15 @@ **Daijiro Wachi** <daijiro.wachi@gmail.com> (he/him) * [whitlockjc](https://github.com/whitlockjc) - **Jeremy Whitlock** <jwhitlock@apache.org> +* [XadillaX](https://github.com/XadillaX) - +**Khaidi Chu** <i@2333.moe> (he/him) * [yorkie](https://github.com/yorkie) - **Yorkie Liu** <yorkiefixer@gmail.com> * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com> -Collaborators (which includes CTC members) follow the -[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js -project. +Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in +maintaining the Node.js project. ### Release Team @@ -451,7 +558,7 @@ ### Working Groups Information on the current Node.js Working Groups can be found in the -[CTC repository](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md). +[TSC repository](https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md). [npm]: https://www.npmjs.com [Website]: https://nodejs.org/en/ diff -Nru nodejs-6.11.2~dfsg/src/cares_wrap.cc nodejs-6.11.4~dfsg/src/cares_wrap.cc --- nodejs-6.11.2~dfsg/src/cares_wrap.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/cares_wrap.cc 2017-10-03 17:11:27.000000000 +0000 @@ -372,6 +372,69 @@ uv_async_t async_handle; }; +void SetupCaresChannel(Environment* env) { + struct ares_options options; + memset(&options, 0, sizeof(options)); + options.flags = ARES_FLAG_NOCHECKRESP; + options.sock_state_cb = ares_sockstate_cb; + options.sock_state_cb_data = env; + + /* We do the call to ares_init_option for caller. */ + int r = ares_init_options(env->cares_channel_ptr(), + &options, + ARES_OPT_FLAGS | ARES_OPT_SOCK_STATE_CB); + + if (r != ARES_SUCCESS) { + ares_library_cleanup(); + return env->ThrowError(ToErrorCodeString(r)); + } +} + + +/** + * This function is to check whether current servers are fallback servers + * when cares initialized. + * + * The fallback servers of cares is [ "127.0.0.1" ] with no user additional + * setting. + */ +void AresEnsureServers(Environment* env) { + /* if last query is OK or servers are set by user self, do not check */ + if (env->cares_query_last_ok() || !env->cares_is_servers_default()) { + return; + } + + ares_channel channel = env->cares_channel(); + ares_addr_node* servers = nullptr; + + ares_get_servers(channel, &servers); + + /* if no server or multi-servers, ignore */ + if (servers == nullptr) return; + if (servers->next != nullptr) { + ares_free_data(servers); + env->set_cares_is_servers_default(false); + return; + } + + /* if the only server is not 127.0.0.1, ignore */ + if (servers[0].family != AF_INET || + servers[0].addr.addr4.s_addr != htonl(INADDR_LOOPBACK)) { + ares_free_data(servers); + env->set_cares_is_servers_default(false); + return; + } + + ares_free_data(servers); + servers = nullptr; + + /* destroy channel and reset channel */ + ares_destroy(channel); + + SetupCaresChannel(env); +} + + class QueryWrap : public AsyncWrap { public: QueryWrap(Environment* env, Local req_wrap_obj) @@ -402,6 +465,13 @@ return static_cast(this); } + static void AresQuery(Environment* env, const char* name, + int dnsclass, int type, ares_callback callback, + void* arg) { + AresEnsureServers(env); + ares_query(env->cares_channel(), name, dnsclass, type, callback, arg); + } + static void CaresAsyncClose(uv_handle_t* handle) { uv_async_t* async = reinterpret_cast(handle); auto data = static_cast(async->data); @@ -453,6 +523,7 @@ async_handle, CaresAsyncCb)); + wrap->env()->set_cares_query_last_ok(status != ARES_ECONNREFUSED); async_handle->data = data; uv_async_send(async_handle); } @@ -478,6 +549,7 @@ async_handle, CaresAsyncCb)); + wrap->env()->set_cares_query_last_ok(status != ARES_ECONNREFUSED); async_handle->data = data; uv_async_send(async_handle); } @@ -522,12 +594,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_a, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_a, Callback, GetQueryArg()); return 0; } @@ -570,12 +637,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_aaaa, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_aaaa, Callback, GetQueryArg()); return 0; } @@ -618,12 +680,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_cname, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_cname, Callback, GetQueryArg()); return 0; } @@ -659,12 +716,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_mx, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_mx, Callback, GetQueryArg()); return 0; } @@ -710,12 +762,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_ns, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_ns, Callback, GetQueryArg()); return 0; } @@ -748,12 +795,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_txt, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_txt, Callback, GetQueryArg()); return 0; } @@ -805,12 +847,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_srv, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_srv, Callback, GetQueryArg()); return 0; } @@ -861,12 +898,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_ptr, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_ptr, Callback, GetQueryArg()); return 0; } @@ -904,12 +936,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_naptr, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_naptr, Callback, GetQueryArg()); return 0; } @@ -968,12 +995,7 @@ } int Send(const char* name) override { - ares_query(env()->cares_channel(), - name, - ns_c_in, - ns_t_soa, - Callback, - GetQueryArg()); + AresQuery(env(), name, ns_c_in, ns_t_soa, Callback, GetQueryArg()); return 0; } @@ -1434,6 +1456,9 @@ delete[] servers; + if (err == ARES_SUCCESS) + env->set_cares_is_servers_default(false); + args.GetReturnValue().Set(err); } @@ -1468,20 +1493,7 @@ if (r != ARES_SUCCESS) return env->ThrowError(ToErrorCodeString(r)); - struct ares_options options; - memset(&options, 0, sizeof(options)); - options.flags = ARES_FLAG_NOCHECKRESP; - options.sock_state_cb = ares_sockstate_cb; - options.sock_state_cb_data = env; - - /* We do the call to ares_init_option for caller. */ - r = ares_init_options(env->cares_channel_ptr(), - &options, - ARES_OPT_FLAGS | ARES_OPT_SOCK_STATE_CB); - if (r != ARES_SUCCESS) { - ares_library_cleanup(); - return env->ThrowError(ToErrorCodeString(r)); - } + SetupCaresChannel(env); /* Initialize the timeout timer. The timer won't be started until the */ /* first socket is opened. */ diff -Nru nodejs-6.11.2~dfsg/src/env.h nodejs-6.11.4~dfsg/src/env.h --- nodejs-6.11.2~dfsg/src/env.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/env.h 2017-10-03 17:11:27.000000000 +0000 @@ -437,6 +437,10 @@ inline uv_timer_t* cares_timer_handle(); inline ares_channel cares_channel(); inline ares_channel* cares_channel_ptr(); + inline bool cares_query_last_ok(); + inline void set_cares_query_last_ok(bool ok); + inline bool cares_is_servers_default(); + inline void set_cares_is_servers_default(bool is_default); inline node_ares_task_list* cares_task_list(); inline bool using_domains() const; @@ -555,6 +559,8 @@ const uint64_t timer_base_; uv_timer_t cares_timer_handle_; ares_channel cares_channel_; + bool cares_query_last_ok_; + bool cares_is_servers_default_; node_ares_task_list cares_task_list_; bool using_domains_; bool printed_error_; diff -Nru nodejs-6.11.2~dfsg/src/env-inl.h nodejs-6.11.4~dfsg/src/env-inl.h --- nodejs-6.11.2~dfsg/src/env-inl.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/env-inl.h 2017-10-03 17:11:27.000000000 +0000 @@ -219,6 +219,8 @@ : isolate_(context->GetIsolate()), isolate_data_(IsolateData::GetOrCreate(context->GetIsolate(), loop)), timer_base_(uv_now(loop)), + cares_query_last_ok_(true), + cares_is_servers_default_(true), using_domains_(false), printed_error_(false), trace_sync_io_(false), @@ -453,6 +455,22 @@ return &cares_channel_; } +inline bool Environment::cares_query_last_ok() { + return cares_query_last_ok_; +} + +inline void Environment::set_cares_query_last_ok(bool ok) { + cares_query_last_ok_ = ok; +} + +inline bool Environment::cares_is_servers_default() { + return cares_is_servers_default_; +} + +inline void Environment::set_cares_is_servers_default(bool is_default) { + cares_is_servers_default_ = is_default; +} + inline node_ares_task_list* Environment::cares_task_list() { return &cares_task_list_; } diff -Nru nodejs-6.11.2~dfsg/src/node_buffer.h nodejs-6.11.4~dfsg/src/node_buffer.h --- nodejs-6.11.2~dfsg/src/node_buffer.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_buffer.h 2017-10-03 17:11:27.000000000 +0000 @@ -13,7 +13,7 @@ static const unsigned int kMaxLength = sizeof(int32_t) == sizeof(intptr_t) ? 0x3fffffff : 0x7fffffff; -NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint); +typedef void (*FreeCallback)(char* data, void* hint); NODE_EXTERN bool HasInstance(v8::Local val); NODE_EXTERN bool HasInstance(v8::Local val); diff -Nru nodejs-6.11.2~dfsg/src/node.cc nodejs-6.11.4~dfsg/src/node.cc --- nodejs-6.11.2~dfsg/src/node.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node.cc 2017-10-03 17:11:27.000000000 +0000 @@ -199,6 +199,12 @@ // that is used by lib/module.js bool config_preserve_symlinks = false; +// Set in node.cc by ParseArgs when --expose-internals or --expose_internals is +// used. +// Used in node_config.cc to set a constant on process.binding('config') +// that is used by lib/internal/bootstrap_node.js +bool config_expose_internals = false; + // process-relative uptime base, initialized at start-up static double prog_start_time; static bool debugger_running; @@ -1224,7 +1230,7 @@ env->process_object()->Delete( env->context(), - FIXED_ONE_BYTE_STRING(args.GetIsolate(), "_setupPromises")).FromJust(); + FIXED_ONE_BYTE_STRING(isolate, "_setupPromises")).FromJust(); } @@ -2596,9 +2602,9 @@ void FatalException(Isolate* isolate, const TryCatch& try_catch) { HandleScope scope(isolate); - // TODO(bajtos) do not call FatalException if try_catch is verbose - // (requires V8 API to expose getter for try_catch.is_verbose_) - FatalException(isolate, try_catch.Exception(), try_catch.Message()); + if (!try_catch.IsVerbose()) { + FatalException(isolate, try_catch.Exception(), try_catch.Message()); + } } @@ -3317,6 +3323,7 @@ READONLY_PROPERTY(process, "_forceRepl", True(env->isolate())); } + // -r, --require if (preload_module_count) { CHECK(preload_modules); Local array = Array::New(env->isolate()); @@ -3339,10 +3346,12 @@ READONLY_PROPERTY(process, "noDeprecation", True(env->isolate())); } + // --no-warnings if (no_process_warnings) { READONLY_PROPERTY(process, "noProcessWarnings", True(env->isolate())); } + // --trace-warnings if (trace_warnings) { READONLY_PROPERTY(process, "traceProcessWarnings", True(env->isolate())); } @@ -3893,7 +3902,7 @@ #endif } else if (strcmp(arg, "--expose-internals") == 0 || strcmp(arg, "--expose_internals") == 0) { - // consumed in js + config_expose_internals = true; } else if (strcmp(arg, "--") == 0) { index += 1; break; @@ -4416,7 +4425,7 @@ // If icu_data_dir is empty here, it will load the 'minimal' data. if (!i18n::InitializeICUDirectory(icu_data_dir)) { FatalError(nullptr, "Could not initialize ICU " - "(check NODE_ICU_DATA or --icu-data-dir parameters)"); + "(check NODE_ICU_DATA or --icu-data-dir parameters)\n"); } #endif // The const_cast doesn't violate conceptual const-ness. V8 doesn't modify diff -Nru nodejs-6.11.2~dfsg/src/node_config.cc nodejs-6.11.4~dfsg/src/node_config.cc --- nodejs-6.11.2~dfsg/src/node_config.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_config.cc 2017-10-03 17:11:27.000000000 +0000 @@ -44,6 +44,9 @@ if (config_preserve_symlinks) READONLY_BOOLEAN_PROPERTY("preserveSymlinks"); + + if (config_expose_internals) + READONLY_BOOLEAN_PROPERTY("exposeInternals"); } // InitConfig } // namespace node diff -Nru nodejs-6.11.2~dfsg/src/node_crypto_bio.cc nodejs-6.11.4~dfsg/src/node_crypto_bio.cc --- nodejs-6.11.2~dfsg/src/node_crypto_bio.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto_bio.cc 2017-10-03 17:11:28.000000000 +0000 @@ -6,6 +6,7 @@ #include namespace node { +namespace crypto { const BIO_METHOD NodeBIO::method = { BIO_TYPE_MEM, @@ -467,4 +468,5 @@ write_head_ = nullptr; } +} // namespace crypto } // namespace node diff -Nru nodejs-6.11.2~dfsg/src/node_crypto_bio.h nodejs-6.11.4~dfsg/src/node_crypto_bio.h --- nodejs-6.11.2~dfsg/src/node_crypto_bio.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto_bio.h 2017-10-03 17:11:28.000000000 +0000 @@ -11,6 +11,7 @@ #include "v8.h" namespace node { +namespace crypto { class NodeBIO { public: @@ -135,6 +136,7 @@ Buffer* write_head_; }; +} // namespace crypto } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff -Nru nodejs-6.11.2~dfsg/src/node_crypto.cc nodejs-6.11.4~dfsg/src/node_crypto.cc --- nodejs-6.11.2~dfsg/src/node_crypto.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto.cc 2017-10-03 17:11:28.000000000 +0000 @@ -120,14 +120,13 @@ static Mutex* mutexes; -const char* const root_certs[] = { +static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; -std::string extra_root_certs_file; // NOLINT(runtime/string) +static std::string extra_root_certs_file; // NOLINT(runtime/string) -X509_STORE* root_cert_store; -std::vector root_certs_vector; +static X509_STORE* root_cert_store; // Just to generate static methods template class SSLWrap; @@ -710,6 +709,7 @@ static X509_STORE* NewRootCertStore() { + static std::vector root_certs_vector; if (root_certs_vector.empty()) { for (size_t i = 0; i < arraysize(root_certs); i++) { BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i])); diff -Nru nodejs-6.11.2~dfsg/src/node_crypto_clienthello.cc nodejs-6.11.4~dfsg/src/node_crypto_clienthello.cc --- nodejs-6.11.2~dfsg/src/node_crypto_clienthello.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto_clienthello.cc 2017-10-03 17:11:28.000000000 +0000 @@ -2,6 +2,7 @@ #include "node_crypto_clienthello-inl.h" namespace node { +namespace crypto { void ClientHelloParser::Parse(const uint8_t* data, size_t avail) { switch (state_) { @@ -223,4 +224,5 @@ return true; } +} // namespace crypto } // namespace node diff -Nru nodejs-6.11.2~dfsg/src/node_crypto_clienthello.h nodejs-6.11.4~dfsg/src/node_crypto_clienthello.h --- nodejs-6.11.2~dfsg/src/node_crypto_clienthello.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto_clienthello.h 2017-10-03 17:11:28.000000000 +0000 @@ -9,6 +9,7 @@ #include // nullptr namespace node { +namespace crypto { class ClientHelloParser { public: @@ -112,6 +113,7 @@ const uint8_t* tls_ticket_; }; +} // namespace crypto } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff -Nru nodejs-6.11.2~dfsg/src/node_crypto_clienthello-inl.h nodejs-6.11.4~dfsg/src/node_crypto_clienthello-inl.h --- nodejs-6.11.2~dfsg/src/node_crypto_clienthello-inl.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto_clienthello-inl.h 2017-10-03 17:11:28.000000000 +0000 @@ -7,6 +7,7 @@ #include "util-inl.h" namespace node { +namespace crypto { inline void ClientHelloParser::Reset() { frame_len_ = 0; @@ -53,6 +54,7 @@ return state_ == kPaused; } +} // namespace crypto } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff -Nru nodejs-6.11.2~dfsg/src/node_crypto.h nodejs-6.11.4~dfsg/src/node_crypto.h --- nodejs-6.11.2~dfsg/src/node_crypto.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_crypto.h 2017-10-03 17:11:28.000000000 +0000 @@ -63,8 +63,6 @@ extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx); -extern X509_STORE* root_cert_store; - extern void UseExtraCaCerts(const std::string& file); // Forward declaration diff -Nru nodejs-6.11.2~dfsg/src/node_file.cc nodejs-6.11.4~dfsg/src/node_file.cc --- nodejs-6.11.2~dfsg/src/node_file.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_file.cc 2017-10-03 17:11:28.000000000 +0000 @@ -571,6 +571,9 @@ CHECK(args[0]->IsString()); node::Utf8Value path(env->isolate(), args[0]); + if (strlen(*path) != path.length()) + return; // Contains a nul byte. + uv_fs_t open_req; const int fd = uv_fs_open(loop, &open_req, *path, O_RDONLY, 0, nullptr); uv_fs_req_cleanup(&open_req); diff -Nru nodejs-6.11.2~dfsg/src/node.h nodejs-6.11.4~dfsg/src/node.h --- nodejs-6.11.2~dfsg/src/node.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node.h 2017-10-03 17:11:27.000000000 +0000 @@ -282,7 +282,7 @@ v8::FunctionTemplate::New(isolate, callback, v8::Local(), s); v8::Local fn_name = v8::String::NewFromUtf8(isolate, name); t->SetClassName(fn_name); - recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), t); + recv->PrototypeTemplate()->Set(fn_name, t); } #define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD diff -Nru nodejs-6.11.2~dfsg/src/node_http_parser.cc nodejs-6.11.4~dfsg/src/node_http_parser.cc --- nodejs-6.11.2~dfsg/src/node_http_parser.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_http_parser.cc 2017-10-03 17:11:28.000000000 +0000 @@ -472,6 +472,7 @@ static void Consume(const FunctionCallbackInfo& args) { Parser* parser; ASSIGN_OR_RETURN_UNWRAP(&parser, args.Holder()); + CHECK(args[0]->IsExternal()); Local stream_obj = args[0].As(); StreamBase* stream = static_cast(stream_obj->Value()); CHECK_NE(stream, nullptr); @@ -502,6 +503,7 @@ stream->set_alloc_cb(parser->prev_alloc_cb_); stream->set_read_cb(parser->prev_read_cb_); + stream->Unconsume(); } parser->prev_alloc_cb_.clear(); diff -Nru nodejs-6.11.2~dfsg/src/node_internals.h nodejs-6.11.4~dfsg/src/node_internals.h --- nodejs-6.11.2~dfsg/src/node_internals.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_internals.h 2017-10-03 17:11:28.000000000 +0000 @@ -43,6 +43,12 @@ // that is used by lib/module.js extern bool config_preserve_symlinks; +// Set in node.cc by ParseArgs when --expose-internals or --expose_internals is +// used. +// Used in node_config.cc to set a constant on process.binding('config') +// that is used by lib/internal/bootstrap_node.js +extern bool config_expose_internals; + // Forward declaration class Environment; diff -Nru nodejs-6.11.2~dfsg/src/node_revert.h nodejs-6.11.4~dfsg/src/node_revert.h --- nodejs-6.11.2~dfsg/src/node_revert.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_revert.h 2017-10-03 17:11:28.000000000 +0000 @@ -8,7 +8,7 @@ /** * Note that it is expected for this list to vary across specific LTS and * Stable versions! Only CVE's whose fixes require *breaking* changes within - * a given LTS or Stable may be added to this list, and only with CTC + * a given LTS or Stable may be added to this list, and only with TSC * consensus. * * For *master* this list should always be empty! diff -Nru nodejs-6.11.2~dfsg/src/node_version.h nodejs-6.11.4~dfsg/src/node_version.h --- nodejs-6.11.2~dfsg/src/node_version.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_version.h 2017-10-03 17:11:28.000000000 +0000 @@ -3,7 +3,7 @@ #define NODE_MAJOR_VERSION 6 #define NODE_MINOR_VERSION 11 -#define NODE_PATCH_VERSION 2 +#define NODE_PATCH_VERSION 4 #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Boron" diff -Nru nodejs-6.11.2~dfsg/src/node_zlib.cc nodejs-6.11.4~dfsg/src/node_zlib.cc --- nodejs-6.11.2~dfsg/src/node_zlib.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/node_zlib.cc 2017-10-03 17:11:28.000000000 +0000 @@ -541,6 +541,7 @@ delete[] dictionary; ctx->dictionary_ = nullptr; } + ctx->mode_ = NONE; ctx->env()->ThrowError("Init error"); } } diff -Nru nodejs-6.11.2~dfsg/src/stream_base.h nodejs-6.11.4~dfsg/src/stream_base.h --- nodejs-6.11.2~dfsg/src/stream_base.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/stream_base.h 2017-10-03 17:11:28.000000000 +0000 @@ -234,6 +234,11 @@ consumed_ = true; } + inline void Unconsume() { + CHECK_EQ(consumed_, true); + consumed_ = false; + } + template inline Outer* Cast() { return static_cast(Cast()); } diff -Nru nodejs-6.11.2~dfsg/src/stream_wrap.cc nodejs-6.11.4~dfsg/src/stream_wrap.cc --- nodejs-6.11.2~dfsg/src/stream_wrap.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/stream_wrap.cc 2017-10-03 17:11:28.000000000 +0000 @@ -222,13 +222,18 @@ } -void StreamWrap::OnReadCommon(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf, - uv_handle_type pending) { +void StreamWrap::OnRead(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { StreamWrap* wrap = static_cast(handle->data); HandleScope scope(wrap->env()->isolate()); Context::Scope context_scope(wrap->env()->context()); + uv_handle_type type = UV_UNKNOWN_HANDLE; + + if (wrap->is_named_pipe_ipc() && + uv_pipe_pending_count(reinterpret_cast(handle)) > 0) { + type = uv_pipe_pending_type(reinterpret_cast(handle)); + } // We should not be getting this callback if someone as already called // uv_close() on the handle. @@ -242,22 +247,7 @@ } } - static_cast(wrap)->OnRead(nread, buf, pending); -} - - -void StreamWrap::OnRead(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf) { - StreamWrap* wrap = static_cast(handle->data); - uv_handle_type type = UV_UNKNOWN_HANDLE; - - if (wrap->is_named_pipe_ipc() && - uv_pipe_pending_count(reinterpret_cast(handle)) > 0) { - type = uv_pipe_pending_type(reinterpret_cast(handle)); - } - - OnReadCommon(handle, nread, buf, type); + static_cast(wrap)->OnRead(nread, buf, type); } diff -Nru nodejs-6.11.2~dfsg/src/stream_wrap.h nodejs-6.11.4~dfsg/src/stream_wrap.h --- nodejs-6.11.2~dfsg/src/stream_wrap.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/stream_wrap.h 2017-10-03 17:11:28.000000000 +0000 @@ -84,10 +84,6 @@ static void OnRead(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf); - static void OnReadCommon(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf, - uv_handle_type pending); static void AfterWrite(uv_write_t* req, int status); static void AfterShutdown(uv_shutdown_t* req, int status); diff -Nru nodejs-6.11.2~dfsg/src/tcp_wrap.cc nodejs-6.11.4~dfsg/src/tcp_wrap.cc --- nodejs-6.11.2~dfsg/src/tcp_wrap.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/tcp_wrap.cc 2017-10-03 17:11:28.000000000 +0000 @@ -55,13 +55,9 @@ // Init properties t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "reading"), Boolean::New(env->isolate(), false)); - t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "owner"), - Null(env->isolate())); - t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "onread"), - Null(env->isolate())); - t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), - "onconnection"), - Null(env->isolate())); + t->InstanceTemplate()->Set(env->owner_string(), Null(env->isolate())); + t->InstanceTemplate()->Set(env->onread_string(), Null(env->isolate())); + t->InstanceTemplate()->Set(env->onconnection_string(), Null(env->isolate())); env->SetProtoMethod(t, "close", HandleWrap::Close); diff -Nru nodejs-6.11.2~dfsg/src/tls_wrap.cc nodejs-6.11.4~dfsg/src/tls_wrap.cc --- nodejs-6.11.2~dfsg/src/tls_wrap.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/tls_wrap.cc 2017-10-03 17:11:28.000000000 +0000 @@ -117,10 +117,10 @@ void TLSWrap::InitSSL() { // Initialize SSL - enc_in_ = NodeBIO::New(); - enc_out_ = NodeBIO::New(); - NodeBIO::FromBIO(enc_in_)->AssignEnvironment(env()); - NodeBIO::FromBIO(enc_out_)->AssignEnvironment(env()); + enc_in_ = crypto::NodeBIO::New(); + enc_out_ = crypto::NodeBIO::New(); + crypto::NodeBIO::FromBIO(enc_in_)->AssignEnvironment(env()); + crypto::NodeBIO::FromBIO(enc_out_)->AssignEnvironment(env()); SSL_set_bio(ssl_, enc_in_, enc_out_); @@ -149,7 +149,7 @@ SSL_set_accept_state(ssl_); } else if (is_client()) { // Enough space for server response (hello, cert) - NodeBIO::FromBIO(enc_in_)->set_initial(kInitialClientBufferLength); + crypto::NodeBIO::FromBIO(enc_in_)->set_initial(kInitialClientBufferLength); SSL_set_connect_state(ssl_); } else { // Unexpected @@ -157,7 +157,7 @@ } // Initialize ring for queud clear data - clear_in_ = new NodeBIO(); + clear_in_ = new crypto::NodeBIO(); clear_in_->AssignEnvironment(env()); } @@ -289,7 +289,9 @@ char* data[kSimultaneousBufferCount]; size_t size[arraysize(data)]; size_t count = arraysize(data); - write_size_ = NodeBIO::FromBIO(enc_out_)->PeekMultiple(data, size, &count); + write_size_ = crypto::NodeBIO::FromBIO(enc_out_)->PeekMultiple(data, + size, + &count); CHECK(write_size_ != 0 && count != 0); Local req_wrap_obj = @@ -335,7 +337,7 @@ } // Commit - NodeBIO::FromBIO(wrap->enc_out_)->Read(nullptr, wrap->write_size_); + crypto::NodeBIO::FromBIO(wrap->enc_out_)->Read(nullptr, wrap->write_size_); // Ensure that the progress will be made and `InvokeQueued` will be called. wrap->ClearIn(); @@ -653,7 +655,7 @@ } size_t size = 0; - buf->base = NodeBIO::FromBIO(wrap->enc_in_)->PeekWritable(&size); + buf->base = crypto::NodeBIO::FromBIO(wrap->enc_in_)->PeekWritable(&size); buf->len = size; } @@ -717,7 +719,7 @@ } // Commit read data - NodeBIO* enc_in = NodeBIO::FromBIO(enc_in_); + crypto::NodeBIO* enc_in = crypto::NodeBIO::FromBIO(enc_in_); enc_in->Commit(nread); // Parse ClientHello first @@ -788,7 +790,7 @@ "EnableSessionCallbacks after destroySSL"); } wrap->enable_session_callbacks(); - NodeBIO::FromBIO(wrap->enc_in_)->set_initial(kMaxHelloLength); + crypto::NodeBIO::FromBIO(wrap->enc_in_)->set_initial(kMaxHelloLength); wrap->hello_parser_.Start(SSLWrap::OnClientHello, OnClientHelloParseEnd, wrap); diff -Nru nodejs-6.11.2~dfsg/src/tls_wrap.h nodejs-6.11.4~dfsg/src/tls_wrap.h --- nodejs-6.11.2~dfsg/src/tls_wrap.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/tls_wrap.h 2017-10-03 17:11:28.000000000 +0000 @@ -17,10 +17,10 @@ namespace node { // Forward-declarations -class NodeBIO; class WriteWrap; namespace crypto { class SecureContext; +class NodeBIO; } class TLSWrap : public AsyncWrap, @@ -151,7 +151,7 @@ StreamBase* stream_; BIO* enc_in_; BIO* enc_out_; - NodeBIO* clear_in_; + crypto::NodeBIO* clear_in_; size_t write_size_; typedef ListHead WriteItemList; WriteItemList write_item_queue_; diff -Nru nodejs-6.11.2~dfsg/src/util.h nodejs-6.11.4~dfsg/src/util.h --- nodejs-6.11.2~dfsg/src/util.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/src/util.h 2017-10-03 17:11:28.000000000 +0000 @@ -93,14 +93,6 @@ } \ } while (0) -// FIXME(bnoordhuis) cctests don't link in node::Abort() and node::Assert(). -#ifdef GTEST_DONT_DEFINE_ASSERT_EQ -#undef ABORT -#undef CHECK -#define ABORT ABORT_NO_BACKTRACE -#define CHECK assert -#endif - #ifdef NDEBUG #define ASSERT(expr) #else diff -Nru nodejs-6.11.2~dfsg/test/abort/test-abort-backtrace.js nodejs-6.11.4~dfsg/test/abort/test-abort-backtrace.js --- nodejs-6.11.2~dfsg/test/abort/test-abort-backtrace.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/abort/test-abort-backtrace.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Backtraces unimplemented on Windows.'); + const assert = require('assert'); const cp = require('child_process'); -if (common.isWindows) { - common.skip('Backtraces unimplemented on Windows.'); - return; -} - if (process.argv[2] === 'child') { process.abort(); } else { diff -Nru nodejs-6.11.2~dfsg/test/abort/test-http-parser-consume.js nodejs-6.11.4~dfsg/test/abort/test-http-parser-consume.js --- nodejs-6.11.2~dfsg/test/abort/test-http-parser-consume.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/abort/test-http-parser-consume.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); +const spawn = require('child_process').spawn; + +if (process.argv[2] === 'child') { + const server = http.createServer(common.mustCall((req, res) => { + res.end('hello'); + })); + + server.listen(0, common.mustCall((s) => { + const rr = http.get( + { port: server.address().port }, + common.mustCall((d) => { + // This bad input (0) should abort the parser and the process + rr.parser.consume(0); + server.close(); + })); + })); +} else { + const child = spawn(process.execPath, [__filename, 'child'], + { stdio: 'inherit' }); + child.on('exit', common.mustCall((code, signal) => { + assert(common.nodeProcessAborted(code, signal), + 'process should have aborted, but did not'); + })); +} diff -Nru nodejs-6.11.2~dfsg/test/addons/async-hello-world/binding.cc nodejs-6.11.4~dfsg/test/addons/async-hello-world/binding.cc --- nodejs-6.11.2~dfsg/test/addons/async-hello-world/binding.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/async-hello-world/binding.cc 2017-10-03 17:11:28.000000000 +0000 @@ -28,6 +28,7 @@ req->output = req->input * 2; } +template void AfterAsync(uv_work_t* r) { async_req* req = reinterpret_cast(r->data); v8::Isolate* isolate = req->isolate; @@ -40,9 +41,18 @@ v8::TryCatch try_catch(isolate); + v8::Local global = isolate->GetCurrentContext()->Global(); v8::Local callback = v8::Local::New(isolate, req->callback); - callback->Call(isolate->GetCurrentContext()->Global(), 2, argv); + + if (use_makecallback) { + v8::Local ret = + node::MakeCallback(isolate, global, callback, 2, argv); + // This should be changed to an empty handle. + assert(!ret.IsEmpty()); + } else { + callback->Call(global, 2, argv); + } // cleanup req->callback.Reset(); @@ -53,9 +63,9 @@ } } +template void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope scope(isolate); async_req* req = new async_req; req->req.data = req; @@ -70,11 +80,12 @@ uv_queue_work(uv_default_loop(), &req->req, DoAsync, - (uv_after_work_cb)AfterAsync); + (uv_after_work_cb)AfterAsync); } void init(v8::Local exports, v8::Local module) { - NODE_SET_METHOD(module, "exports", Method); + NODE_SET_METHOD(exports, "runCall", Method); + NODE_SET_METHOD(exports, "runMakeCallback", Method); } NODE_MODULE(binding, init) diff -Nru nodejs-6.11.2~dfsg/test/addons/async-hello-world/test.js nodejs-6.11.4~dfsg/test/addons/async-hello-world/test.js --- nodejs-6.11.2~dfsg/test/addons/async-hello-world/test.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/async-hello-world/test.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,10 +1,10 @@ 'use strict'; const common = require('../../common'); const assert = require('assert'); -const binding = require(`./build/${common.buildType}/binding`); +const { runCall } = require(`./build/${common.buildType}/binding`); -binding(5, common.mustCall(function(err, val) { +runCall(5, common.mustCall(function(err, val) { assert.strictEqual(err, null); assert.strictEqual(val, 10); - process.nextTick(common.mustCall(function() {})); + process.nextTick(common.mustCall()); })); diff -Nru nodejs-6.11.2~dfsg/test/addons/async-hello-world/test-makecallback.js nodejs-6.11.4~dfsg/test/addons/async-hello-world/test-makecallback.js --- nodejs-6.11.2~dfsg/test/addons/async-hello-world/test-makecallback.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/async-hello-world/test-makecallback.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,10 @@ +'use strict'; +const common = require('../../common'); +const assert = require('assert'); +const { runMakeCallback } = require(`./build/${common.buildType}/binding`); + +runMakeCallback(5, common.mustCall(function(err, val) { + assert.strictEqual(err, null); + assert.strictEqual(val, 10); + process.nextTick(common.mustCall()); +})); diff -Nru nodejs-6.11.2~dfsg/test/addons/async-hello-world/test-makecallback-uncaught.js nodejs-6.11.4~dfsg/test/addons/async-hello-world/test-makecallback-uncaught.js --- nodejs-6.11.2~dfsg/test/addons/async-hello-world/test-makecallback-uncaught.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/async-hello-world/test-makecallback-uncaught.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,9 @@ +'use strict'; +const common = require('../../common'); +const { runMakeCallback } = require(`./build/${common.buildType}/binding`); + +process.on('uncaughtException', common.mustCall()); + +runMakeCallback(5, common.mustCall(() => { + throw new Error('foo'); +})); diff -Nru nodejs-6.11.2~dfsg/test/addons/at-exit/binding.cc nodejs-6.11.4~dfsg/test/addons/at-exit/binding.cc --- nodejs-6.11.2~dfsg/test/addons/at-exit/binding.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/at-exit/binding.cc 2017-10-03 17:11:28.000000000 +0000 @@ -1,4 +1,3 @@ -#undef NDEBUG #include #include #include diff -Nru nodejs-6.11.2~dfsg/test/addons/hello-world/binding.cc nodejs-6.11.4~dfsg/test/addons/hello-world/binding.cc --- nodejs-6.11.2~dfsg/test/addons/hello-world/binding.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/hello-world/binding.cc 2017-10-03 17:11:28.000000000 +0000 @@ -3,7 +3,6 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope scope(isolate); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); } diff -Nru nodejs-6.11.2~dfsg/test/addons/hello-world-function-export/binding.cc nodejs-6.11.4~dfsg/test/addons/hello-world-function-export/binding.cc --- nodejs-6.11.2~dfsg/test/addons/hello-world-function-export/binding.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/hello-world-function-export/binding.cc 2017-10-03 17:11:28.000000000 +0000 @@ -3,7 +3,6 @@ void Method(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope scope(isolate); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); } diff -Nru nodejs-6.11.2~dfsg/test/addons/load-long-path/test.js nodejs-6.11.4~dfsg/test/addons/load-long-path/test.js --- nodejs-6.11.2~dfsg/test/addons/load-long-path/test.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/load-long-path/test.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); +if (common.isWOW64) + common.skip('doesn\'t work on WOW64'); + const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (common.isWOW64) { - common.skip('doesn\'t work on WOW64'); - return; -} - common.refreshTmpDir(); // make a path that is more than 260 chars long. diff -Nru nodejs-6.11.2~dfsg/test/addons/not-a-binding/binding.gyp nodejs-6.11.4~dfsg/test/addons/not-a-binding/binding.gyp --- nodejs-6.11.2~dfsg/test/addons/not-a-binding/binding.gyp 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/not-a-binding/binding.gyp 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,8 @@ +{ + 'targets': [ + { + 'target_name': 'binding', + 'sources': [ 'not_a_binding.c' ] + } + ] +} diff -Nru nodejs-6.11.2~dfsg/test/addons/not-a-binding/not_a_binding.c nodejs-6.11.4~dfsg/test/addons/not-a-binding/not_a_binding.c --- nodejs-6.11.2~dfsg/test/addons/not-a-binding/not_a_binding.c 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/not-a-binding/not_a_binding.c 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,3 @@ +int foo(void) { + return 0; +} diff -Nru nodejs-6.11.2~dfsg/test/addons/not-a-binding/test.js nodejs-6.11.4~dfsg/test/addons/not-a-binding/test.js --- nodejs-6.11.2~dfsg/test/addons/not-a-binding/test.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/not-a-binding/test.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,6 @@ +'use strict'; +const common = require('../../common'); +const assert = require('assert'); + +const re = /^Error: Module did not self-register\.$/; +assert.throws(() => require(`./build/${common.buildType}/binding`), re); diff -Nru nodejs-6.11.2~dfsg/test/addons/repl-domain-abort/binding.cc nodejs-6.11.4~dfsg/test/addons/repl-domain-abort/binding.cc --- nodejs-6.11.2~dfsg/test/addons/repl-domain-abort/binding.cc 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/repl-domain-abort/binding.cc 2017-10-03 17:11:28.000000000 +0000 @@ -4,14 +4,12 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::Local; -using v8::HandleScope; using v8::Isolate; using v8::Object; using v8::Value; void Method(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); - HandleScope scope(isolate); node::MakeCallback(isolate, isolate->GetCurrentContext()->Global(), args[0].As(), diff -Nru nodejs-6.11.2~dfsg/test/addons/repl-domain-abort/test.js nodejs-6.11.4~dfsg/test/addons/repl-domain-abort/test.js --- nodejs-6.11.2~dfsg/test/addons/repl-domain-abort/test.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/repl-domain-abort/test.js 2017-10-03 17:11:28.000000000 +0000 @@ -33,7 +33,7 @@ }; dOutput._write = function _write(chunk, encoding, cb) { - if (chunk.toString().indexOf('cb_ran') === 0) + if (chunk.toString().startsWith('cb_ran')) cb_ran = true; cb(); }; diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,6 +1,10 @@ 'use strict'; const common = require('../../common'); +const skipMessage = 'intensive toString tests due to memory confinements'; +if (!common.enoughTestMem) + common.skip(skipMessage); + const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); @@ -8,12 +12,6 @@ // v8::String::kMaxLength defined in v8.h const kStringMaxLength = process.binding('buffer').kStringMaxLength; -const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { - common.skip(skipMessage); - return; -} - let buf; try { buf = Buffer.allocUnsafe(kStringMaxLength); @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} const maxString = buf.toString('latin1'); assert.strictEqual(maxString.length, kStringMaxLength); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('ascii'); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('base64'); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('latin1'); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('hex'); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString(); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} const maxString = buf.toString('utf16le'); assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2); diff -Nru nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js --- nodejs-6.11.2~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('utf16le'); diff -Nru nodejs-6.11.2~dfsg/test/addons/symlinked-module/test.js nodejs-6.11.4~dfsg/test/addons/symlinked-module/test.js --- nodejs-6.11.2~dfsg/test/addons/symlinked-module/test.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/addons/symlinked-module/test.js 2017-10-03 17:11:28.000000000 +0000 @@ -22,7 +22,6 @@ } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('module identity test (no privs for symlinks)'); - return; } const sub = require('./submodule'); diff -Nru nodejs-6.11.2~dfsg/test/cctest/node_test_fixture.h nodejs-6.11.4~dfsg/test/cctest/node_test_fixture.h --- nodejs-6.11.2~dfsg/test/cctest/node_test_fixture.h 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/cctest/node_test_fixture.h 2017-10-03 17:11:28.000000000 +0000 @@ -8,13 +8,6 @@ #include "v8.h" #include "libplatform/libplatform.h" -using node::Environment; -using node::IsolateData; -using node::CreateIsolateData; -using node::CreateEnvironment; -using node::AtExit; -using node::RunAtExit; - class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t length) { diff -Nru nodejs-6.11.2~dfsg/test/common/countdown.js nodejs-6.11.4~dfsg/test/common/countdown.js --- nodejs-6.11.2~dfsg/test/common/countdown.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/common/countdown.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,27 @@ +/* eslint-disable required-modules */ +'use strict'; + +const assert = require('assert'); +const kLimit = Symbol('limit'); +const kCallback = Symbol('callback'); + +class Countdown { + constructor(limit, cb) { + assert.strictEqual(typeof limit, 'number'); + assert.strictEqual(typeof cb, 'function'); + this[kLimit] = limit; + this[kCallback] = cb; + } + + dec() { + assert(this[kLimit] > 0, 'Countdown expired'); + if (--this[kLimit] === 0) + this[kCallback](); + } + + get remaining() { + return this[kLimit]; + } +} + +module.exports = Countdown; diff -Nru nodejs-6.11.2~dfsg/test/common/index.js nodejs-6.11.4~dfsg/test/common/index.js --- nodejs-6.11.2~dfsg/test/common/index.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/common/index.js 2017-10-03 17:11:28.000000000 +0000 @@ -4,7 +4,7 @@ const fs = require('fs'); const assert = require('assert'); const os = require('os'); -const child_process = require('child_process'); +const { exec, execSync, spawn, spawnSync } = require('child_process'); const stream = require('stream'); const util = require('util'); const Timer = process.binding('timer_wrap').Timer; @@ -12,6 +12,8 @@ const testRoot = process.env.NODE_TEST_DIR ? fs.realpathSync(process.env.NODE_TEST_DIR) : path.resolve(__dirname, '..'); +const noop = () => {}; + exports.fixturesDir = path.join(__dirname, '..', 'fixtures'); exports.tmpDirName = 'tmp'; // PORT should match the definition in test/testpy/__init__.py. @@ -119,7 +121,7 @@ if (inFreeBSDJail !== null) return inFreeBSDJail; if (exports.isFreeBSD && - child_process.execSync('sysctl -n security.jail.jailed').toString() === + execSync('sysctl -n security.jail.jailed').toString() === '1\n') { inFreeBSDJail = true; } else { @@ -166,7 +168,7 @@ if (exports.isWindows) opensslCli += '.exe'; - const opensslCmd = child_process.spawnSync(opensslCli, ['version']); + const opensslCmd = spawnSync(opensslCli, ['version']); if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { // openssl command cannot be executed opensslCli = false; @@ -217,7 +219,7 @@ } testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `; testCmd += `"${process.argv[1]}" child`; - const child = child_process.exec(testCmd); + const child = exec(testCmd); child.on('exit', function onExit(exitCode, signal) { const errMsg = 'Test should have aborted ' + `but instead exited with exit code ${exitCode}` + @@ -237,8 +239,6 @@ exports.spawnCat = function(options) { - const spawn = require('child_process').spawn; - if (exports.isWindows) { return spawn('more', [], options); } else { @@ -248,8 +248,6 @@ exports.spawnSyncCat = function(options) { - const spawnSync = require('child_process').spawnSync; - if (exports.isWindows) { return spawnSync('more', [], options); } else { @@ -259,8 +257,6 @@ exports.spawnPwd = function(options) { - const spawn = require('child_process').spawn; - if (exports.isWindows) { return spawn('cmd.exe', ['/c', 'cd'], options); } else { @@ -270,8 +266,6 @@ exports.spawnSyncPwd = function(options) { - const spawnSync = require('child_process').spawnSync; - if (exports.isWindows) { return spawnSync('cmd.exe', ['/c', 'cd'], options); } else { @@ -403,13 +397,19 @@ if (exitCode !== 0) return; const failed = mustCallChecks.filter(function(context) { - return context.actual !== context.expected; + if ('minimum' in context) { + context.messageSegment = `at least ${context.minimum}`; + return context.actual < context.minimum; + } else { + context.messageSegment = `exactly ${context.exact}`; + return context.actual !== context.exact; + } }); failed.forEach(function(context) { - console.log('Mismatched %s function calls. Expected %d, actual %d.', + console.log('Mismatched %s function calls. Expected %s, actual %d.', context.name, - context.expected, + context.messageSegment, context.actual); console.log(context.stack.split('\n').slice(2).join('\n')); }); @@ -417,15 +417,29 @@ if (failed.length) process.exit(1); } +exports.mustCall = function(fn, exact) { + return _mustCallInner(fn, exact, 'exact'); +}; + +exports.mustCallAtLeast = function(fn, minimum) { + return _mustCallInner(fn, minimum, 'minimum'); +}; + +function _mustCallInner(fn, criteria, field) { + if (typeof fn === 'number') { + criteria = fn; + fn = noop; + } else if (fn === undefined) { + fn = noop; + } -exports.mustCall = function(fn, expected) { - if (expected === undefined) - expected = 1; - else if (typeof expected !== 'number') - throw new TypeError(`Invalid expected value: ${expected}`); + if (criteria === undefined) + criteria = 1; + else if (typeof criteria !== 'number') + throw new TypeError(`Invalid ${field} value: ${criteria}`); const context = { - expected: expected, + [field]: criteria, actual: 0, stack: (new Error()).stack, name: fn.name || '' @@ -440,7 +454,7 @@ context.actual++; return fn.apply(this, arguments); }; -}; +} exports.hasMultiLocalhost = function hasMultiLocalhost() { const TCP = process.binding('tcp_wrap').TCP; @@ -470,10 +484,15 @@ }; }; -exports.skip = function(msg) { +exports.printSkipMessage = function(msg) { console.log(`1..0 # Skipped: ${msg}`); }; +exports.skip = function(msg) { + exports.printSkipMessage(msg); + process.exit(0); +}; + // A stream to push an array into a REPL function ArrayStream() { this.run = function(data) { @@ -487,9 +506,9 @@ exports.ArrayStream = ArrayStream; ArrayStream.prototype.readable = true; ArrayStream.prototype.writable = true; -ArrayStream.prototype.pause = function() {}; -ArrayStream.prototype.resume = function() {}; -ArrayStream.prototype.write = function() {}; +ArrayStream.prototype.pause = noop; +ArrayStream.prototype.resume = noop; +ArrayStream.prototype.write = noop; // Returns true if the exit code "exitCode" and/or signal name "signal" // represent the exit code and/or signal name of a node process that aborted, diff -Nru nodejs-6.11.2~dfsg/test/common/README.md nodejs-6.11.4~dfsg/test/common/README.md --- nodejs-6.11.2~dfsg/test/common/README.md 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/common/README.md 2017-10-03 17:11:28.000000000 +0000 @@ -182,36 +182,40 @@ Array of IPV6 hosts. -### mustCall([fn][, expected]) -* fn [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) -* expected [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 +### mustCall([fn][, exact]) +* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {} +* `exact` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 * return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Returns a function that calls `fn`. If the returned function has not been called exactly `expected` number of times when the test is complete, then the test will fail. -If `fn` is not provided, `common.noop` will be used. +If `fn` is not provided, an empty function will be used. -### nodeProcessAborted(exitCode, signal) -* `exitCode` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) -* `signal` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) -* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) +### mustCallAtLeast([fn][, minimum]) +* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {} +* `minimum` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 +* return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) -Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. +Returns a function that calls `fn`. If the returned function has not been called +at least `minimum` number of times when the test is complete, then the test will +fail. -### noop +If `fn` is not provided, an empty function will be used. -A non-op `Function` that can be used for a variety of scenarios. +### mustNotCall([msg]) +* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) default = 'function should not have been called' +* return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) -For instance, +Returns a function that triggers an `AssertionError` if it is invoked. `msg` is used as the error message for the `AssertionError`. - -```js -const common = require('../common'); +### nodeProcessAborted(exitCode, signal) +* `exitCode` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `signal` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) -someAsyncAPI('foo', common.mustCall(common.noop)); -``` +Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. ### opensslCli * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) @@ -234,6 +238,11 @@ Port tests are running on. +### printSkipMessage(msg) +* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Logs '1..0 # Skipped: ' + `msg` + ### refreshTmpDir * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) @@ -247,7 +256,7 @@ ### skip(msg) * `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) -Logs '1..0 # Skipped: ' + `msg` +Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`. ### spawnPwd(options) * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) @@ -271,6 +280,42 @@ Name of the temp directory used by tests. +## Countdown Module + +The `Countdown` module provides a simple countdown mechanism for tests that +require a particular action to be taken after a given number of completed +tasks (for instance, shutting down an HTTP server after a specific number of +requests). + + +```js +const Countdown = require('../common/countdown'); + +function doSomething() { + console.log('.'); +} + +const countdown = new Countdown(2, doSomething); +countdown.dec(); +countdown.dec(); +``` + +### new Countdown(limit, callback) + +* `limit` {number} +* `callback` {function} + +Creates a new `Countdown` instance. + +### Countdown.prototype.dec() + +Decrements the `Countdown` counter. + +### Coutndown.prototype.remaining + +Specifies the remaining number of times `Countdown.prototype.dec()` must be +called before the callback is invoked. + ## WPT Module The wpt.js module is a port of parts of diff -Nru nodejs-6.11.2~dfsg/test/debugger/test-debugger-client.js nodejs-6.11.4~dfsg/test/debugger/test-debugger-client.js --- nodejs-6.11.2~dfsg/test/debugger/test-debugger-client.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/debugger/test-debugger-client.js 2017-10-03 17:11:28.000000000 +0000 @@ -129,7 +129,7 @@ let connectCount = 0; const script = 'setTimeout(function() { console.log("blah"); });' + - 'setInterval(function() {}, 1000000);'; + 'setInterval(() => {}, 1000000);'; let nodeProcess; @@ -172,7 +172,7 @@ console.error('>>> connecting...'); c.connect(debug.port); c.on('break', function() { - c.reqContinue(function() {}); + c.reqContinue(() => {}); }); c.on('ready', function() { connectCount++; @@ -181,8 +181,8 @@ c.end(); c.on('end', function() { console.error( - '>>> killing node process %d\n\n', - nodeProcess.pid); + '>>> killing node process %d\n\n', + nodeProcess.pid); nodeProcess.kill(); done(); }); diff -Nru nodejs-6.11.2~dfsg/test/disabled/test-sendfd.js nodejs-6.11.4~dfsg/test/disabled/test-sendfd.js --- nodejs-6.11.2~dfsg/test/disabled/test-sendfd.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/disabled/test-sendfd.js 2017-10-03 17:11:28.000000000 +0000 @@ -29,12 +29,13 @@ var common = require('../common'); var assert = require('assert'); -var buffer = require('buffer'); -var child_process = require('child_process'); -var fs = require('fs'); -var net = require('net'); -var netBinding = process.binding('net'); -var path = require('path'); +const buffer = require('buffer'); +const child_process = require('child_process'); +const fs = require('fs'); +const net = require('net'); + +const netBinding = process.binding('net'); +const path = require('path'); var DATA = { 'ppid' : process.pid, @@ -73,7 +74,7 @@ var rd = JSON.parse(d); assert.strictEqual(rd.pid, cpp); - assert.strictEqual(seenOrdinals.indexOf(rd.ord), -1); + assert.strictEqual(seenOrdinals.includes(rd.ord), false) seenOrdinals.unshift(rd.ord); }); @@ -91,7 +92,7 @@ var str = JSON.stringify(DATA) + '\n'; DATA.ord = DATA.ord + 1; - var buf = buffer.Buffer.allocUnsafe(str.length); + var buf = Buffer.allocUnsafe(str.length); buf.write(JSON.stringify(DATA) + '\n', 'utf8'); s.write(str, 'utf8', pipeFDs[1]); diff -Nru nodejs-6.11.2~dfsg/test/doctool/test-doctool-html.js nodejs-6.11.4~dfsg/test/doctool/test-doctool-html.js --- nodejs-6.11.2~dfsg/test/doctool/test-doctool-html.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/doctool/test-doctool-html.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - // The doctool currently uses js-yaml from the tool/eslint/ tree. try { require('../../tools/eslint/node_modules/js-yaml'); } catch (e) { - return common.skip('missing js-yaml (eslint not present)'); + common.skip('missing js-yaml (eslint not present)'); } +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const processIncludes = require('../../tools/doc/preprocess.js'); const html = require('../../tools/doc/html.js'); @@ -106,15 +105,15 @@ const actual = output.replace(spaces, ''); // Assert that the input stripped of all whitespace contains the // expected list - assert.notStrictEqual(actual.indexOf(expected), -1); + assert(actual.includes(expected)); // Testing the insertion of Google Analytics script when // an analytics id is provided. Should not be present by default if (includeAnalytics) { - assert.notStrictEqual(actual.indexOf('google-analytics.com'), -1, - 'Google Analytics script was not present'); + assert(actual.includes('google-analytics.com'), + 'Google Analytics script was not present'); } else { - assert.strictEqual(actual.indexOf('google-analytics.com'), -1, + assert.strictEqual(actual.includes('google-analytics.com'), false, 'Google Analytics script was present'); } })); diff -Nru nodejs-6.11.2~dfsg/test/doctool/test-doctool-json.js nodejs-6.11.4~dfsg/test/doctool/test-doctool-json.js --- nodejs-6.11.2~dfsg/test/doctool/test-doctool-json.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/doctool/test-doctool-json.js 2017-10-03 17:11:28.000000000 +0000 @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - // The doctool currently uses js-yaml from the tool/eslint/ tree. try { require('../../tools/eslint/node_modules/js-yaml'); } catch (e) { - return common.skip('missing js-yaml (eslint not present)'); + common.skip('missing js-yaml (eslint not present)'); } +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const json = require('../../tools/doc/json.js'); // Outputs valid json with the expected fields when given simple markdown diff -Nru nodejs-6.11.2~dfsg/test/fixtures/a1.js nodejs-6.11.4~dfsg/test/fixtures/a1.js --- nodejs-6.11.2~dfsg/test/fixtures/a1.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/fixtures/a1.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -var c = require('./b/c'); - -console.error('load fixtures/a.js'); - -var string = 'A'; - -exports.SomeClass = c.SomeClass; - -exports.A = function() { - return string; -}; - -exports.C = function() { - return c.C(); -}; - -exports.D = function() { - return c.D(); -}; - -exports.number = 42; - -process.on('exit', function() { - string = 'A done'; -}); diff -Nru nodejs-6.11.2~dfsg/test/fixtures/failmustcall1.js nodejs-6.11.4~dfsg/test/fixtures/failmustcall1.js --- nodejs-6.11.2~dfsg/test/fixtures/failmustcall1.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/fixtures/failmustcall1.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,3 @@ +const common = require('../common'); +const f = common.mustCall( () => {}, 2); +f(); diff -Nru nodejs-6.11.2~dfsg/test/fixtures/failmustcall2.js nodejs-6.11.4~dfsg/test/fixtures/failmustcall2.js --- nodejs-6.11.2~dfsg/test/fixtures/failmustcall2.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/fixtures/failmustcall2.js 2017-10-03 17:11:28.000000000 +0000 @@ -0,0 +1,3 @@ +const common = require('../common'); +const f = common.mustCallAtLeast(() => {}, 2); +f(); diff -Nru nodejs-6.11.2~dfsg/test/fixtures/tls-connect.js nodejs-6.11.4~dfsg/test/fixtures/tls-connect.js --- nodejs-6.11.2~dfsg/test/fixtures/tls-connect.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/fixtures/tls-connect.js 2017-10-03 17:11:28.000000000 +0000 @@ -12,10 +12,9 @@ module.exports = exports = checkCrypto; function checkCrypto() { - if (!common.hasCrypto) { + if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); - } + return exports; } diff -Nru nodejs-6.11.2~dfsg/test/inspector/inspector-helper.js nodejs-6.11.4~dfsg/test/inspector/inspector-helper.js --- nodejs-6.11.2~dfsg/test/inspector/inspector-helper.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/inspector/inspector-helper.js 2017-10-03 17:11:29.000000000 +0000 @@ -43,11 +43,12 @@ for (let i = 0; i < messageBuf.length; i++) messageBuf[i] = messageBuf[i] ^ (1 << (i % 4)); socket.write( - Buffer.concat([wsHeaderBuf.slice(0, maskOffset + 4), messageBuf]), - callback); + Buffer.concat([wsHeaderBuf.slice(0, maskOffset + 4), messageBuf]), + callback); } function parseWSFrame(buffer, handler) { + // Protocol described in https://tools.ietf.org/html/rfc6455#section-5 if (buffer.length < 2) return 0; assert.strictEqual(0x81, buffer[0]); @@ -59,13 +60,21 @@ dataLen = buffer.readUInt16BE(2); bodyOffset = 4; } else if (dataLen === 127) { - dataLen = buffer.readUInt32BE(2); + assert(buffer[2] === 0 && buffer[3] === 0, 'Inspector message too big'); + dataLen = buffer.readUIntBE(4, 6); bodyOffset = 10; } if (buffer.length < bodyOffset + dataLen) return 0; - const message = JSON.parse( - buffer.slice(bodyOffset, bodyOffset + dataLen).toString('utf8')); + const jsonPayload = + buffer.slice(bodyOffset, bodyOffset + dataLen).toString('utf8'); + let message; + try { + message = JSON.parse(jsonPayload); + } catch (e) { + console.error(`JSON.parse() failed for: ${jsonPayload}`); + throw e; + } if (DEBUG) console.log('[received]', JSON.stringify(message)); handler(message); @@ -214,7 +223,7 @@ this.sendAll_(commands, () => { timeoutId = setTimeout(() => { common.fail(`Messages without response: ${ - Object.keys(this.messages_).join(', ')}`); + Object.keys(this.messages_).join(', ')}`); }, TIMEOUT); }); }); @@ -237,7 +246,7 @@ if (!(expects instanceof Array)) expects = [ expects ]; const callback = this.createCallbackWithTimeout_( - `Matching response was not received:\n${expects[0]}`); + `Matching response was not received:\n${expects[0]}`); this.messagefilter_ = (message) => { if (expects[0](message)) expects.shift(); @@ -251,8 +260,8 @@ TestSession.prototype.expectStderrOutput = function(regexp) { this.harness_.addStderrFilter( - regexp, - this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`)); + regexp, + this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`)); return this; }; @@ -293,10 +302,10 @@ TestSession.prototype.testHttpResponse = function(path, check) { return this.enqueue((callback) => - checkHttpResponse(this.harness_.port, path, (err, response) => { - check.call(this, err, response); - callback(); - })); + checkHttpResponse(this.harness_.port, path, (err, response) => { + check.call(this, err, response); + callback(); + })); }; @@ -310,7 +319,7 @@ this.running_ = true; childProcess.stdout.on('data', makeBufferingDataCallback( - (line) => console.log('[out]', line))); + (line) => console.log('[out]', line))); childProcess.stderr.on('data', makeBufferingDataCallback((message) => { @@ -427,7 +436,7 @@ exports.startNodeForInspectorTest = function(callback) { const child = spawn(process.execPath, - [ '--inspect', '--debug-brk', mainScript ]); + [ '--inspect', '--debug-brk', mainScript ]); const timeoutId = timeout('Child process did not start properly', 4); diff -Nru nodejs-6.11.2~dfsg/test/inspector/inspector.status nodejs-6.11.4~dfsg/test/inspector/inspector.status --- nodejs-6.11.2~dfsg/test/inspector/inspector.status 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/inspector/inspector.status 2017-10-03 17:11:29.000000000 +0000 @@ -5,5 +5,6 @@ # sample-test : PASS,FLAKY [true] # This section applies to all platforms +test-inspector-port-zero-cluster : PASS,FLAKY [$system==win32] diff -Nru nodejs-6.11.2~dfsg/test/inspector/test-inspector.js nodejs-6.11.4~dfsg/test/inspector/test-inspector.js --- nodejs-6.11.2~dfsg/test/inspector/test-inspector.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/inspector/test-inspector.js 2017-10-03 17:11:29.000000000 +0000 @@ -112,17 +112,17 @@ function testSetBreakpointAndResume(session) { console.log('[test]', 'Setting a breakpoint and verifying it is hit'); const commands = [ - { 'method': 'Debugger.setBreakpointByUrl', - 'params': { 'lineNumber': 5, - 'url': session.mainScriptPath, - 'columnNumber': 0, - 'condition': '' - } - }, - { 'method': 'Debugger.resume'}, - [ { 'method': 'Debugger.getScriptSource', - 'params': { 'scriptId': session.mainScriptId } }, - expectMainScriptSource ], + { 'method': 'Debugger.setBreakpointByUrl', + 'params': { 'lineNumber': 5, + 'url': session.mainScriptPath, + 'columnNumber': 0, + 'condition': '' + } + }, + { 'method': 'Debugger.resume'}, + [ { 'method': 'Debugger.getScriptSource', + 'params': { 'scriptId': session.mainScriptId } }, + expectMainScriptSource ], ]; session .sendInspectorCommands(commands) diff -Nru nodejs-6.11.2~dfsg/test/internet/test-dgram-broadcast-multi-process.js nodejs-6.11.4~dfsg/test/internet/test-dgram-broadcast-multi-process.js --- nodejs-6.11.2~dfsg/test/internet/test-dgram-broadcast-multi-process.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-dgram-broadcast-multi-process.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.inFreeBSDJail) + common.skip('in a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const util = require('util'); const networkInterfaces = require('os').networkInterfaces(); -const Buffer = require('buffer').Buffer; const fork = require('child_process').fork; const LOCAL_BROADCAST_HOST = '255.255.255.255'; const TIMEOUT = common.platformTimeout(5000); @@ -15,11 +17,6 @@ Buffer.from('Fourth message to send') ]; -if (common.inFreeBSDJail) { - common.skip('in a FreeBSD jail'); - return; -} - let bindAddress = null; // Take the first non-internal interface as the address for binding. diff -Nru nodejs-6.11.2~dfsg/test/internet/test-dgram-multicast-multi-process.js nodejs-6.11.4~dfsg/test/internet/test-dgram-multicast-multi-process.js --- nodejs-6.11.2~dfsg/test/internet/test-dgram-multicast-multi-process.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-dgram-multicast-multi-process.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,9 @@ 'use strict'; const common = require('../common'); +// Skip test in FreeBSD jails. +if (common.inFreeBSDJail) + common.skip('In a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const fork = require('child_process').fork; @@ -15,12 +19,6 @@ const listeners = 3; let dead, listening, sendSocket, done, timer; -// Skip test in FreeBSD jails. -if (common.inFreeBSDJail) { - common.skip('In a FreeBSD jail'); - return; -} - function launchChildProcess() { const worker = fork(__filename, ['child']); workers[worker.pid] = worker; diff -Nru nodejs-6.11.2~dfsg/test/internet/test-dns-ipv6.js nodejs-6.11.4~dfsg/test/internet/test-dns-ipv6.js --- nodejs-6.11.2~dfsg/test/internet/test-dns-ipv6.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-dns-ipv6.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('this test, no IPv6 support'); + const assert = require('assert'); const dns = require('dns'); const net = require('net'); @@ -8,11 +11,6 @@ let running = false; const queue = []; -if (!common.hasIPv6) { - common.skip('this test, no IPv6 support'); - return; -} - function TEST(f) { function next() { const f = queue.shift(); diff -Nru nodejs-6.11.2~dfsg/test/internet/test-dns.js nodejs-6.11.4~dfsg/test/internet/test-dns.js --- nodejs-6.11.2~dfsg/test/internet/test-dns.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-dns.js 2017-10-03 17:11:29.000000000 +0000 @@ -360,7 +360,7 @@ if (err) throw err; assert.strictEqual(records.length, 1); assert.ok(util.isArray(records[0])); - assert.strictEqual(records[0][0].indexOf('v=spf1'), 0); + assert(records[0][0].startsWith('v=spf1')); done(); }); diff -Nru nodejs-6.11.2~dfsg/test/internet/test-http-https-default-ports.js nodejs-6.11.4~dfsg/test/internet/test-http-https-default-ports.js --- nodejs-6.11.2~dfsg/test/internet/test-http-https-default-ports.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-http-https-default-ports.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const http = require('http'); diff -Nru nodejs-6.11.2~dfsg/test/internet/test-tls-add-ca-cert.js nodejs-6.11.4~dfsg/test/internet/test-tls-add-ca-cert.js --- nodejs-6.11.2~dfsg/test/internet/test-tls-add-ca-cert.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-tls-add-ca-cert.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,19 +1,18 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} // Test interaction of compiled-in CAs with user-provided CAs. const assert = require('assert'); const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/internet/test-tls-connnect-melissadata.js nodejs-6.11.4~dfsg/test/internet/test-tls-connnect-melissadata.js --- nodejs-6.11.2~dfsg/test/internet/test-tls-connnect-melissadata.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-tls-connnect-melissadata.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,10 +3,8 @@ // certification between Starfield Class 2 and ValiCert Class 2 const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const socket = tls.connect(443, 'address.melissadata.net', function() { diff -Nru nodejs-6.11.2~dfsg/test/internet/test-tls-reuse-host-from-socket.js nodejs-6.11.4~dfsg/test/internet/test-tls-reuse-host-from-socket.js --- nodejs-6.11.2~dfsg/test/internet/test-tls-reuse-host-from-socket.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/internet/test-tls-reuse-host-from-socket.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js nodejs-6.11.4~dfsg/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js --- nodejs-6.11.2~dfsg/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/known_issues/test-dgram-bind-shared-ports-after-port-0.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,56 @@ +'use strict'; +const common = require('../common'); + +// This test should fail because at present `cluster` does not know how to share +// a socket when `worker1` binds with `port: 0`, and others try to bind to the +// assigned port number from `worker1` +// +// *Note*: since this is a `known_issue` we try to swallow all errors except +// the one we are interested in + +const assert = require('assert'); +const cluster = require('cluster'); +const dgram = require('dgram'); +const BYE = 'bye'; + +if (cluster.isMaster) { + const worker1 = cluster.fork(); + + // verify that Windows doesn't support this scenario + worker1.on('error', (err) => { + if (err.code === 'ENOTSUP') throw err; + }); + + worker1.on('message', (msg) => { + if (typeof msg !== 'object') process.exit(0); + if (msg.message !== 'success') process.exit(0); + if (typeof msg.port1 !== 'number') process.exit(0); + + const worker2 = cluster.fork({ PRT1: msg.port1 }); + worker2.on('message', () => process.exit(0)); + worker2.on('exit', (code, signal) => { + // this is the droid we are looking for + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + }); + + // cleanup anyway + process.on('exit', () => { + worker1.send(BYE); + worker2.send(BYE); + }); + }); + // end master code +} else { + // worker code + process.on('message', (msg) => msg === BYE && process.exit(0)); + + // first worker will bind to '0', second will try the assigned port and fail + const PRT1 = process.env.PRT1 || 0; + const socket1 = dgram.createSocket('udp4', () => {}); + socket1.on('error', PRT1 === 0 ? () => {} : assert.fail); + socket1.bind( + { address: common.localhostIPv4, port: PRT1, exclusive: false }, + () => process.send({ message: 'success', port1: socket1.address().port }) + ); +} diff -Nru nodejs-6.11.2~dfsg/test/known_issues/test-http-path-contains-unicode.js nodejs-6.11.4~dfsg/test/known_issues/test-http-path-contains-unicode.js --- nodejs-6.11.2~dfsg/test/known_issues/test-http-path-contains-unicode.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/known_issues/test-http-path-contains-unicode.js 2017-10-03 17:11:29.000000000 +0000 @@ -11,9 +11,9 @@ const expected = '/café🐶'; assert.strictEqual( - expected, - '/caf\u{e9}\u{1f436}', - 'Sanity check that string literal produced the expected string' + expected, + '/caf\u{e9}\u{1f436}', + 'Sanity check that string literal produced the expected string' ); const server = http.createServer(common.mustCall(function(req, res) { diff -Nru nodejs-6.11.2~dfsg/test/known_issues/test-vm-proxy-failure-CP.js nodejs-6.11.4~dfsg/test/known_issues/test-vm-proxy-failure-CP.js --- nodejs-6.11.2~dfsg/test/known_issues/test-vm-proxy-failure-CP.js 2017-08-01 05:39:14.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/known_issues/test-vm-proxy-failure-CP.js 2017-10-03 17:11:29.000000000 +0000 @@ -9,9 +9,9 @@ const vm = require('vm'); const handler = { - getOwnPropertyDescriptor: (target, prop) => { - throw new Error('whoops'); - } + getOwnPropertyDescriptor: (target, prop) => { + throw new Error('whoops'); + } }; const sandbox = new Proxy({foo: 'bar'}, handler); const context = vm.createContext(sandbox); diff -Nru nodejs-6.11.2~dfsg/test/known_issues/test-vm-strict-mode.js nodejs-6.11.4~dfsg/test/known_issues/test-vm-strict-mode.js --- nodejs-6.11.2~dfsg/test/known_issues/test-vm-strict-mode.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/known_issues/test-vm-strict-mode.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,17 @@ +'use strict'; +// https://github.com/nodejs/node/issues/12300 + +require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +const ctx = vm.createContext({ x: 42 }); + +// The following line wrongly throws an +// error because GlobalPropertySetterCallback() +// does not check if the property exists +// on the sandbox. It should just set x to 1 +// instead of throwing an error. +vm.runInContext('"use strict"; x = 1', ctx); + +assert.strictEqual(ctx.x, 1); diff -Nru nodejs-6.11.2~dfsg/test/message/throw_in_line_with_tabs.js nodejs-6.11.4~dfsg/test/message/throw_in_line_with_tabs.js --- nodejs-6.11.2~dfsg/test/message/throw_in_line_with_tabs.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/message/throw_in_line_with_tabs.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,4 +1,4 @@ -/* eslint-disable indent-legacy, no-tabs */ +/* eslint-disable indent, no-tabs */ 'use strict'; require('../common'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/parallel.status nodejs-6.11.4~dfsg/test/parallel/parallel.status --- nodejs-6.11.2~dfsg/test/parallel/parallel.status 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/parallel.status 2017-10-03 17:11:29.000000000 +0000 @@ -5,6 +5,7 @@ # sample-test : PASS,FLAKY [true] # This section applies to all platforms +test-fs-read-buffer-tostring-fail : PASS,FLAKY [$system==win32] @@ -13,7 +14,6 @@ [$system==macos] [$arch==arm || $arch==arm64] -test-fs-readdir-ucs2 : PASS,FLAKY test-npm-install: PASS,FLAKY [$system==solaris] # Also applies to SmartOS diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-assert-fail.js nodejs-6.11.4~dfsg/test/parallel/test-assert-fail.js --- nodejs-6.11.2~dfsg/test/parallel/test-assert-fail.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-assert-fail.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,10 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +// The stackFrameFunction should exclude the foo frame +assert.throws( + function foo() { assert.fail('first', 'second', 'message', '!==', foo); }, + (err) => !/foo/m.test(err.stack) +); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-assert.js nodejs-6.11.4~dfsg/test/parallel/test-assert.js --- nodejs-6.11.2~dfsg/test/parallel/test-assert.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-assert.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,7 +1,7 @@ 'use strict'; require('../common'); const assert = require('assert'); -const a = require('assert'); +const a = assert; function makeBlock(f) { const args = Array.prototype.slice.call(arguments, 1); @@ -345,11 +345,11 @@ assert.throws(makeBlock(thrower, a.AssertionError), a.AssertionError, 'message'); assert.throws(makeBlock(thrower, a.AssertionError), a.AssertionError); -// eslint-disable-next-line assert-throws-arguments +// eslint-disable-next-line no-restricted-syntax assert.throws(makeBlock(thrower, a.AssertionError)); // if not passing an error, catch all. -// eslint-disable-next-line assert-throws-arguments +// eslint-disable-next-line no-restricted-syntax assert.throws(makeBlock(thrower, TypeError)); // when passing a type, only catch errors of the appropriate type @@ -399,10 +399,10 @@ threw = false; try { assert.throws( - function() { - throw ({}); - }, - Array + function() { + throw ({}); + }, + Array ); } catch (e) { threw = true; @@ -515,6 +515,7 @@ testAssertionMessage(/abc/gim, '/abc/gim'); testAssertionMessage(function f() {}, '[Function: f]'); testAssertionMessage(function() {}, '[Function]'); +testAssertionMessage(() => {}, '[Function]'); testAssertionMessage({}, '{}'); testAssertionMessage(circular, '{ y: 1, x: [Circular] }'); testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }'); @@ -523,7 +524,7 @@ // #2893 try { - // eslint-disable-next-line assert-throws-arguments + // eslint-disable-next-line no-restricted-syntax assert.throws(function() { assert.ifError(null); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-assert-typedarray-deepequal.js nodejs-6.11.4~dfsg/test/parallel/test-assert-typedarray-deepequal.js --- nodejs-6.11.2~dfsg/test/parallel/test-assert-typedarray-deepequal.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-assert-typedarray-deepequal.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,7 +2,6 @@ require('../common'); const assert = require('assert'); -const a = require('assert'); function makeBlock(f) { const args = Array.prototype.slice.call(arguments, 1); @@ -51,7 +50,8 @@ notEqualArrayPairs.forEach((arrayPair) => { assert.throws( - makeBlock(a.deepEqual, arrayPair[0], arrayPair[1]), - a.AssertionError + // eslint-disable-next-line no-restricted-properties + makeBlock(assert.deepEqual, arrayPair[0], arrayPair[1]), + assert.AssertionError ); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-alloc.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-alloc.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-alloc.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-alloc.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,7 +3,6 @@ const assert = require('assert'); const vm = require('vm'); -const Buffer = require('buffer').Buffer; const SlowBuffer = require('buffer').SlowBuffer; const b = Buffer.allocUnsafe(1024); @@ -744,7 +743,7 @@ // Call .fill() first, stops valgrind warning about uninitialized memory reads. Buffer.allocUnsafe(3.3).fill().toString(); - // throws bad argument error in commit 43cb4ec +// throws bad argument error in commit 43cb4ec Buffer.alloc(3.3).fill().toString(); assert.strictEqual(Buffer.allocUnsafe(-1).length, 0); assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0); @@ -783,8 +782,8 @@ 'ucs-2', 'utf16le', 'utf-16le' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + assert.strictEqual(Buffer.isEncoding(enc), true); +}); [ 'utf9', 'utf-7', @@ -798,8 +797,8 @@ 1, 0, -1 ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + assert.strictEqual(Buffer.isEncoding(enc), false); +}); // GH-5110 { @@ -972,7 +971,7 @@ crypto.createHash('sha1').update(b2).digest('hex') ); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } const ps = Buffer.poolSize; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-arraybuffer.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-arraybuffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-arraybuffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-arraybuffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,7 +3,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; const LENGTH = 16; const ab = new ArrayBuffer(LENGTH); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-badhex.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-badhex.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-badhex.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-badhex.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,7 +1,6 @@ 'use strict'; require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; // Test hex strings and bad hex strings { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-bytelength.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-bytelength.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-bytelength.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-bytelength.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,7 +2,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; const SlowBuffer = require('buffer').SlowBuffer; const vm = require('vm'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-concat.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-concat.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-concat.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-concat.js 2017-10-03 17:11:29.000000000 +0000 @@ -40,8 +40,8 @@ } const random10 = common.hasCrypto - ? require('crypto').randomBytes(10) - : Buffer.alloc(10, 1); + ? require('crypto').randomBytes(10) + : Buffer.alloc(10, 1); const empty = Buffer.alloc(0); assert.notDeepStrictEqual(random10, empty); @@ -58,5 +58,5 @@ assert.deepStrictEqual(Buffer.concat([empty], 100), Buffer.alloc(100)); assert.deepStrictEqual(Buffer.concat([empty], 4096), Buffer.alloc(4096)); assert.deepStrictEqual( - Buffer.concat([random10], 40), - Buffer.concat([random10, Buffer.alloc(30)])); + Buffer.concat([random10], 40), + Buffer.concat([random10, Buffer.alloc(30)])); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-fakes.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-fakes.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-fakes.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-fakes.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,7 +2,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; function FakeBuffer() { } Object.setPrototypeOf(FakeBuffer, Buffer); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-fill.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-fill.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-fill.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-fill.js 2017-10-03 17:11:29.000000000 +0000 @@ -135,7 +135,7 @@ // Make sure this operation doesn't go on forever buf1.fill('yKJh', 'hex'); assert.throws(() => - buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); + buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); // BASE64 @@ -183,23 +183,23 @@ // Check exceptions assert.throws(() => buf1.fill(0, -1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill(0, 0, buf1.length + 1), + buf1.fill(0, 0, buf1.length + 1), /^RangeError: Out of range index$/); assert.throws(() => buf1.fill('', -1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill('', 0, buf1.length + 1), + buf1.fill('', 0, buf1.length + 1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill('a', 0, buf1.length, 'node rocks!'), + buf1.fill('a', 0, buf1.length, 'node rocks!'), /^TypeError: Unknown encoding: node rocks!$/); assert.throws(() => - buf1.fill('a', 0, 0, NaN), + buf1.fill('a', 0, 0, NaN), /^TypeError: encoding must be a string$/); assert.throws(() => - buf1.fill('a', 0, 0, null), + buf1.fill('a', 0, 0, null), /^TypeError: encoding must be a string$/); assert.throws(() => - buf1.fill('a', 0, 0, 'foo'), /^TypeError: Unknown encoding: foo$/); + buf1.fill('a', 0, 0, 'foo'), /^TypeError: Unknown encoding: foo$/); function genBuffer(size, args) { @@ -270,10 +270,10 @@ // Make sure these throw. assert.throws(() => - Buffer.allocUnsafe(8).fill('a', -1), + Buffer.allocUnsafe(8).fill('a', -1), /^RangeError: Out of range index$/); assert.throws(() => - Buffer.allocUnsafe(8).fill('a', 0, 9), + Buffer.allocUnsafe(8).fill('a', 0, 9), /^RangeError: Out of range index$/); // Make sure this doesn't hang indefinitely. @@ -396,36 +396,36 @@ }, /^RangeError: out of range index$/); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), - Buffer.from('61006200610062006100620061006200', 'hex')); + Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), + Buffer.from('61006200610062006100620061006200', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(15).fill('ab', 'utf16le'), - Buffer.from('610062006100620061006200610062', 'hex')); + Buffer.allocUnsafeSlow(15).fill('ab', 'utf16le'), + Buffer.from('610062006100620061006200610062', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), - Buffer.from('61006200610062006100620061006200', 'hex')); + Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), + Buffer.from('61006200610062006100620061006200', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf16le'), - Buffer.from('61006100610061006100610061006100', 'hex')); + Buffer.allocUnsafeSlow(16).fill('a', 'utf16le'), + Buffer.from('61006100610061006100610061006100', 'hex')); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf16le').toString('utf16le'), - 'a'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('a', 'utf16le').toString('utf16le'), + 'a'.repeat(8)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'latin1').toString('latin1'), - 'a'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('a', 'latin1').toString('latin1'), + 'a'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf8').toString('utf8'), - 'a'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('a', 'utf8').toString('utf8'), + 'a'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'utf16le').toString('utf16le'), - 'Љ'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'utf16le').toString('utf16le'), + 'Љ'.repeat(8)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'latin1').toString('latin1'), - '\t'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'latin1').toString('latin1'), + '\t'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'utf8').toString('utf8'), - 'Љ'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'utf8').toString('utf8'), + 'Љ'.repeat(8)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-includes.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-includes.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-includes.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-includes.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,8 +2,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; - const b = Buffer.from('abcdef'); const buf_a = Buffer.from('a'); const buf_bc = Buffer.from('bc'); @@ -156,11 +154,11 @@ assert(!mixedByteStringUcs2.includes('\u0396', 0, 'ucs2')); assert.ok( - mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); assert.ok( - mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); assert.ok( - !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); + !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); @@ -210,7 +208,7 @@ // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( - 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); + 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); assert(!asciiString.includes('\x2061')); assert(asciiString.includes('leb', 0)); @@ -265,11 +263,11 @@ const patternBufferUcs2 = allCharsBufferUcs2.slice(index, index + length); assert.ok( - allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2')); + allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2')); const patternStringUcs2 = patternBufferUcs2.toString('ucs2'); assert.ok( - allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2')); + allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2')); } } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-indexof.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-indexof.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-indexof.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-indexof.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,8 +2,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; - const b = Buffer.from('abcdef'); const buf_a = Buffer.from('a'); const buf_bc = Buffer.from('bc'); @@ -200,11 +198,11 @@ assert.strictEqual(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')); assert.strictEqual( - 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); + 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); assert.strictEqual( - 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); + 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); assert.strictEqual( - -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); + -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); { const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); @@ -224,13 +222,13 @@ // Test multi-char pattern assert.strictEqual( - 0, twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha'); + 0, twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha'); assert.strictEqual( - 2, twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma'); + 2, twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma'); assert.strictEqual( - 4, twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma'); + 4, twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma'); assert.strictEqual( - 6, twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon'); + 6, twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon'); } const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395'); @@ -260,17 +258,17 @@ assert.strictEqual(510, longBufferString.indexOf('AJABACA'), 'Long AJABACA, First J'); assert.strictEqual( - 1534, longBufferString.indexOf('AJABACA', 511), 'Long AJABACA, Second J'); + 1534, longBufferString.indexOf('AJABACA', 511), 'Long AJABACA, Second J'); pattern = 'JABACABADABACABA'; assert.strictEqual( - 511, longBufferString.indexOf(pattern), 'Long JABACABA..., First J'); + 511, longBufferString.indexOf(pattern), 'Long JABACABA..., First J'); assert.strictEqual( - 1535, longBufferString.indexOf(pattern, 512), 'Long JABACABA..., Second J'); + 1535, longBufferString.indexOf(pattern, 512), 'Long JABACABA..., Second J'); // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( - 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); + 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); assert.strictEqual(-1, asciiString.indexOf('\x2061')); assert.strictEqual(3, asciiString.indexOf('leb', 0)); @@ -337,11 +335,11 @@ const patternBufferUcs2 = allCharsBufferUcs2.slice(index, index + length); assert.strictEqual( - index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')); + index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')); const patternStringUcs2 = patternBufferUcs2.toString('ucs2'); assert.strictEqual( - index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')); + index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')); } } } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-isencoding.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-isencoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-isencoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-isencoding.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,7 +3,8 @@ require('../common'); const assert = require('assert'); -[ 'hex', +[ + 'hex', 'utf8', 'utf-8', 'ascii', @@ -13,11 +14,13 @@ 'ucs2', 'ucs-2', 'utf16le', - 'utf-16le' ].forEach((enc) => { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + 'utf-16le' +].forEach((enc) => { + assert.strictEqual(Buffer.isEncoding(enc), true); +}); -[ 'utf9', +[ + 'utf9', 'utf-7', 'Unicode-FTW', 'new gnu gun', @@ -28,6 +31,7 @@ [], 1, 0, - -1 ].forEach((enc) => { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + -1 +].forEach((enc) => { + assert.strictEqual(Buffer.isEncoding(enc), false); +}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer.js nodejs-6.11.4~dfsg/test/parallel/test-buffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -1047,15 +1047,15 @@ 'ucs-2', 'utf16le', 'utf-16le' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + assert.strictEqual(Buffer.isEncoding(enc), true); +}); [ 'utf9', 'utf-7', 'Unicode-FTW', 'new gnu gun' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + assert.strictEqual(Buffer.isEncoding(enc), false); +}); // GH-5110 @@ -1183,16 +1183,16 @@ const buf = new Buffer([0xFF, 0xFF, 0xFF, 0xFF]); assert.strictEqual(buf['readUInt' + bits + 'BE'](0), - (0xFFFFFFFF >>> (32 - bits))); + (0xFFFFFFFF >>> (32 - bits))); assert.strictEqual(buf['readUInt' + bits + 'LE'](0), - (0xFFFFFFFF >>> (32 - bits))); + (0xFFFFFFFF >>> (32 - bits))); assert.strictEqual(buf['readInt' + bits + 'BE'](0), - (0xFFFFFFFF >> (32 - bits))); + (0xFFFFFFFF >> (32 - bits))); assert.strictEqual(buf['readInt' + bits + 'LE'](0), - (0xFFFFFFFF >> (32 - bits))); + (0xFFFFFFFF >> (32 - bits))); }); // test for common read(U)IntLE/BE @@ -1404,7 +1404,7 @@ crypto.createHash('sha1').update(b2).digest('hex') ); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } // Test Compare diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-new.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-new.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-new.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-new.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,6 +2,5 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; assert.throws(() => new Buffer(42, 'utf8'), /first argument must be a string/); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-read.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-read.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-read.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-read.js 2017-10-03 17:11:29.000000000 +0000 @@ -14,9 +14,9 @@ ); assert.doesNotThrow( - () => assert.strictEqual(buff[funx](...args, true), expected), - 'noAssert does not change return value for valid ranges' -); + () => assert.strictEqual(buff[funx](...args, true), expected), + 'noAssert does not change return value for valid ranges' + ); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-read-noassert.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-read-noassert.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-read-noassert.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-read-noassert.js 2017-10-03 17:11:29.000000000 +0000 @@ -14,9 +14,9 @@ ); assert.doesNotThrow( - () => assert.strictEqual(buff[funx](...args, true), expected), - 'noAssert does not change return value for valid ranges' -); + () => assert.strictEqual(buff[funx](...args, true), expected), + 'noAssert does not change return value for valid ranges' + ); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-sharedarraybuffer.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-sharedarraybuffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-sharedarraybuffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-sharedarraybuffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -4,7 +4,6 @@ require('../common'); const assert = require('assert'); -const Buffer = require('buffer').Buffer; const sab = new SharedArrayBuffer(24); const arr1 = new Uint16Array(sab); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-buffer-slow.js nodejs-6.11.4~dfsg/test/parallel/test-buffer-slow.js --- nodejs-6.11.2~dfsg/test/parallel/test-buffer-slow.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-buffer-slow.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,7 +3,6 @@ require('../common'); const assert = require('assert'); const buffer = require('buffer'); -const Buffer = buffer.Buffer; const SlowBuffer = buffer.SlowBuffer; const ones = [1, 1, 1, 1]; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-disconnect.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-disconnect.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-disconnect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-disconnect.js 2017-10-03 17:11:29.000000000 +0000 @@ -57,7 +57,7 @@ })); // the process should also self terminate without using signals - child.on('exit', common.mustCall(function() {})); + child.on('exit', common.mustCall()); // when child is listening child.on('message', function(obj) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-env.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-env.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-env.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-env.js 2017-10-03 17:11:29.000000000 +0000 @@ -13,9 +13,12 @@ let child; if (common.isWindows) { - child = spawn('cmd.exe', ['/c', 'set'], {env: env}); + child = spawn('cmd.exe', ['/c', 'set'], + Object.assign({}, process.env, { env: env })); } else { - child = spawn('/usr/bin/env', [], {env: env}); + child = spawn('/usr/bin/env', [], { env: env }); + child = spawn('/usr/bin/env', [], + Object.assign({}, process.env, { env: env })); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-cwd.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-cwd.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-cwd.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-cwd.js 2017-10-03 17:11:29.000000000 +0000 @@ -15,5 +15,5 @@ exec(pwdcommand, {cwd: dir}, common.mustCall(function(err, stdout, stderr) { assert.ifError(err); - assert.strictEqual(stdout.indexOf(dir), 0); + assert(stdout.startsWith(dir)); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-env.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-env.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-env.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-env.js 2017-10-03 17:11:29.000000000 +0000 @@ -23,7 +23,9 @@ if (!common.isWindows) { child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after); } else { - child = exec('set', { env: { 'HELLO': 'WORLD' } }, after); + child = exec('set', + { env: Object.assign({}, process.env, { 'HELLO': 'WORLD' }) }, + after); } child.stdout.setEncoding('utf8'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-maxBuffer.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-maxBuffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-exec-maxBuffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-exec-maxBuffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -25,7 +25,7 @@ } { - const cmd = `"${process.execPath}" -e "console.('${unicode}');"`; + const cmd = `"${process.execPath}" -e "console.error('${unicode}');"`; cp.exec(cmd, {maxBuffer: 10}, checkFactory('stderr')); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-and-spawn.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-and-spawn.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-and-spawn.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-and-spawn.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,8 +1,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const spawn = require('child_process').spawn; -const fork = require('child_process').fork; +const { fork, spawn } = require('child_process'); // Fork, then spawn. The spawned process should not hang. switch (process.argv[2] || '') { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-dgram.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-dgram.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-dgram.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-dgram.js 2017-10-03 17:11:29.000000000 +0000 @@ -7,15 +7,13 @@ */ const common = require('../common'); +if (common.isWindows) + common.skip('Sending dgram sockets to child processes is not supported'); + const dgram = require('dgram'); const fork = require('child_process').fork; const assert = require('assert'); -if (common.isWindows) { - common.skip('Sending dgram sockets to child processes is not supported'); - return; -} - if (process.argv[2] === 'child') { let childServer; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-ref2.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-ref2.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-fork-ref2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-fork-ref2.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const fork = require('child_process').fork; if (process.argv[2] === 'child') { @@ -8,7 +8,7 @@ setTimeout(function() { console.log('child -> will this keep it alive?'); - process.on('message', function() { }); + process.on('message', common.mustNotCall()); }, 400); } else { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-kill.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-kill.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-kill.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-kill.js 2017-10-03 17:11:29.000000000 +0000 @@ -4,9 +4,9 @@ const spawn = require('child_process').spawn; const cat = spawn(common.isWindows ? 'cmd' : 'cat'); -cat.stdout.on('end', common.mustCall(function() {})); +cat.stdout.on('end', common.mustCall()); cat.stderr.on('data', common.mustNotCall()); -cat.stderr.on('end', common.mustCall(function() {})); +cat.stderr.on('end', common.mustCall()); cat.on('exit', common.mustCall(function(code, signal) { assert.strictEqual(code, null); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-send-returns-boolean.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-send-returns-boolean.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-send-returns-boolean.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-send-returns-boolean.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,8 +3,7 @@ const assert = require('assert'); const path = require('path'); const net = require('net'); -const fork = require('child_process').fork; -const spawn = require('child_process').spawn; +const { fork, spawn } = require('child_process'); const emptyFile = path.join(common.fixturesDir, 'empty.js'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-send-type-error.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-send-type-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-send-type-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-send-type-error.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); + const assert = require('assert'); const cp = require('child_process'); -function noop() {} - function fail(proc, args) { assert.throws(() => { proc.send.apply(proc, args); @@ -13,8 +12,13 @@ let target = process; -if (process.argv[2] !== 'child') +if (process.argv[2] !== 'child') { target = cp.fork(__filename, ['child']); + target.on('exit', common.mustCall((code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + })); +} fail(target, ['msg', null, null]); fail(target, ['msg', null, '']); @@ -22,4 +26,4 @@ fail(target, ['msg', null, 0]); fail(target, ['msg', null, NaN]); fail(target, ['msg', null, 1]); -fail(target, ['msg', null, null, noop]); +fail(target, ['msg', null, null, common.mustNotCall()]); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-spawn-argv0.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-spawn-argv0.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-spawn-argv0.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-spawn-argv0.js 2017-10-03 17:11:29.000000000 +0000 @@ -14,5 +14,5 @@ assert.strictEqual(noArgv0.stdout.toString().trim(), process.execPath); const withArgv0 = cp.spawnSync(process.execPath, [__filename, 'child'], - {argv0: 'withArgv0'}); + {argv0: 'withArgv0'}); assert.strictEqual(withArgv0.stdout.toString().trim(), 'withArgv0'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-spawnsync-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-spawnsync-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-spawnsync-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-spawnsync-timeout.js 2017-10-03 17:11:29.000000000 +0000 @@ -17,7 +17,7 @@ default: const start = Date.now(); const ret = spawnSync(process.execPath, [__filename, 'child'], - {timeout: TIMER}); + {timeout: TIMER}); assert.strictEqual(ret.error.errno, 'ETIMEDOUT'); const end = Date.now() - start; assert(end < SLEEP); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-stdin.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-stdin.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-stdin.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-stdin.js 2017-10-03 17:11:29.000000000 +0000 @@ -22,11 +22,11 @@ response += chunk; }); -cat.stdout.on('end', common.mustCall(function() {})); +cat.stdout.on('end', common.mustCall()); cat.stderr.on('data', common.mustNotCall()); -cat.stderr.on('end', common.mustCall(function() {})); +cat.stderr.on('end', common.mustCall()); cat.on('exit', common.mustCall(function(status) { assert.strictEqual(0, status); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-child-process-stdio-big-write-end.js nodejs-6.11.4~dfsg/test/parallel/test-child-process-stdio-big-write-end.js --- nodejs-6.11.2~dfsg/test/parallel/test-child-process-stdio-big-write-end.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-child-process-stdio-big-write-end.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); let bufsize = 0; @@ -22,10 +22,10 @@ child.stdout.on('data', function(c) { n += c; }); - child.stdout.on('end', function() { + child.stdout.on('end', common.mustCall(function() { assert.strictEqual(+n, sent); console.log('ok'); - }); + })); // Write until the buffer fills up. let buf; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-basic.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-basic.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-basic.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-basic.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); + const assert = require('assert'); const cluster = require('cluster'); @@ -14,7 +15,7 @@ if (cluster.isWorker) { - require('http').Server(common.noop).listen(0, '127.0.0.1'); + require('http').Server(common.mustNotCall()).listen(0, '127.0.0.1'); } else if (cluster.isMaster) { const checks = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-bind-privileged-port.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-bind-privileged-port.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-bind-privileged-port.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-bind-privileged-port.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows.'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('Test is not supposed to be run as root.'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((exitCode) => { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-1.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-1.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-1.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-1.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -7,12 +10,6 @@ const cluster = require('cluster'); const dgram = require('dgram'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-2.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-2.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-2.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -7,12 +10,6 @@ const dgram = require('dgram'); const assert = require('assert'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-reuse.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-reuse.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-dgram-reuse.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-dgram-reuse.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on windows.'); - return; -} - if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-handles.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-handles.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-handles.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-handles.js 2017-10-03 17:11:29.000000000 +0000 @@ -3,17 +3,16 @@ 'use strict'; const common = require('../common'); + +if (common.isWindows) + common.skip('SCHED_RR not reliable on Windows'); + const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); const Protocol = require('_debugger').Protocol; -if (common.isWindows) { - common.skip('SCHED_RR not reliable on Windows'); - return; -} - cluster.schedulingPolicy = cluster.SCHED_RR; // Worker sends back a "I'm here" message, then immediately suspends diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-race.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-race.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-race.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-race.js 2017-10-03 17:11:29.000000000 +0000 @@ -4,15 +4,13 @@ // Ref: https://github.com/nodejs/node/issues/4205 const common = require('../common'); +if (common.isWindows) + common.skip('This test does not apply to Windows.'); + const assert = require('assert'); const net = require('net'); const cluster = require('cluster'); -if (common.isWindows) { - common.skip('This test does not apply to Windows.'); - return; -} - cluster.schedulingPolicy = cluster.SCHED_NONE; if (cluster.isMaster) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-unshared-udp.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-unshared-udp.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-disconnect-unshared-udp.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-disconnect-unshared-udp.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('on windows, because clustered dgram is ENOTSUP'); - return; -} const cluster = require('cluster'); const dgram = require('dgram'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-eaccess.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-eaccess.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-eaccess.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-eaccess.js 2017-10-03 17:11:29.000000000 +0000 @@ -14,10 +14,10 @@ const worker = cluster.fork(); // makes sure master is able to fork the worker - cluster.on('fork', common.mustCall(function() {})); + cluster.on('fork', common.mustCall()); // makes sure the worker is ready - worker.on('online', common.mustCall(function() {})); + worker.on('online', common.mustCall()); worker.on('message', common.mustCall(function(err) { // disconnect first, so that we will not leave zombies @@ -38,7 +38,7 @@ } else { common.refreshTmpDir(); const cp = fork(`${common.fixturesDir}/listen-on-socket-and-exit.js`, - { stdio: 'inherit' }); + { stdio: 'inherit' }); // message from the child indicates it's ready and listening cp.on('message', common.mustCall(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-http-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-http-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-http-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-http-pipe.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const http = require('http'); - if (common.isWindows) { common.skip( 'It is not possible to send pipe handles over the IPC pipe on Windows'); - return; } +const assert = require('assert'); +const cluster = require('cluster'); +const http = require('http'); + if (cluster.isMaster) { common.refreshTmpDir(); const worker = cluster.fork(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-rr-domain-listen.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-rr-domain-listen.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-rr-domain-listen.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-rr-domain-listen.js 2017-10-03 17:11:29.000000000 +0000 @@ -8,10 +8,10 @@ if (cluster.isWorker) { const d = domain.create(); - d.run(function() { }); + d.run(() => {}); const http = require('http'); - http.Server(function() { }).listen(0, '127.0.0.1'); + http.Server(() => {}).listen(0, '127.0.0.1'); } else if (cluster.isMaster) { let worker; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-setup-master-emit.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-setup-master-emit.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-setup-master-emit.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-setup-master-emit.js 2017-10-03 17:11:29.000000000 +0000 @@ -22,5 +22,5 @@ } emitAndCatch(common.mustCall(function() { - emitAndCatch2(common.mustCall(function() {})); + emitAndCatch2(common.mustCall()); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-shared-handle-bind-privileged-port.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-shared-handle-bind-privileged-port.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-shared-handle-bind-privileged-port.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-shared-handle-bind-privileged-port.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('as this test should not be run as `root`'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { // Master opens and binds the socket and shares it with the worker. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-worker-destroy.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-worker-destroy.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-worker-destroy.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-worker-destroy.js 2017-10-03 17:11:29.000000000 +0000 @@ -17,8 +17,8 @@ worker2 = cluster.fork(); [worker1, worker2].forEach(function(worker) { - worker.on('disconnect', common.mustCall(function() {})); - worker.on('exit', common.mustCall(function() {})); + worker.on('disconnect', common.mustCall()); + worker.on('exit', common.mustCall()); }); } else { if (cluster.worker.id === 1) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cluster-worker-wait-server-close.js nodejs-6.11.4~dfsg/test/parallel/test-cluster-worker-wait-server-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-cluster-worker-wait-server-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cluster-worker-wait-server-close.js 2017-10-03 17:11:29.000000000 +0000 @@ -11,7 +11,7 @@ const server = net.createServer(function(socket) { // Wait for any data, then close connection socket.write('.'); - socket.on('data', function discard() {}); + socket.on('data', () => {}); }).listen(0, common.localhostIPv4); server.once('close', function() { @@ -20,7 +20,7 @@ // Although not typical, the worker process can exit before the disconnect // event fires. Use this to keep the process open until the event has fired. - const keepOpen = setInterval(function() {}, 9999); + const keepOpen = setInterval(() => {}, 9999); // Check worker events and properties process.once('disconnect', function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-common-countdown.js nodejs-6.11.4~dfsg/test/parallel/test-common-countdown.js --- nodejs-6.11.2~dfsg/test/parallel/test-common-countdown.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-common-countdown.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,15 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const Countdown = require('../common/countdown'); + +let done = ''; + +const countdown = new Countdown(2, common.mustCall(() => done = true)); +assert.strictEqual(countdown.remaining, 2); +countdown.dec(); +assert.strictEqual(countdown.remaining, 1); +countdown.dec(); +assert.strictEqual(countdown.remaining, 0); +assert.strictEqual(done, true); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-common.js nodejs-6.11.4~dfsg/test/parallel/test-common.js --- nodejs-6.11.2~dfsg/test/parallel/test-common.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-common.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,14 +2,54 @@ const common = require('../common'); const assert = require('assert'); +const {join} = require('path'); +const {execFile} = require('child_process'); + common.globalCheck = false; global.gc = 42; // Not a valid global unless --expose_gc is set. assert.deepStrictEqual(common.leakedGlobals(), ['gc']); assert.throws(function() { - common.mustCall(function() {}, 'foo'); -}, /^TypeError: Invalid expected value: foo$/); + common.mustCall(() => {}, 'foo'); +}, /^TypeError: Invalid exact value: foo$/); assert.throws(function() { - common.mustCall(function() {}, /foo/); -}, /^TypeError: Invalid expected value: \/foo\/$/); + common.mustCall(() => {}, /foo/); +}, /^TypeError: Invalid exact value: \/foo\/$/); + +const fnOnce = common.mustCall(() => {}); +fnOnce(); +const fnTwice = common.mustCall(() => {}, 2); +fnTwice(); +fnTwice(); +const fnAtLeast1Called1 = common.mustCallAtLeast(() => {}, 1); +fnAtLeast1Called1(); +const fnAtLeast1Called2 = common.mustCallAtLeast(() => {}, 1); +fnAtLeast1Called2(); +fnAtLeast1Called2(); +const fnAtLeast2Called2 = common.mustCallAtLeast(() => {}, 2); +fnAtLeast2Called2(); +fnAtLeast2Called2(); +const fnAtLeast2Called3 = common.mustCallAtLeast(() => {}, 2); +fnAtLeast2Called3(); +fnAtLeast2Called3(); +fnAtLeast2Called3(); + +const failFixtures = [ + [ + join(common.fixturesDir, 'failmustcall1.js'), + 'Mismatched function calls. Expected exactly 2, actual 1.' + ], [ + join(common.fixturesDir, 'failmustcall2.js'), + 'Mismatched function calls. Expected at least 2, actual 1.' + ] +]; +for (const p of failFixtures) { + const [file, expected] = p; + execFile(process.argv[0], [file], common.mustCall((ex, stdout, stderr) => { + assert.ok(ex); + assert.strictEqual(stderr, ''); + const firstLine = stdout.split('\n').shift(); + assert.strictEqual(firstLine, expected); + })); +} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-console.js nodejs-6.11.4~dfsg/test/parallel/test-console.js --- nodejs-6.11.2~dfsg/test/parallel/test-console.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-console.js 2017-10-03 17:11:29.000000000 +0000 @@ -115,8 +115,8 @@ strings.shift()); assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n", strings.shift()); -assert.notStrictEqual(-1, strings.shift().indexOf('foo: [Object]')); -assert.strictEqual(-1, strings.shift().indexOf('baz')); +assert.ok(strings.shift().includes('foo: [Object]')); +assert.strictEqual(strings.shift().includes('baz'), false); assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim())); assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim())); assert.ok(/^constructor: \d+\.\d{3}ms$/.test(strings.shift().trim())); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-authenticated.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-authenticated.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-authenticated.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-authenticated.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -320,12 +318,12 @@ const test = TEST_CASES[i]; if (!ciphers.includes(test.algo)) { - common.skip(`unsupported ${test.algo} test`); + common.printSkipMessage(`unsupported ${test.algo} test`); continue; } if (common.hasFipsCrypto && test.iv.length < 24) { - common.skip('IV len < 12 bytes unsupported in FIPS mode'); + common.printSkipMessage('IV len < 12 bytes unsupported in FIPS mode'); continue; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-binary-default.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-binary-default.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-binary-default.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-binary-default.js 2017-10-03 17:11:29.000000000 +0000 @@ -5,10 +5,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-certificate.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-certificate.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-certificate.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-certificate.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-cipher-decipher.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-cipher-decipher.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-cipher-decipher.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-cipher-decipher.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { + +if (common.hasFipsCrypto) common.skip('not supported in FIPS mode'); - return; -} + const crypto = require('crypto'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-cipheriv-decipheriv.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-cipheriv-decipheriv.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-cipheriv-decipheriv.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-cipheriv-decipheriv.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function testCipher1(key, iv) { @@ -71,9 +69,9 @@ // But non-empty IVs should be rejected. for (let n = 1; n < 256; n += 1) { assert.throws( - () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), - Buffer.alloc(n)), - errMessage); + () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), + Buffer.alloc(n)), + errMessage); } // Correctly sized IV should be accepted in CBC mode. @@ -83,16 +81,16 @@ for (let n = 0; n < 256; n += 1) { if (n === 16) continue; assert.throws( - () => crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), - Buffer.alloc(n)), - errMessage); + () => crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), + Buffer.alloc(n)), + errMessage); } // Zero-sized IV should be rejected in GCM mode. assert.throws( - () => crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), - Buffer.alloc(0)), - errMessage); + () => crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), + Buffer.alloc(0)), + errMessage); // But all other IV lengths should be accepted. for (let n = 1; n < 256; n += 1) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-deprecated.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-deprecated.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-deprecated.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-deprecated.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-dh.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-dh.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-dh.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-dh.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); + const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; // Test Diffie-Hellman with two parties sharing a secret, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-dh-odd-key.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-dh-odd-key.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-dh-odd-key.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-dh-odd-key.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function test() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-domain.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-domain.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-domain.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-domain.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const domain = require('domain'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); +const domain = require('domain'); function test(fn) { const ex = new Error('BAM'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-domains.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-domains.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-domains.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-domains.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const domain = require('domain'); const assert = require('assert'); +const crypto = require('crypto'); + const d = domain.create(); const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); - d.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, expect.shift()); }, 3)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-ecb.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-ecb.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-ecb.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-ecb.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { + +if (common.hasFipsCrypto) common.skip('BF-ECB is not FIPS 140-2 compatible'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-engine.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-engine.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-engine.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-engine.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-fips.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-fips.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-fips.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-fips.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawnSync = require('child_process').spawnSync; const path = require('path'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const FIPS_ENABLED = 1; const FIPS_DISABLED = 0; const FIPS_ERROR_STRING = 'Error: Cannot set FIPS mode'; @@ -21,13 +19,8 @@ return process.config.variables.openssl_fips ? true : false; } -function addToEnv(newVar, value) { - const envCopy = {}; - for (const e in process.env) { - envCopy[e] = process.env[e]; - } - envCopy[newVar] = value; - return envCopy; +function sharedOpenSSL() { + return process.config.variables.node_shared_openssl; } function testHelper(stream, args, expectedOutput, cmd, env) { @@ -39,7 +32,7 @@ console.error( `Spawned child [pid:${child.pid}] with cmd '${cmd}' expect %j with args '${ - args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF); + args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF); function childOk(child) { console.error(`Child #${++num_children_ok} [pid:${child.pid}] OK.`); @@ -67,7 +60,7 @@ [], FIPS_DISABLED, 'require("crypto").fips', - addToEnv('OPENSSL_CONF', '')); + Object.assign({}, process.env, { 'OPENSSL_CONF': '' })); // --enable-fips should turn FIPS mode on testHelper( @@ -85,36 +78,50 @@ 'require("crypto").fips', process.env); -// OpenSSL config file should be able to turn on FIPS mode -testHelper( - 'stdout', - [`--openssl-config=${CNF_FIPS_ON}`], - compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, - 'require("crypto").fips', - process.env); - -// OPENSSL_CONF should be able to turn on FIPS mode -testHelper( - 'stdout', - [], - compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, - 'require("crypto").fips', - addToEnv('OPENSSL_CONF', CNF_FIPS_ON)); - -// --openssl-config option should override OPENSSL_CONF -testHelper( - 'stdout', - [`--openssl-config=${CNF_FIPS_ON}`], - compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, - 'require("crypto").fips', - addToEnv('OPENSSL_CONF', CNF_FIPS_OFF)); +// If Node was configured using --shared-openssl fips support might be +// available depending on how OpenSSL was built. If fips support is +// available the tests that toggle the fips_mode on/off using the config +// file option will succeed and return 1 instead of 0. +// +// Note that this case is different from when calling the fips setter as the +// configuration file is handled by OpenSSL, so it is not possible for us +// to try to call the fips setter, to try to detect this situation, as +// that would throw an error: +// ("Error: Cannot set FIPS mode in a non-FIPS build."). +// Due to this uncertanty the following tests are skipped when configured +// with --shared-openssl. +if (!sharedOpenSSL()) { + // OpenSSL config file should be able to turn on FIPS mode + testHelper( + 'stdout', + [`--openssl-config=${CNF_FIPS_ON}`], + compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, + 'require("crypto").fips', + process.env); + + // OPENSSL_CONF should be able to turn on FIPS mode + testHelper( + 'stdout', + [], + compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, + 'require("crypto").fips', + Object.assign({}, process.env, { 'OPENSSL_CONF': CNF_FIPS_ON })); + + // --openssl-config option should override OPENSSL_CONF + testHelper( + 'stdout', + [`--openssl-config=${CNF_FIPS_ON}`], + compiledWithFips() ? FIPS_ENABLED : FIPS_DISABLED, + 'require("crypto").fips', + Object.assign({}, process.env, { 'OPENSSL_CONF': CNF_FIPS_OFF })); +} testHelper( 'stdout', [`--openssl-config=${CNF_FIPS_OFF}`], FIPS_DISABLED, 'require("crypto").fips', - addToEnv('OPENSSL_CONF', CNF_FIPS_ON)); + Object.assign({}, process.env, { 'OPENSSL_CONF': CNF_FIPS_ON })); // --enable-fips should take precedence over OpenSSL config file testHelper( @@ -130,7 +137,7 @@ ['--enable-fips'], compiledWithFips() ? FIPS_ENABLED : OPTION_ERROR_STRING, 'require("crypto").fips', - addToEnv('OPENSSL_CONF', CNF_FIPS_OFF)); + Object.assign({}, process.env, { 'OPENSSL_CONF': CNF_FIPS_OFF })); // --force-fips should take precedence over OpenSSL config file testHelper( @@ -146,7 +153,7 @@ ['--force-fips'], compiledWithFips() ? FIPS_ENABLED : OPTION_ERROR_STRING, 'require("crypto").fips', - addToEnv('OPENSSL_CONF', CNF_FIPS_OFF)); + Object.assign({}, process.env, { 'OPENSSL_CONF': CNF_FIPS_OFF })); // setFipsCrypto should be able to turn FIPS mode on testHelper( diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-from-binary.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-from-binary.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-from-binary.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-from-binary.js 2017-10-03 17:11:29.000000000 +0000 @@ -4,12 +4,10 @@ const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const EXTERN_APEX = 0xFBEE9; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-hash.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-hash.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-hash.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-hash.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test hashing @@ -82,11 +80,11 @@ fileStream.on('data', function(data) { sha1Hash.update(data); }); -fileStream.on('close', function() { +fileStream.on('close', common.mustCall(function() { assert.strictEqual(sha1Hash.digest('hex'), '22723e553129a336ad96e10f6aecdf0f45e4149e', 'Test SHA1 of sample.png'); -}); +})); // Issue #2227: unknown digest method should throw an error. assert.throws(function() { @@ -96,13 +94,13 @@ // Default UTF-8 encoding const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex'); assert.strictEqual( - hutf8, - '4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' + + hutf8, + '4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' + '43a821af66afa9a45b6a78c712fecf0e56dc7f43aef4bcfc8eb5b4d8dca6ea5b'); assert.notStrictEqual( - hutf8, - crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex')); + hutf8, + crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex')); const h3 = crypto.createHash('sha256'); h3.digest(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-hash-stream-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-hash-stream-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-hash-stream-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-hash-stream-pipe.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-hmac.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-hmac.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-hmac.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-hmac.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); // Test for binding layer robustness diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto.js nodejs-6.11.4~dfsg/test/parallel/test-crypto.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-lazy-transform-writable.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-lazy-transform-writable.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-lazy-transform-writable.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-lazy-transform-writable.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const crypto = require('crypto'); const Stream = require('stream'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-padding-aes256.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-padding-aes256.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-padding-aes256.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-padding-aes256.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-padding.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-padding.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-padding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-padding.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-pbkdf2.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-pbkdf2.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-pbkdf2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-pbkdf2.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,11 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); // diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-random.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-random.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-random.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-random.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const crypto = require('crypto'); @@ -17,7 +16,7 @@ [crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) { [-1, undefined, null, false, true, {}, []].forEach(function(value) { assert.throws(function() { f(value); }, expectedErrorRegexp); - assert.throws(function() { f(value, function() {}); }, expectedErrorRegexp); + assert.throws(function() { f(value, () => {}); }, expectedErrorRegexp); }); [0, 1, 2, 4, 16, 256, 1024].forEach(function(len) { @@ -33,4 +32,4 @@ // length exceeds max acceptable value" assert.throws(function() { crypto.randomBytes((-1 >>> 0) + 1); -}, TypeError); +}, /^TypeError: size must be a number >= 0$/); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-rsa-dsa.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-rsa-dsa.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-rsa-dsa.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-rsa-dsa.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const constants = require('crypto').constants; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); +const fs = require('fs'); const crypto = require('crypto'); +const constants = crypto.constants; const fixtDir = common.fixturesDir; // Test certificates diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-sign-verify.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-sign-verify.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-sign-verify.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-sign-verify.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test certificates diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-stream.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-stream.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-stream.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-stream.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const stream = require('stream'); const util = require('util'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Small stream to buffer converter diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-crypto-verify-failure.js nodejs-6.11.4~dfsg/test/parallel/test-crypto-verify-failure.js --- nodejs-6.11.2~dfsg/test/parallel/test-crypto-verify-failure.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-crypto-verify-failure.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent.js nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent.js --- nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent-preload.js nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent-preload.js --- nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent-preload.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent-preload.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; const abspathFile = require('path').join(common.fixturesDir, 'a.js'); common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent-repl.js nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent-repl.js --- nodejs-6.11.2~dfsg/test/parallel/test-cwd-enoent-repl.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-cwd-enoent-repl.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-debug-mirror-proxy.js nodejs-6.11.4~dfsg/test/parallel/test-debug-mirror-proxy.js --- nodejs-6.11.2~dfsg/test/parallel/test-debug-mirror-proxy.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-debug-mirror-proxy.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,19 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const vm = require('vm'); + +const { MakeMirror, MakeMirrorSerializer } = vm.runInDebugContext('Debug'); +const proxy = new Proxy({ x: 1, y: 2 }, { get: Reflect.get }); +const mirror = MakeMirror(proxy, /* transient */ true); + +assert.strictEqual(mirror.isProxy(), true); +assert.strictEqual(mirror.toText(), '#'); +assert.strictEqual(mirror.value(), proxy); + +const serializer = MakeMirrorSerializer(/* details */ true); +const serialized = serializer.serializeValue(mirror); +assert.deepStrictEqual(Object.keys(serialized).sort(), ['text', 'type']); +assert.strictEqual(serialized.type, 'proxy'); +assert.strictEqual(serialized.text, '#'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-debug-usage.js nodejs-6.11.4~dfsg/test/parallel/test-debug-usage.js --- nodejs-6.11.2~dfsg/test/parallel/test-debug-usage.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-debug-usage.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const child = spawn(process.execPath, ['debug']); child.stderr.setEncoding('utf8'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-bind-default-address.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-bind-default-address.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-bind-default-address.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-bind-default-address.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); - // skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const dgram = require('dgram'); dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); @@ -18,7 +16,7 @@ })); if (!common.hasIPv6) { - common.skip('udp6 part of test, because no IPv6 support'); + common.printSkipMessage('udp6 part of test, because no IPv6 support'); return; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-close-is-not-callback.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-close-is-not-callback.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-close-is-not-callback.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-close-is-not-callback.js 2017-10-03 17:11:29.000000000 +0000 @@ -17,5 +17,5 @@ socket.close('bad argument'); portGetter.close(); - socket.on('close', common.mustCall(function() {})); + socket.on('close', common.mustCall()); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-close.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-close.js 2017-10-03 17:11:29.000000000 +0000 @@ -18,8 +18,8 @@ portGetter.address().port, portGetter.address().address); - assert.strictEqual(socket.close(common.mustCall(function() {})), socket); - socket.on('close', common.mustCall(function() {})); + assert.strictEqual(socket.close(common.mustCall()), socket); + socket.on('close', common.mustCall()); socket = null; // Verify that accessing handle after closure doesn't throw diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-error-message-address.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-error-message-address.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-error-message-address.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-error-message-address.js 2017-10-03 17:11:29.000000000 +0000 @@ -26,7 +26,7 @@ socket_ipv6.on('error', common.mustCall(function(e) { // EAFNOSUPPORT or EPROTONOSUPPORT means IPv6 is disabled on this system. const allowed = ['EADDRNOTAVAIL', 'EAFNOSUPPORT', 'EPROTONOSUPPORT']; - assert.notStrictEqual(allowed.indexOf(e.code), -1); + assert(allowed.includes(e.code)); assert.strictEqual(e.port, undefined); assert.strictEqual(e.message, `bind ${e.code} 111::1`); assert.strictEqual(e.address, '111::1'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-oob-buffer.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-oob-buffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-oob-buffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-oob-buffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -10,15 +10,14 @@ const buf = Buffer.from([1, 2, 3, 4]); const portGetter = dgram.createSocket('udp4') .bind(0, 'localhost', common.mustCall(() => { - const address = portGetter.address(); + const { address, port } = portGetter.address(); portGetter.close(common.mustCall(() => { - function ok() {} - socket.send(buf, 0, 0, address.port, address.address, ok); - socket.send(buf, 0, 4, address.port, address.address, ok); - socket.send(buf, 1, 3, address.port, address.address, ok); - socket.send(buf, 3, 1, address.port, address.address, ok); + socket.send(buf, 0, 0, port, address, common.mustNotCall()); + socket.send(buf, 0, 4, port, address, common.mustNotCall()); + socket.send(buf, 1, 3, port, address, common.mustNotCall()); + socket.send(buf, 3, 1, port, address, common.mustNotCall()); // Since length of zero means nothing, don't error despite OOB. - socket.send(buf, 4, 0, address.port, address.address, ok); + socket.send(buf, 4, 0, port, address, common.mustNotCall()); socket.close(); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-array.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-array.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-array.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-array.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} const assert = require('assert'); const dgram = require('dgram'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-buffer.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-buffer.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-buffer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-buffer.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); @@ -22,6 +19,6 @@ const buf = Buffer.alloc(0); let interval = setInterval(function() { - client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall(function() {})); + client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall()); }, 10); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-packet.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-packet.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-send-empty-packet.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-send-empty-packet.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dgram-udp6-send-default-host.js nodejs-6.11.4~dfsg/test/parallel/test-dgram-udp6-send-default-host.js --- nodejs-6.11.2~dfsg/test/parallel/test-dgram-udp6-send-default-host.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dgram-udp6-send-default-host.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const dgram = require('dgram'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const client = dgram.createSocket('udp6'); const toSend = [Buffer.alloc(256, 'x'), diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dh-padding.js nodejs-6.11.4~dfsg/test/parallel/test-dh-padding.js --- nodejs-6.11.2~dfsg/test/parallel/test-dh-padding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dh-padding.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -let crypto; -try { - crypto = require('crypto'); -} catch (e) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} + +const assert = require('assert'); +const crypto = require('crypto'); /* This test verifies padding with leading zeroes for shared * secrets that are strictly smaller than the modulus (prime). diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dns-lookup.js nodejs-6.11.4~dfsg/test/parallel/test-dns-lookup.js --- nodejs-6.11.2~dfsg/test/parallel/test-dns-lookup.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dns-lookup.js 2017-10-03 17:11:29.000000000 +0000 @@ -24,7 +24,7 @@ hints: 100, family: 0, all: false - }, () => {}); + }, common.mustNotCall()); }, /^TypeError: Invalid argument: hints must use valid flags$/); assert.throws(() => { @@ -32,7 +32,7 @@ hints: 0, family: 20, all: false - }, () => {}); + }, common.mustNotCall()); }, /^TypeError: Invalid argument: family must be 4 or 6$/); assert.doesNotThrow(() => { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-abort-on-uncaught.js nodejs-6.11.4~dfsg/test/parallel/test-domain-abort-on-uncaught.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-abort-on-uncaught.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-abort-on-uncaught.js 2017-10-03 17:11:29.000000000 +0000 @@ -0,0 +1,221 @@ +'use strict'; + +// This test makes sure that when using --abort-on-uncaught-exception and +// when throwing an error from within a domain that has an error handler +// setup, the process _does not_ abort. + +const common = require('../common'); + +const assert = require('assert'); +const domain = require('domain'); +const child_process = require('child_process'); + +const tests = [ + function nextTick() { + const d = domain.create(); + + d.once('error', common.mustCall()); + + d.run(function() { + process.nextTick(function() { + throw new Error('exceptional!'); + }); + }); + }, + + function timer() { + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + setTimeout(function() { + throw new Error('exceptional!'); + }, 33); + }); + }, + + function immediate() { + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + setImmediate(function() { + throw new Error('boom!'); + }); + }); + }, + + function timerPlusNextTick() { + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + setTimeout(function() { + process.nextTick(function() { + throw new Error('exceptional!'); + }); + }, 33); + }); + }, + + function firstRun() { + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + throw new Error('exceptional!'); + }); + }, + + function fsAsync() { + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + const fs = require('fs'); + fs.exists('/non/existing/file', function onExists(exists) { + throw new Error('boom!'); + }); + }); + }, + + function netServer() { + const net = require('net'); + const d = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + const server = net.createServer(function(conn) { + conn.pipe(conn); + }); + server.listen(0, common.localhostIPv4, function() { + const conn = net.connect(this.address().port, common.localhostIPv4); + conn.once('data', function() { + throw new Error('ok'); + }); + conn.end('ok'); + server.close(); + }); + }); + }, + + function firstRunOnlyTopLevelErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + throw new Error('boom!'); + }); + }); + }, + + function firstRunNestedWithErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d2.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + throw new Error('boom!'); + }); + }); + }, + + function timeoutNestedWithErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d2.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + setTimeout(function() { + console.log('foo'); + throw new Error('boom!'); + }, 33); + }); + }); + }, + + function setImmediateNestedWithErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d2.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + setImmediate(function() { + throw new Error('boom!'); + }); + }); + }); + }, + + function nextTickNestedWithErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d2.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + process.nextTick(function() { + throw new Error('boom!'); + }); + }); + }); + }, + + function fsAsyncNestedWithErrorHandler() { + const d = domain.create(); + const d2 = domain.create(); + + d2.on('error', common.mustCall()); + + d.run(function() { + d2.run(function() { + const fs = require('fs'); + fs.exists('/non/existing/file', function onExists(exists) { + throw new Error('boom!'); + }); + }); + }); + } +]; + +if (process.argv[2] === 'child') { + const testIndex = +process.argv[3]; + + tests[testIndex](); + +} else { + + tests.forEach(function(test, testIndex) { + let testCmd = ''; + if (!common.isWindows) { + // Do not create core files, as it can take a lot of disk space on + // continuous testing and developers' machines + testCmd += 'ulimit -c 0 && '; + } + + testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception ` + + `"${process.argv[1]}" child ${testIndex}`; + + try { + child_process.execSync(testCmd); + } catch (e) { + assert.fail(undefined, undefined, `Test index ${testIndex} failed: ${e}`); + } + }); +} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-crypto.js nodejs-6.11.4~dfsg/test/parallel/test-domain-crypto.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-crypto.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-crypto.js 2017-10-03 17:11:29.000000000 +0000 @@ -2,13 +2,10 @@ const common = require('../common'); -let crypto; -try { - crypto = require('crypto'); -} catch (e) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} + +const crypto = require('crypto'); // Pollution of global is intentional as part of test. common.globalCheck = false; @@ -17,7 +14,7 @@ // should not throw a 'TypeError: undefined is not a function' exception crypto.randomBytes(8); -crypto.randomBytes(8, function() {}); +crypto.randomBytes(8, common.mustCall()); crypto.pseudoRandomBytes(8); -crypto.pseudoRandomBytes(8, function() {}); -crypto.pbkdf2('password', 'salt', 8, 8, function() {}); +crypto.pseudoRandomBytes(8, common.mustCall()); +crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.mustCall()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-exit-dispose.js nodejs-6.11.4~dfsg/test/parallel/test-domain-exit-dispose.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-exit-dispose.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-exit-dispose.js 2017-10-03 17:11:29.000000000 +0000 @@ -1,5 +1,4 @@ 'use strict'; -require('../common'); const common = require('../common'); const assert = require('assert'); const domain = require('domain'); @@ -22,7 +21,7 @@ function err2() { // this timeout should never be called, since the domain gets // disposed when the error happens. - setTimeout(common.mustCall(() => {}, 0), 1); + setTimeout(common.mustNotCall(), 1); // this function doesn't exist, and throws an error as a result. err3(); // eslint-disable-line no-undef diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain.js nodejs-6.11.4~dfsg/test/parallel/test-domain.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain.js 2017-10-03 17:11:30.000000000 +0000 @@ -60,7 +60,7 @@ break; case - "ENOENT: no such file or directory, open 'stream for nonexistent file'": + "ENOENT: no such file or directory, open 'stream for nonexistent file'": assert.strictEqual(typeof er.errno, 'number'); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'stream for nonexistent file'); @@ -238,7 +238,7 @@ d.add(fst); expectCaught++; -[42, null, , false, function() {}, 'string'].forEach(function(something) { +[42, null, undefined, false, () => {}, 'string'].forEach(function(something) { const d = new domain.Domain(); d.run(function() { process.nextTick(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-nested.js nodejs-6.11.4~dfsg/test/parallel/test-domain-nested.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-nested.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-nested.js 2017-10-03 17:11:29.000000000 +0000 @@ -13,7 +13,7 @@ domain.create().run(function() { domain.create().run(function() { domain.create().on('error', function(e) { - // Don't need to do anything here + // Don't need to do anything here }).run(function() { throw new Error('died'); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-timers.js nodejs-6.11.4~dfsg/test/parallel/test-domain-timers.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-timers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-timers.js 2017-10-03 17:11:30.000000000 +0000 @@ -3,8 +3,6 @@ const domain = require('domain'); const assert = require('assert'); -let timeout; - const timeoutd = domain.create(); timeoutd.on('error', common.mustCall(function(e) { @@ -32,4 +30,4 @@ }); }); -timeout = setTimeout(function() {}, 10 * 1000); +const timeout = setTimeout(common.mustNotCall(), 10 * 1000); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-top-level-error-handler-throw.js nodejs-6.11.4~dfsg/test/parallel/test-domain-top-level-error-handler-throw.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-top-level-error-handler-throw.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-top-level-error-handler-throw.js 2017-10-03 17:11:30.000000000 +0000 @@ -37,11 +37,8 @@ }); child.on('close', function onChildClosed() { - assert.notStrictEqual( - stderrOutput.indexOf(domainErrHandlerExMessage), - -1 - ); - assert.strictEqual(stderrOutput.indexOf(internalExMessage), -1); + assert(stderrOutput.includes(domainErrHandlerExMessage)); + assert.strictEqual(stderrOutput.includes(internalExMessage), false); }); child.on('exit', function onChildExited(exitCode, signal) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-domain-uncaught-exception.js nodejs-6.11.4~dfsg/test/parallel/test-domain-uncaught-exception.js --- nodejs-6.11.2~dfsg/test/parallel/test-domain-uncaught-exception.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-domain-uncaught-exception.js 2017-10-03 17:11:30.000000000 +0000 @@ -185,14 +185,14 @@ if (test.messagesReceived === undefined || test.messagesReceived.indexOf(expectedMessage) === -1) assert(false, `test ${test.fn.name} should have sent message: ${ - expectedMessage} but didn't`); + expectedMessage} but didn't`); }); if (test.messagesReceived) { test.messagesReceived.forEach(function(receivedMessage) { - if (test.expectedMessages.indexOf(receivedMessage) === -1) { + if (!test.expectedMessages.includes(receivedMessage)) { assert(false, `test ${test.fn.name} should not have sent message: ${ - receivedMessage} but did`); + receivedMessage} but did`); } }); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-dsa-fips-invalid-key.js nodejs-6.11.4~dfsg/test/parallel/test-dsa-fips-invalid-key.js --- nodejs-6.11.2~dfsg/test/parallel/test-dsa-fips-invalid-key.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-dsa-fips-invalid-key.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasFipsCrypto) { +if (!common.hasFipsCrypto) common.skip('node compiled without FIPS OpenSSL.'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-env-var-no-warnings.js nodejs-6.11.4~dfsg/test/parallel/test-env-var-no-warnings.js --- nodejs-6.11.2~dfsg/test/parallel/test-env-var-no-warnings.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-env-var-no-warnings.js 2017-10-03 17:11:30.000000000 +0000 @@ -29,7 +29,7 @@ test({ NODE_NO_WARNINGS: false }); test({ NODE_NO_WARNINGS: {} }); test({ NODE_NO_WARNINGS: [] }); - test({ NODE_NO_WARNINGS: function() {} }); + test({ NODE_NO_WARNINGS: () => {} }); test({ NODE_NO_WARNINGS: 0 }); test({ NODE_NO_WARNINGS: -1 }); test({ NODE_NO_WARNINGS: '0' }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-check-listener-leaks.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-check-listener-leaks.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-check-listener-leaks.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-check-listener-leaks.js 2017-10-03 17:11:30.000000000 +0000 @@ -7,40 +7,40 @@ // default for (let i = 0; i < 10; i++) { - e.on('default', function() {}); + e.on('default', () => {}); } assert.ok(!e._events['default'].hasOwnProperty('warned')); -e.on('default', function() {}); +e.on('default', () => {}); assert.ok(e._events['default'].warned); // symbol const symbol = Symbol('symbol'); e.setMaxListeners(1); -e.on(symbol, function() {}); +e.on(symbol, () => {}); assert.ok(!e._events[symbol].hasOwnProperty('warned')); -e.on(symbol, function() {}); +e.on(symbol, () => {}); assert.ok(e._events[symbol].hasOwnProperty('warned')); // specific e.setMaxListeners(5); for (let i = 0; i < 5; i++) { - e.on('specific', function() {}); + e.on('specific', () => {}); } assert.ok(!e._events['specific'].hasOwnProperty('warned')); -e.on('specific', function() {}); +e.on('specific', () => {}); assert.ok(e._events['specific'].warned); // only one e.setMaxListeners(1); -e.on('only one', function() {}); +e.on('only one', () => {}); assert.ok(!e._events['only one'].hasOwnProperty('warned')); -e.on('only one', function() {}); +e.on('only one', () => {}); assert.ok(e._events['only one'].hasOwnProperty('warned')); // unlimited e.setMaxListeners(0); for (let i = 0; i < 1000; i++) { - e.on('unlimited', function() {}); + e.on('unlimited', () => {}); } assert.ok(!e._events['unlimited'].hasOwnProperty('warned')); @@ -49,26 +49,26 @@ e = new events.EventEmitter(); for (let i = 0; i < 42; ++i) { - e.on('fortytwo', function() {}); + e.on('fortytwo', () => {}); } assert.ok(!e._events['fortytwo'].hasOwnProperty('warned')); -e.on('fortytwo', function() {}); +e.on('fortytwo', () => {}); assert.ok(e._events['fortytwo'].hasOwnProperty('warned')); delete e._events['fortytwo'].warned; events.EventEmitter.defaultMaxListeners = 44; -e.on('fortytwo', function() {}); +e.on('fortytwo', () => {}); assert.ok(!e._events['fortytwo'].hasOwnProperty('warned')); -e.on('fortytwo', function() {}); +e.on('fortytwo', () => {}); assert.ok(e._events['fortytwo'].hasOwnProperty('warned')); // but _maxListeners still has precedence over defaultMaxListeners events.EventEmitter.defaultMaxListeners = 42; e = new events.EventEmitter(); e.setMaxListeners(1); -e.on('uno', function() {}); +e.on('uno', () => {}); assert.ok(!e._events['uno'].hasOwnProperty('warned')); -e.on('uno', function() {}); +e.on('uno', () => {}); assert.ok(e._events['uno'].hasOwnProperty('warned')); // chainable diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-get-max-listeners.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-get-max-listeners.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-get-max-listeners.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-get-max-listeners.js 2017-10-03 17:11:30.000000000 +0000 @@ -15,5 +15,5 @@ // https://github.com/nodejs/node/issues/523 - second call should not throw. const recv = {}; -EventEmitter.prototype.on.call(recv, 'event', function() {}); -EventEmitter.prototype.on.call(recv, 'event', function() {}); +EventEmitter.prototype.on.call(recv, 'event', () => {}); +EventEmitter.prototype.on.call(recv, 'event', () => {}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-listener-count.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-listener-count.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-listener-count.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-listener-count.js 2017-10-03 17:11:30.000000000 +0000 @@ -5,11 +5,11 @@ const EventEmitter = require('events'); const emitter = new EventEmitter(); -emitter.on('foo', function() {}); -emitter.on('foo', function() {}); -emitter.on('baz', function() {}); +emitter.on('foo', () => {}); +emitter.on('foo', () => {}); +emitter.on('baz', () => {}); // Allow any type -emitter.on(123, function() {}); +emitter.on(123, () => {}); assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2); assert.strictEqual(emitter.listenerCount('foo'), 2); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners.js 2017-10-03 17:11:30.000000000 +0000 @@ -4,7 +4,7 @@ const events = require('events'); const e = new events.EventEmitter(); -e.on('maxListeners', common.mustCall(function() {})); +e.on('maxListeners', common.mustCall()); // Should not corrupt the 'maxListeners' queue. e.setMaxListeners(42); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-null.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-null.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-null.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-null.js 2017-10-03 17:11:30.000000000 +0000 @@ -18,5 +18,5 @@ assert.ok(warning.message.includes('2 null listeners added.')); })); -e.on(null, function() {}); -e.on(null, function() {}); +e.on(null, () => {}); +e.on(null, () => {}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js 2017-10-03 17:11:30.000000000 +0000 @@ -20,5 +20,5 @@ assert.ok(warning.message.includes('2 Symbol(symbol) listeners added.')); })); -e.on(symbol, function() {}); -e.on(symbol, function() {}); +e.on(symbol, () => {}); +e.on(symbol, () => {}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-max-listeners-warning.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-max-listeners-warning.js 2017-10-03 17:11:30.000000000 +0000 @@ -18,6 +18,6 @@ assert.ok(warning.message.includes('2 event-type listeners added.')); })); -e.on('event-type', function() {}); -e.on('event-type', function() {}); // Trigger warning. -e.on('event-type', function() {}); // Verify that warning is emitted only once. +e.on('event-type', () => {}); +e.on('event-type', () => {}); // Trigger warning. +e.on('event-type', () => {}); // Verify that warning is emitted only once. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-once.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-once.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-once.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-once.js 2017-10-03 17:11:30.000000000 +0000 @@ -24,7 +24,7 @@ e.emit('e'); })); -e.once('e', common.mustCall(function() {})); +e.once('e', common.mustCall()); e.emit('e'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-remove-all-listeners.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-remove-all-listeners.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-remove-all-listeners.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-remove-all-listeners.js 2017-10-03 17:11:30.000000000 +0000 @@ -70,9 +70,9 @@ ee.on('removeListener', function(name, listener) { assert.strictEqual(expectLength--, this.listeners('baz').length); }); - ee.on('baz', function() {}); - ee.on('baz', function() {}); - ee.on('baz', function() {}); + ee.on('baz', () => {}); + ee.on('baz', () => {}); + ee.on('baz', () => {}); assert.strictEqual(ee.listeners('baz').length, expectLength + 1); ee.removeAllListeners('baz'); assert.strictEqual(ee.listeners('baz').length, 0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-subclass.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-subclass.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-subclass.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-subclass.js 2017-10-03 17:11:30.000000000 +0000 @@ -13,7 +13,7 @@ EventEmitter.call(this); } -const myee = new MyEE(common.mustCall(function() {})); +const myee = new MyEE(common.mustCall()); util.inherits(ErrorEE, EventEmitter); @@ -41,6 +41,6 @@ const ee1 = new MyEE2(); const ee2 = new MyEE2(); -ee1.on('x', function() {}); +ee1.on('x', () => {}); assert.strictEqual(ee2.listenerCount('x'), 0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-symbols.js nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-symbols.js --- nodejs-6.11.2~dfsg/test/parallel/test-event-emitter-symbols.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-event-emitter-symbols.js 2017-10-03 17:11:30.000000000 +0000 @@ -6,7 +6,7 @@ const ee = new EventEmitter(); const foo = Symbol('foo'); -const listener = common.mustCall(function() {}); +const listener = common.mustCall(); ee.on(foo, listener); assert.deepStrictEqual(ee.listeners(foo), [listener]); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-file-write-stream3.js nodejs-6.11.4~dfsg/test/parallel/test-file-write-stream3.js --- nodejs-6.11.2~dfsg/test/parallel/test-file-write-stream3.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-file-write-stream3.js 2017-10-03 17:11:30.000000000 +0000 @@ -156,10 +156,10 @@ const run_test_4 = common.mustCall(function() { // Error: start must be >= zero assert.throws( - function() { - fs.createWriteStream(filepath, { start: -5, flags: 'r+' }); - }, - /"start" must be/ + function() { + fs.createWriteStream(filepath, { start: -5, flags: 'r+' }); + }, + /"start" must be/ ); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-force-repl.js nodejs-6.11.4~dfsg/test/parallel/test-force-repl.js --- nodejs-6.11.2~dfsg/test/parallel/test-force-repl.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-force-repl.js 2017-10-03 17:11:30.000000000 +0000 @@ -3,16 +3,13 @@ const assert = require('assert'); const spawn = require('child_process').spawn; -// spawn a node child process in "interactive" mode (force the repl) +// Spawn a node child process in interactive mode (enabling the REPL) and +// confirm the '> ' prompt is included in the output. const cp = spawn(process.execPath, ['-i']); -// give node + the repl 5 seconds to start -const timeoutId = setTimeout(common.mustNotCall(), - common.platformTimeout(5000)); cp.stdout.setEncoding('utf8'); cp.stdout.once('data', common.mustCall(function(b) { - clearTimeout(timeoutId); assert.strictEqual(b, '> '); cp.kill(); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-buffertype-writesync.js nodejs-6.11.4~dfsg/test/parallel/test-fs-buffertype-writesync.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-buffertype-writesync.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-buffertype-writesync.js 2017-10-03 17:11:30.000000000 +0000 @@ -9,7 +9,7 @@ const path = require('path'); const filePath = path.join(common.tmpDir, 'test_buffer_type'); -const v = [true, false, 0, 1, Infinity, common.noop, {}, [], undefined, null]; +const v = [true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null]; common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-chmod.js nodejs-6.11.4~dfsg/test/parallel/test-fs-chmod.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-chmod.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-chmod.js 2017-10-03 17:11:30.000000000 +0000 @@ -50,14 +50,17 @@ mode_sync = 0o644; } -const file1 = path.join(common.fixturesDir, 'a.js'); -const file2 = path.join(common.fixturesDir, 'a1.js'); +common.refreshTmpDir(); + +const file1 = path.join(common.tmpDir, 'a.js'); +const file2 = path.join(common.tmpDir, 'a1.js'); + +// Create file1. +fs.closeSync(fs.openSync(file1, 'w')); fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => { assert.ifError(err); - console.log(fs.statSync(file1).mode); - if (common.isWindows) { assert.ok((fs.statSync(file1).mode & 0o777) & mode_async); } else { @@ -72,14 +75,12 @@ } })); -fs.open(file2, 'a', common.mustCall((err, fd) => { +fs.open(file2, 'w', common.mustCall((err, fd) => { assert.ifError(err); fs.fchmod(fd, mode_async.toString(8), common.mustCall((err) => { assert.ifError(err); - console.log(fs.fstatSync(fd).mode); - if (common.isWindows) { assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async); } else { @@ -101,13 +102,11 @@ if (fs.lchmod) { const link = path.join(common.tmpDir, 'symbolic-link'); - common.refreshTmpDir(); fs.symlinkSync(file2, link); fs.lchmod(link, mode_async, common.mustCall((err) => { assert.ifError(err); - console.log(fs.lstatSync(link).mode); assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777); fs.lchmodSync(link, mode_sync); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-long-path.js nodejs-6.11.4~dfsg/test/parallel/test-fs-long-path.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-long-path.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-long-path.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); const fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x')); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-makeStatsCallback.js nodejs-6.11.4~dfsg/test/parallel/test-fs-makeStatsCallback.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-makeStatsCallback.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-makeStatsCallback.js 2017-10-03 17:11:30.000000000 +0000 @@ -13,7 +13,7 @@ } // Verify the case where a callback function is provided -assert.doesNotThrow(testMakeStatsCallback(common.noop)); +assert.doesNotThrow(testMakeStatsCallback(common.mustCall())); // Passing undefined/nothing calls rethrow() internally assert.doesNotThrow(testMakeStatsCallback()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-mkdir.js nodejs-6.11.4~dfsg/test/parallel/test-fs-mkdir.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-mkdir.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-mkdir.js 2017-10-03 17:11:30.000000000 +0000 @@ -56,4 +56,4 @@ // Keep the event loop alive so the async mkdir() requests // have a chance to run (since they don't ref the event loop). -process.nextTick(function() {}); +process.nextTick(() => {}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-mkdtemp.js nodejs-6.11.4~dfsg/test/parallel/test-fs-mkdtemp.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-mkdtemp.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-mkdtemp.js 2017-10-03 17:11:30.000000000 +0000 @@ -4,7 +4,6 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const Buffer = require('buffer').Buffer; common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-read-buffer-tostring-fail.js nodejs-6.11.4~dfsg/test/parallel/test-fs-read-buffer-tostring-fail.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-read-buffer-tostring-fail.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-read-buffer-tostring-fail.js 2017-10-03 17:11:30.000000000 +0000 @@ -5,7 +5,6 @@ if (!common.enoughTestMem) { const skipMessage = 'intensive toString tests due to memory confinements'; common.skip(skipMessage); - return; } const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readdir-ucs2.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readdir-ucs2.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readdir-ucs2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readdir-ucs2.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,31 +1,31 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const path = require('path'); const fs = require('fs'); const assert = require('assert'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - common.refreshTmpDir(); const filename = '\uD83D\uDC04'; const root = Buffer.from(`${common.tmpDir}${path.sep}`); const filebuff = Buffer.from(filename, 'ucs2'); const fullpath = Buffer.concat([root, filebuff]); -fs.closeSync(fs.openSync(fullpath, 'w+')); +try { + fs.closeSync(fs.openSync(fullpath, 'w+')); +} catch (e) { + if (e.code === 'EINVAL') + common.skip('test requires filesystem that supports UCS2'); + throw e; +} -fs.readdir(common.tmpDir, 'ucs2', (err, list) => { - if (err) throw err; +fs.readdir(common.tmpDir, 'ucs2', common.mustCall((err, list) => { + assert.ifError(err); assert.strictEqual(1, list.length); const fn = list[0]; assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2')); assert.strictEqual(fn, filename); -}); - -process.on('exit', () => { - fs.unlinkSync(fullpath); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-read-file-assert-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-fs-read-file-assert-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-read-file-assert-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-read-file-assert-encoding.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const fs = require('fs'); @@ -8,6 +8,6 @@ const filename = 'bar.txt'; assert.throws( - fs.readFile.bind(fs, filename, { encoding }, () => {}), - new RegExp(`Error: Unknown encoding: ${encoding}$`) + fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()), + new RegExp(`^Error: Unknown encoding: ${encoding}$`) ); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-error.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-error.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,20 +1,18 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const exec = require('child_process').exec; -const path = require('path'); - // `fs.readFile('/')` does not fail on FreeBSD, because you can open and read // the directory there. -if (common.isFreeBSD) { +if (common.isFreeBSD) common.skip('platform not supported.'); - return; -} + +const assert = require('assert'); +const exec = require('child_process').exec; +const path = require('path'); function test(env, cb) { const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js'); const execPath = `"${process.execPath}" "${filename}"`; - const options = { env: Object.assign(process.env, env) }; + const options = { env: Object.assign({}, process.env, env) }; exec(execPath, options, common.mustCall((err, stdout, stderr) => { assert(err); assert.strictEqual(stdout, ''); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-pipe.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); const fs = require('fs'); const dataExpected = fs.readFileSync(__filename, 'utf8'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-pipe-large.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-pipe-large.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-pipe-large.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-pipe-large.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-read-file-sync-hostname.js nodejs-6.11.4~dfsg/test/parallel/test-fs-read-file-sync-hostname.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-read-file-sync-hostname.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-read-file-sync-hostname.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const assert = require('assert'); const fs = require('fs'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - // Test to make sure reading a file under the /proc directory works. See: // https://groups.google.com/forum/#!topic/nodejs-dev/rxZ_RoH1Gn0 const hostname = fs.readFileSync('/proc/sys/kernel/hostname'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readfilesync-pipe-large.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readfilesync-pipe-large.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readfilesync-pipe-large.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readfilesync-pipe-large.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-unlink.js nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-unlink.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-readfile-unlink.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-readfile-unlink.js 2017-10-03 17:11:30.000000000 +0000 @@ -3,16 +3,11 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink'); -const fileName = path.resolve(dirName, 'test.bin'); +const fileName = path.resolve(common.tmpDir, 'test.bin'); + const buf = Buffer.alloc(512 * 1024, 42); -try { - fs.mkdirSync(dirName); -} catch (e) { - // Ignore if the directory already exists. - if (e.code !== 'EEXIST') throw e; -} +common.refreshTmpDir(); fs.writeFileSync(fileName, buf); @@ -21,6 +16,7 @@ assert.strictEqual(data.length, buf.length); assert.strictEqual(buf[0], 42); + // Unlink should not throw. This is part of the test. It used to throw on + // Windows due to a bug. fs.unlinkSync(fileName); - fs.rmdirSync(dirName); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-read-stream-inherit.js nodejs-6.11.4~dfsg/test/parallel/test-fs-read-stream-inherit.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-read-stream-inherit.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-read-stream-inherit.js 2017-10-03 17:11:30.000000000 +0000 @@ -39,7 +39,7 @@ }); - file.on('end', common.mustCall(function() {})); + file.on('end', common.mustCall()); file.on('close', common.mustCall(function() { @@ -139,7 +139,7 @@ let file7 = fs.createReadStream(rangeFile, Object.create({autoClose: false })); assert.strictEqual(file7.autoClose, false); - file7.on('data', function() {}); + file7.on('data', () => {}); file7.on('end', common.mustCall(function() { process.nextTick(common.mustCall(function() { assert(!file7.closed); @@ -169,8 +169,8 @@ { const options = Object.create({fd: 13337, autoClose: false}); const file8 = fs.createReadStream(null, options); - file8.on('data', function() {}); - file8.on('error', common.mustCall(function() {})); + file8.on('data', () => {}); + file8.on('error', common.mustCall()); process.on('exit', function() { assert(!file8.closed); assert(!file8.destroyed); @@ -181,8 +181,8 @@ // Make sure stream is destroyed when file does not exist. { const file9 = fs.createReadStream('/path/to/file/that/does/not/exist'); - file9.on('data', function() {}); - file9.on('error', common.mustCall(function() {})); + file9.on('data', () => {}); + file9.on('error', common.mustCall()); process.on('exit', function() { assert(!file9.closed); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-read-stream.js nodejs-6.11.4~dfsg/test/parallel/test-fs-read-stream.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-read-stream.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-read-stream.js 2017-10-03 17:11:30.000000000 +0000 @@ -138,7 +138,7 @@ pauseRes.resume(); let file7 = fs.createReadStream(rangeFile, {autoClose: false }); -file7.on('data', function() {}); +file7.on('data', () => {}); file7.on('end', function() { process.nextTick(function() { assert(!file7.closed); @@ -161,13 +161,13 @@ // Just to make sure autoClose won't close the stream because of error. const file8 = fs.createReadStream(null, {fd: 13337, autoClose: false }); -file8.on('data', function() {}); -file8.on('error', common.mustCall(function() {})); +file8.on('data', () => {}); +file8.on('error', common.mustCall()); // Make sure stream is destroyed when file does not exist. const file9 = fs.createReadStream('/path/to/file/that/does/not/exist'); -file9.on('data', function() {}); -file9.on('error', common.mustCall(function() {})); +file9.on('data', () => {}); +file9.on('error', common.mustCall()); process.on('exit', function() { assert(file7.closed); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-realpath.js nodejs-6.11.4~dfsg/test/parallel/test-fs-realpath.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-realpath.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-realpath.js 2017-10-03 17:11:30.000000000 +0000 @@ -81,7 +81,7 @@ function test_simple_relative_symlink(callback) { console.log('test_simple_relative_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = `${tmpDir}/symlink`; @@ -130,7 +130,7 @@ function test_deep_relative_file_symlink(callback) { console.log('test_deep_relative_file_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -160,7 +160,7 @@ function test_deep_relative_dir_symlink(callback) { console.log('test_deep_relative_dir_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const expected = path.join(common.fixturesDir, 'cycles', 'folder'); @@ -188,7 +188,7 @@ function test_cyclic_link_protection(callback) { console.log('test_cyclic_link_protection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = path.join(tmpDir, '/cycles/realpath-3a'); @@ -215,7 +215,7 @@ function test_cyclic_link_overprotection(callback) { console.log('test_cyclic_link_overprotection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const cycles = `${tmpDir}/cycles`; @@ -236,7 +236,7 @@ function test_relative_input_cwd(callback) { console.log('test_relative_input_cwd'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -275,7 +275,7 @@ if (common.isWindows) { // This one is a mix of files and directories, and it's quite tricky // to get the file/dir links sorted out correctly. - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -362,7 +362,7 @@ function test_up_multiple(cb) { console.error('test_up_multiple'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } function cleanup() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-realpath-on-substed-drive.js nodejs-6.11.4~dfsg/test/parallel/test-fs-realpath-on-substed-drive.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-realpath-on-substed-drive.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-realpath-on-substed-drive.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('Test for Windows only'); + const assert = require('assert'); const fs = require('fs'); const spawnSync = require('child_process').spawnSync; -if (!common.isWindows) { - common.skip('Test for Windows only'); - return; -} let result; // create a subst drive @@ -21,10 +20,8 @@ if (result.status === 0) break; } -if (i === driveLetters.length) { +if (i === driveLetters.length) common.skip('Cannot create subst drive'); - return; -} // schedule cleanup (and check if all callbacks where called) process.on('exit', function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-symlink.js nodejs-6.11.4~dfsg/test/parallel/test-fs-symlink.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-symlink.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-symlink.js 2017-10-03 17:11:30.000000000 +0000 @@ -13,7 +13,7 @@ // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { - common.skip('insufficient privileges'); + common.printSkipMessage('insufficient privileges'); } }); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-watch-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-fs-watch-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-watch-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-watch-encoding.js 2017-10-03 17:11:30.000000000 +0000 @@ -11,17 +11,16 @@ // On SmartOS, the watch events fire but the filename is null. const common = require('../common'); -const fs = require('fs'); -const path = require('path'); // fs-watch on folders have limited capability in AIX. // The testcase makes use of folder watching, and causes // hang. This behavior is documented. Skip this for AIX. -if (common.isAix) { +if (common.isAix) common.skip('folder watch capability is limited in AIX.'); - return; -} + +const fs = require('fs'); +const path = require('path'); common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-watchfile.js nodejs-6.11.4~dfsg/test/parallel/test-fs-watchfile.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-watchfile.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-watchfile.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,39 +1,39 @@ 'use strict'; - const common = require('../common'); + +const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const assert = require('assert'); // Basic usage tests. assert.throws(function() { fs.watchFile('./some-file'); -}, /"watchFile\(\)" requires a listener function/); +}, /^Error: "watchFile\(\)" requires a listener function$/); assert.throws(function() { fs.watchFile('./another-file', {}, 'bad listener'); -}, /"watchFile\(\)" requires a listener function/); +}, /^Error: "watchFile\(\)" requires a listener function$/); assert.throws(function() { - fs.watchFile(new Object(), function() {}); + fs.watchFile(new Object(), common.mustNotCall()); }, /Path must be a string/); const enoentFile = path.join(common.tmpDir, 'non-existent-file'); const expectedStatObject = new fs.Stats( - 0, // dev - 0, // mode - 0, // nlink - 0, // uid - 0, // gid - 0, // rdev - common.isWindows ? undefined : 0, // blksize - 0, // ino - 0, // size - common.isWindows ? undefined : 0, // blocks - Date.UTC(1970, 0, 1, 0, 0, 0), // atime - Date.UTC(1970, 0, 1, 0, 0, 0), // mtime - Date.UTC(1970, 0, 1, 0, 0, 0), // ctime - Date.UTC(1970, 0, 1, 0, 0, 0) // birthtime + 0, // dev + 0, // mode + 0, // nlink + 0, // uid + 0, // gid + 0, // rdev + common.isWindows ? undefined : 0, // blksize + 0, // ino + 0, // size + common.isWindows ? undefined : 0, // blocks + Date.UTC(1970, 0, 1, 0, 0, 0), // atime + Date.UTC(1970, 0, 1, 0, 0, 0), // mtime + Date.UTC(1970, 0, 1, 0, 0, 0), // ctime + Date.UTC(1970, 0, 1, 0, 0, 0) // birthtime ); common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-watch-recursive.js nodejs-6.11.4~dfsg/test/parallel/test-fs-watch-recursive.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-watch-recursive.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-watch-recursive.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (!(common.isOSX || common.isWindows)) { +if (!(common.isOSX || common.isWindows)) common.skip('recursive option is darwin/windows specific'); - return; -} const assert = require('assert'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-write-file-invalid-path.js nodejs-6.11.4~dfsg/test/parallel/test-fs-write-file-invalid-path.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-write-file-invalid-path.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-write-file-invalid-path.js 2017-10-03 17:11:30.000000000 +0000 @@ -0,0 +1,45 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); + +if (!common.isWindows) + common.skip('This test is for Windows only.'); + +common.refreshTmpDir(); + +const DATA_VALUE = 'hello'; + +// Refs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx +// Ignore '/', '\\' and ':' +const RESERVED_CHARACTERS = '<>"|?*'; + +[...RESERVED_CHARACTERS].forEach((ch) => { + const pathname = path.join(common.tmpDir, `somefile_${ch}`); + assert.throws( + () => { + fs.writeFileSync(pathname, DATA_VALUE); + }, + /^Error: ENOENT: no such file or directory, open '.*'$/, + `failed with '${ch}'`); +}); + +// Test for ':' (NTFS data streams). +// Refs: https://msdn.microsoft.com/en-us/library/windows/desktop/bb540537.aspx +const pathname = path.join(common.tmpDir, 'foo:bar'); +fs.writeFileSync(pathname, DATA_VALUE); + +let content = ''; +const fileDataStream = fs.createReadStream(pathname, { + encoding: 'utf8' +}); + +fileDataStream.on('data', (data) => { + content += data; +}); + +fileDataStream.on('end', common.mustCall(() => { + assert.strictEqual(content, DATA_VALUE); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-write.js nodejs-6.11.4~dfsg/test/parallel/test-fs-write.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-write.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-write.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert'); const path = require('path'); -const Buffer = require('buffer').Buffer; const fs = require('fs'); const fn = path.join(common.tmpDir, 'write.txt'); const fn2 = path.join(common.tmpDir, 'write2.txt'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-fs-write-string-coerce.js nodejs-6.11.4~dfsg/test/parallel/test-fs-write-string-coerce.js --- nodejs-6.11.2~dfsg/test/parallel/test-fs-write-string-coerce.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-fs-write-string-coerce.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,7 +2,6 @@ const common = require('../common'); const assert = require('assert'); const path = require('path'); -const Buffer = require('buffer').Buffer; const fs = require('fs'); common.refreshTmpDir(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-close-abort.js nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-close-abort.js --- nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-close-abort.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-close-abort.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -process.on('uncaughtException', common.mustCall(function() {}, 2)); +process.on('uncaughtException', common.mustCall(() => {}, 2)); setTimeout(function() { process.nextTick(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-isrefed.js nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-isrefed.js --- nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-isrefed.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-isrefed.js 2017-10-03 17:11:30.000000000 +0000 @@ -39,7 +39,7 @@ sock4.ref(); assert(sock4._handle.hasRef(), true); sock4._handle.close( - common.mustCall(() => assert(sock4._handle.hasRef(), false))); + common.mustCall(() => assert(sock4._handle.hasRef(), false))); const sock6 = dgram.createSocket('udp6'); assert(Object.getPrototypeOf(sock6._handle).hasOwnProperty('hasRef'), true); @@ -49,7 +49,7 @@ sock6.ref(); assert(sock6._handle.hasRef(), true); sock6._handle.close( - common.mustCall(() => assert(sock6._handle.hasRef(), false))); + common.mustCall(() => assert(sock6._handle.hasRef(), false))); } @@ -83,7 +83,7 @@ assert(server._handle.hasRef(), true); assert(server._unref, false); server._handle.close( - common.mustCall(() => assert(server._handle.hasRef(), false))); + common.mustCall(() => assert(server._handle.hasRef(), false))); } @@ -97,5 +97,5 @@ timer.ref(); assert(timer._handle.hasRef(), true); timer._handle.close( - common.mustCall(() => assert(timer._handle.hasRef(), false))); + common.mustCall(() => assert(timer._handle.hasRef(), false))); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-isrefed-tty.js nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-isrefed-tty.js --- nodejs-6.11.2~dfsg/test/parallel/test-handle-wrap-isrefed-tty.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-handle-wrap-isrefed-tty.js 2017-10-03 17:11:30.000000000 +0000 @@ -20,7 +20,7 @@ tty.unref(); assert(tty._handle.hasRef(), false); tty._handle.close( - common.mustCall(() => assert(tty._handle.hasRef(), false))); + common.mustCall(() => assert(tty._handle.hasRef(), false))); return; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-abort-client.js nodejs-6.11.4~dfsg/test/parallel/test-http-abort-client.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-abort-client.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-abort-client.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,42 +2,27 @@ const common = require('../common'); const http = require('http'); -const server = http.Server(function(req, res) { - console.log('Server accepted request.'); +let serverRes; +const server = http.Server((req, res) => { + serverRes = res; res.writeHead(200); res.write('Part of my res.'); res.destroy(); }); -server.listen(0, common.mustCall(function() { +server.listen(0, common.mustCall(() => { http.get({ - port: this.address().port, + port: server.address().port, headers: { connection: 'keep-alive' } - }, common.mustCall(function(res) { + }, common.mustCall((res) => { server.close(); + serverRes.destroy(); - console.log(`Got res: ${res.statusCode}`); - console.dir(res.headers); - - res.on('data', function(chunk) { - console.log(`Read ${chunk.length} bytes`); - console.log(' chunk=%j', chunk.toString()); - }); - - res.on('end', function() { - console.log('Response ended.'); - }); - - res.on('aborted', function() { - console.log('Response aborted.'); - }); - - res.socket.on('close', function() { - console.log('socket closed, but not res'); - }); - - // it would be nice if this worked: - res.on('close', common.mustCall(function() {})); + res.resume(); + res.on('end', common.mustCall()); + res.on('aborted', common.mustCall()); + res.on('close', common.mustCall()); + res.socket.on('close', common.mustCall()); })); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-abort-queued.js nodejs-6.11.4~dfsg/test/parallel/test-http-abort-queued.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-abort-queued.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-abort-queued.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,11 +1,11 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); let complete; -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { // We should not see the queued /thatotherone request within the server // as it should be aborted before it is sent. assert.strictEqual(req.url, '/'); @@ -19,10 +19,8 @@ }); -server.listen(0, function() { - console.log('listen', server.address().port); - - const agent = new http.Agent({maxSockets: 1}); +server.listen(0, () => { + const agent = new http.Agent({ maxSockets: 1 }); assert.strictEqual(Object.keys(agent.sockets).length, 0); const options = { @@ -34,7 +32,7 @@ }; const req1 = http.request(options); - req1.on('response', function(res1) { + req1.on('response', (res1) => { assert.strictEqual(Object.keys(agent.sockets).length, 1); assert.strictEqual(Object.keys(agent.requests).length, 0); @@ -48,7 +46,9 @@ assert.strictEqual(Object.keys(agent.sockets).length, 1); assert.strictEqual(Object.keys(agent.requests).length, 1); - req2.on('error', function(err) { + // TODO(jasnell): This event does not appear to currently be triggered. + // is this handler actually required? + req2.on('error', (err) => { // This is expected in response to our explicit abort call assert.strictEqual(err.code, 'ECONNRESET'); }); @@ -59,25 +59,16 @@ assert.strictEqual(Object.keys(agent.sockets).length, 1); assert.strictEqual(Object.keys(agent.requests).length, 1); - console.log(`Got res: ${res1.statusCode}`); - console.dir(res1.headers); - - res1.on('data', function(chunk) { - console.log(`Read ${chunk.length} bytes`); - console.log(' chunk=%j', chunk.toString()); - complete(); - }); + res1.on('data', (chunk) => complete()); - res1.on('end', function() { - console.log('Response ended.'); - - setTimeout(function() { + res1.on('end', common.mustCall(() => { + setTimeout(common.mustCall(() => { assert.strictEqual(Object.keys(agent.sockets).length, 0); assert.strictEqual(Object.keys(agent.requests).length, 0); server.close(); - }, 100); - }); + }), 100); + })); }); req1.end(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-after-connect.js nodejs-6.11.4~dfsg/test/parallel/test-http-after-connect.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-after-connect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-after-connect.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,61 +2,51 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); -let clientResponses = 0; - -const server = http.createServer(common.mustCall(function(req, res) { - console.error('Server got GET request'); +const server = http.createServer(common.mustCall((req, res) => { req.resume(); res.writeHead(200); res.write(''); - setTimeout(function() { - res.end(req.url); - }, 50); + setTimeout(() => res.end(req.url), 50); }, 2)); -server.on('connect', common.mustCall(function(req, socket) { - console.error('Server got CONNECT request'); + +const countdown = new Countdown(2, common.mustCall(() => server.close())); + +server.on('connect', common.mustCall((req, socket) => { socket.write('HTTP/1.1 200 Connection established\r\n\r\n'); socket.resume(); - socket.on('end', function() { - socket.end(); - }); + socket.on('end', () => socket.end()); })); -server.listen(0, function() { + +server.listen(0, common.mustCall(() => { const req = http.request({ - port: this.address().port, + port: server.address().port, method: 'CONNECT', path: 'google.com:80' }); - req.on('connect', common.mustCall(function(res, socket) { - console.error('Client got CONNECT response'); + req.on('connect', common.mustCall((res, socket) => { socket.end(); - socket.on('end', function() { + socket.on('end', common.mustCall(() => { doRequest(0); doRequest(1); - }); + })); socket.resume(); })); req.end(); -}); +})); function doRequest(i) { http.get({ port: server.address().port, path: `/request${i}` - }, common.mustCall(function(res) { - console.error('Client got GET response'); + }, common.mustCall((res) => { let data = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { - data += chunk; - }); - res.on('end', function() { + res.on('data', (chunk) => data += chunk); + res.on('end', common.mustCall(() => { assert.strictEqual(data, `/request${i}`); - ++clientResponses; - if (clientResponses === 2) { - server.close(); - } - }); + countdown.dec(); + })); })); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-destroyed-socket.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-destroyed-socket.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-destroyed-socket.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-destroyed-socket.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,36 +1,31 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); -const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); +const server = http.createServer(common.mustCall((req, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); -}).listen(0, function() { - const agent = new http.Agent({maxSockets: 1}); +}, 2)).listen(0, common.mustCall(() => { + const agent = new http.Agent({ maxSockets: 1 }); - agent.on('free', function(socket, host, port) { - console.log('freeing socket. destroyed? ', socket.destroyed); - }); + agent.on('free', common.mustCall(3)); const requestOptions = { agent: agent, host: 'localhost', - port: this.address().port, + port: server.address().port, path: '/' }; - const request1 = http.get(requestOptions, function(response) { + const request1 = http.get(requestOptions, common.mustCall((response) => { // assert request2 is queued in the agent const key = agent.getName(requestOptions); assert.strictEqual(agent.requests[key].length, 1); - console.log('got response1'); - request1.socket.on('close', function() { - console.log('request1 socket closed'); - }); - response.pipe(process.stdout); - response.on('end', function() { - console.log('response1 done'); + request1.socket.on('close', common.mustCall()); + response.resume(); + response.on('end', common.mustCall(() => { ///////////////////////////////// // // THE IMPORTANT PART @@ -44,43 +39,29 @@ // is triggered. request1.socket.destroy(); - response.once('close', function() { + // TODO(jasnell): This close event does not appear to be triggered. + // is it necessary? + response.once('close', () => { // assert request2 was removed from the queue assert(!agent.requests[key]); - console.log("waiting for request2.onSocket's nextTick"); - process.nextTick(function() { + process.nextTick(() => { // assert that the same socket was not assigned to request2, // since it was destroyed. assert.notStrictEqual(request1.socket, request2.socket); assert(!request2.socket.destroyed, 'the socket is destroyed'); }); }); - }); - }); + })); + })); - let request2 = http.get(requestOptions, function(response) { + const request2 = http.get(requestOptions, common.mustCall((response) => { assert(!request2.socket.destroyed); assert(request1.socket.destroyed); // assert not reusing the same socket, since it was destroyed. assert.notStrictEqual(request1.socket, request2.socket); - console.log('got response2'); - let gotClose = false; - let gotResponseEnd = false; - request2.socket.on('close', function() { - console.log('request2 socket closed'); - gotClose = true; - done(); - }); - response.pipe(process.stdout); - response.on('end', function() { - console.log('response2 done'); - gotResponseEnd = true; - done(); - }); - - function done() { - if (gotResponseEnd && gotClose) - server.close(); - } - }); -}); + const countdown = new Countdown(2, common.mustCall(() => server.close())); + request2.socket.on('close', common.mustCall(() => countdown.dec())); + response.on('end', common.mustCall(() => countdown.dec())); + response.resume(); + })); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-error-on-idle.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-error-on-idle.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-error-on-idle.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-error-on-idle.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,32 +1,31 @@ 'use strict'; -require('../common'); + +const common = require('../common'); const assert = require('assert'); const http = require('http'); const Agent = http.Agent; -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end('hello world'); -}); +}, 2)); -server.listen(0, function() { - const agent = new Agent({ - keepAlive: true, - }); +server.listen(0, () => { + const agent = new Agent({ keepAlive: true }); const requestParams = { host: 'localhost', - port: this.address().port, + port: server.address().port, agent: agent, path: '/' }; const socketKey = agent.getName(requestParams); - get(function(res) { + http.get(requestParams, common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); res.resume(); - res.on('end', function() { - process.nextTick(function() { + res.on('end', common.mustCall(() => { + process.nextTick(common.mustCall(() => { const freeSockets = agent.freeSockets[socketKey]; assert.strictEqual(freeSockets.length, 1, `expect a free socket on ${socketKey}`); @@ -35,14 +34,10 @@ const freeSocket = freeSockets[0]; freeSocket.emit('error', new Error('ECONNRESET: test')); - get(done); - }); - }); - }); - - function get(callback) { - return http.get(requestParams, callback); - } + http.get(requestParams, done); + })); + })); + })); function done() { assert.strictEqual(Object.keys(agent.freeSockets).length, 0, @@ -50,6 +45,5 @@ agent.destroy(); server.close(); - process.exit(0); } }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-false.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-false.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-false.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-false.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,6 +1,5 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); const http = require('http'); // sending `agent: false` when `port: null` is also passed in (i.e. the result @@ -14,20 +13,13 @@ agent: false }; -let good = false; -process.on('exit', function() { - assert(good, 'expected either an "error" or "response" event'); -}); - // we just want an "error" (no local HTTP server on port 80) or "response" // to happen (user happens ot have HTTP server running on port 80). // As long as the process doesn't crash from a C++ assertion then we're good. const req = http.request(opts); -req.on('response', function(res) { - good = true; -}); -req.on('error', function(err) { - // an "error" event is ok, don't crash the process - good = true; -}); + +// Will be called by either the response event or error event, not both +const oneResponse = common.mustCall(); +req.on('response', oneResponse); +req.on('error', oneResponse); req.end(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-keepalive.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-keepalive.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-keepalive.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-keepalive.js 2017-10-03 17:11:30.000000000 +0000 @@ -13,19 +13,17 @@ maxFreeSockets: 5 }); -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { if (req.url === '/error') { res.destroy(); return; } else if (req.url === '/remote_close') { // cache the socket, close it after a short delay const socket = res.connection; - setImmediate(function() { - socket.end(); - }); + setImmediate(common.mustCall(() => socket.end())); } res.end('hello world'); -}); +}, 4)); function get(path, callback) { return http.get({ @@ -44,82 +42,75 @@ function second() { // request second, use the same socket - get('/second', function(res) { + get('/second', common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function() { + res.on('end', common.mustCall(() => { assert.strictEqual(agent.sockets[name].length, 1); assert.strictEqual(agent.freeSockets[name], undefined); - process.nextTick(function() { + process.nextTick(common.mustCall(() => { assert.strictEqual(agent.sockets[name], undefined); assert.strictEqual(agent.freeSockets[name].length, 1); remoteClose(); - }); - }); - }); + })); + })); + })); } function remoteClose() { // mock remote server close the socket - get('/remote_close', function(res) { + get('/remote_close', common.mustCall((res) => { assert.deepStrictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function() { + res.on('end', common.mustCall(() => { assert.strictEqual(agent.sockets[name].length, 1); assert.strictEqual(agent.freeSockets[name], undefined); - process.nextTick(function() { + process.nextTick(common.mustCall(() => { assert.strictEqual(agent.sockets[name], undefined); assert.strictEqual(agent.freeSockets[name].length, 1); // waitting remote server close the socket - setTimeout(function() { + setTimeout(common.mustCall(() => { assert.strictEqual(agent.sockets[name], undefined); assert.strictEqual(agent.freeSockets[name], undefined, 'freeSockets is not empty'); remoteError(); - }, common.platformTimeout(200)); - }); - }); - }); + }), common.platformTimeout(200)); + })); + })); + })); } function remoteError() { // remove server will destroy ths socket - const req = get('/error', function(res) { - throw new Error('should not call this function'); - }); - req.on('error', function(err) { - assert.ok(err); + const req = get('/error', common.mustNotCall()); + req.on('error', common.mustCall((err) => { + assert(err); assert.strictEqual(err.message, 'socket hang up'); assert.strictEqual(agent.sockets[name].length, 1); assert.strictEqual(agent.freeSockets[name], undefined); // Wait socket 'close' event emit - setTimeout(function() { + setTimeout(common.mustCall(() => { assert.strictEqual(agent.sockets[name], undefined); assert.strictEqual(agent.freeSockets[name], undefined); - done(); - }, common.platformTimeout(1)); - }); -} - -function done() { - console.log('http keepalive agent test success.'); - process.exit(0); + server.close(); + }), common.platformTimeout(1)); + })); } -server.listen(0, function() { +server.listen(0, common.mustCall(() => { name = `localhost:${server.address().port}:`; // request first, and keep alive - get('/first', function(res) { + get('/first', common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); res.on('data', checkDataAndSockets); - res.on('end', function() { + res.on('end', common.mustCall(() => { assert.strictEqual(agent.sockets[name].length, 1); assert.strictEqual(agent.freeSockets[name], undefined); - process.nextTick(function() { + process.nextTick(common.mustCall(() => { assert.strictEqual(agent.sockets[name], undefined); assert.strictEqual(agent.freeSockets[name].length, 1); second(); - }); - }); - }); -}); + })); + })); + })); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-maxsockets.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-maxsockets.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-maxsockets.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-maxsockets.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,7 +1,8 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const agent = new http.Agent({ keepAlive: true, @@ -10,9 +11,9 @@ maxFreeSockets: 2 }); -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end('hello world'); -}); +}, 2)); function get(path, callback) { return http.get({ @@ -23,32 +24,25 @@ }, callback); } -let count = 0; -function done() { - if (++count !== 2) { - return; - } +const countdown = new Countdown(2, common.mustCall(() => { const freepool = agent.freeSockets[Object.keys(agent.freeSockets)[0]]; assert.strictEqual(freepool.length, 2, `expect keep 2 free sockets, but got ${freepool.length}`); agent.destroy(); server.close(); +})); + +function dec() { + process.nextTick(() => countdown.dec()); } -server.listen(0, function() { - get('/1', function(res) { - assert.strictEqual(res.statusCode, 200); - res.resume(); - res.on('end', function() { - process.nextTick(done); - }); - }); - - get('/2', function(res) { - assert.strictEqual(res.statusCode, 200); - res.resume(); - res.on('end', function() { - process.nextTick(done); - }); - }); -}); +function onGet(res) { + assert.strictEqual(res.statusCode, 200); + res.resume(); + res.on('end', common.mustCall(dec)); +} + +server.listen(0, common.mustCall(() => { + get('/1', common.mustCall(onGet)); + get('/2', common.mustCall(onGet)); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-maxsockets-regress-4050.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-maxsockets-regress-4050.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-maxsockets-regress-4050.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-maxsockets-regress-4050.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,7 +1,8 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const MAX_SOCKETS = 2; @@ -12,9 +13,11 @@ maxFreeSockets: 2 }); -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end('hello world'); -}); +}, 6)); + +const countdown = new Countdown(6, common.mustCall(() => server.close())); function get(path, callback) { return http.get({ @@ -25,19 +28,14 @@ }, callback); } -server.listen(0, function() { - let finished = 0; - const num_requests = 6; - for (let i = 0; i < num_requests; i++) { - const request = get('/1', function() { - }); - request.on('response', function() { +server.listen(0, common.mustCall(() => { + for (let i = 0; i < 6; i++) { + const request = get('/1', common.mustCall()); + request.on('response', common.mustCall(() => { request.abort(); const sockets = agent.sockets[Object.keys(agent.sockets)[0]]; assert(sockets.length <= MAX_SOCKETS); - if (++finished === num_requests) { - server.close(); - } - }); + countdown.dec(); + })); } -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-no-protocol.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-no-protocol.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-no-protocol.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-no-protocol.js 2017-10-03 17:11:30.000000000 +0000 @@ -3,17 +3,17 @@ const http = require('http'); const url = require('url'); -const server = http.createServer(common.mustCall(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end(); -})).listen(0, '127.0.0.1', common.mustCall(function() { - const opts = url.parse(`http://127.0.0.1:${this.address().port}/`); +})).listen(0, '127.0.0.1', common.mustCall(() => { + const opts = url.parse(`http://127.0.0.1:${server.address().port}/`); // remove the `protocol` field… the `http` module should fall back // to "http:", as defined by the global, default `http.Agent` instance. opts.agent = new http.Agent(); opts.agent.protocol = null; - http.get(opts, common.mustCall(function(res) { + http.get(opts, common.mustCall((res) => { res.resume(); server.close(); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-agent-null.js nodejs-6.11.4~dfsg/test/parallel/test-http-agent-null.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-agent-null.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-agent-null.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,14 +2,14 @@ const common = require('../common'); const http = require('http'); -const server = http.createServer(common.mustCall(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end(); -})).listen(0, common.mustCall(function() { +})).listen(0, common.mustCall(() => { const options = { agent: null, - port: this.address().port + port: server.address().port }; - http.get(options, common.mustCall(function(res) { + http.get(options, common.mustCall((res) => { res.resume(); server.close(); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-automatic-headers.js nodejs-6.11.4~dfsg/test/parallel/test-http-automatic-headers.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-automatic-headers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-automatic-headers.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,23 +1,23 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.setHeader('X-Date', 'foo'); res.setHeader('X-Connection', 'bar'); res.setHeader('X-Content-Length', 'baz'); res.end(); -}); +})); server.listen(0); -server.on('listening', function() { - const agent = new http.Agent({ port: this.address().port, maxSockets: 1 }); +server.on('listening', common.mustCall(() => { + const agent = new http.Agent({ port: server.address().port, maxSockets: 1 }); http.get({ - port: this.address().port, + port: server.address().port, path: '/hello', agent: agent - }, function(res) { + }, common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); assert.strictEqual(res.headers['x-date'], 'foo'); assert.strictEqual(res.headers['x-connection'], 'bar'); @@ -27,5 +27,5 @@ assert.strictEqual(res.headers['content-length'], '0'); server.close(); agent.destroy(); - }); -}); + })); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-blank-header.js nodejs-6.11.4~dfsg/test/parallel/test-http-blank-header.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-blank-header.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-blank-header.js 2017-10-03 17:11:30.000000000 +0000 @@ -4,34 +4,29 @@ const http = require('http'); const net = require('net'); -const server = http.createServer(common.mustCall(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { assert.strictEqual('GET', req.method); assert.strictEqual('/blah', req.url); assert.deepStrictEqual({ - host: 'mapdevel.trolologames.ru:443', - origin: 'http://mapdevel.trolologames.ru', + host: 'example.org:443', + origin: 'http://example.org', cookie: '' }, req.headers); })); -server.listen(0, function() { - const c = net.createConnection(this.address().port); +server.listen(0, common.mustCall(() => { + const c = net.createConnection(server.address().port); - c.on('connect', function() { + c.on('connect', common.mustCall(() => { c.write('GET /blah HTTP/1.1\r\n' + - 'Host: mapdevel.trolologames.ru:443\r\n' + + 'Host: example.org:443\r\n' + 'Cookie:\r\n' + - 'Origin: http://mapdevel.trolologames.ru\r\n' + + 'Origin: http://example.org\r\n' + '\r\n\r\nhello world' ); - }); + })); - c.on('end', function() { - c.end(); - }); - - c.on('close', function() { - server.close(); - }); -}); + c.on('end', common.mustCall(() => c.end())); + c.on('close', common.mustCall(() => server.close())); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-buffer-sanity.js nodejs-6.11.4~dfsg/test/parallel/test-http-buffer-sanity.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-buffer-sanity.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-buffer-sanity.js 2017-10-03 17:11:30.000000000 +0000 @@ -11,16 +11,12 @@ buffer[i] = i % 256; } - -const web = http.Server(function(req, res) { - web.close(); - - console.log(req.headers); +const server = http.Server(function(req, res) { + server.close(); let i = 0; - req.on('data', function(d) { - process.stdout.write(','); + req.on('data', (d) => { measuredSize += d.length; for (let j = 0; j < d.length; j++) { assert.strictEqual(buffer[i], d[j]); @@ -28,39 +24,27 @@ } }); - - req.on('end', function() { + req.on('end', common.mustCall(() => { + assert.strictEqual(bufferSize, measuredSize); res.writeHead(200); res.write('thanks'); res.end(); - console.log('response with \'thanks\''); - }); - - req.connection.on('error', function(e) { - console.log(`http server-side error: ${e.message}`); - process.exit(1); - }); + })); }); -web.listen(0, common.mustCall(function() { - console.log('Making request'); - +server.listen(0, common.mustCall(() => { const req = http.request({ - port: this.address().port, - method: 'GET', + port: server.address().port, + method: 'POST', path: '/', headers: { 'content-length': buffer.length } - }, common.mustCall(function(res) { - console.log('Got response'); + }, common.mustCall((res) => { res.setEncoding('utf8'); - res.on('data', common.mustCall(function(string) { - assert.strictEqual('thanks', string); + let data = ''; + res.on('data', (chunk) => data += chunk); + res.on('end', common.mustCall(() => { + assert.strictEqual('thanks', data); })); })); req.end(buffer); })); - - -process.on('exit', function() { - assert.strictEqual(bufferSize, measuredSize); -}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-chunked.js nodejs-6.11.4~dfsg/test/parallel/test-http-chunked.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-chunked.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-chunked.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); @@ -13,31 +13,23 @@ '采用封建制和郡县制并存的制度,它的建立保证了秦末乱世岭南地区社会秩序的稳定,' + '有效的改善了岭南地区落后的政治、经济现状。'; -const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain; charset=utf8'}); +const server = http.createServer(common.mustCall((req, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf8' }); res.end(UTF8_STRING, 'utf8'); -}); -server.listen(0, function() { +})); +server.listen(0, common.mustCall(() => { let data = ''; - const get = http.get({ + http.get({ path: '/', host: 'localhost', - port: this.address().port - }, function(x) { + port: server.address().port + }, common.mustCall((x) => { x.setEncoding('utf8'); - x.on('data', function(c) { data += c; }); - x.on('error', function(e) { - throw e; - }); - x.on('end', function() { + x.on('data', (c) => data += c); + x.on('end', common.mustCall(() => { assert.strictEqual('string', typeof data); - console.log('here is the response:'); assert.strictEqual(UTF8_STRING, data); - console.log(data); server.close(); - }); - }); - get.on('error', function(e) { throw e; }); - get.end(); - -}); + })); + })).end(); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-chunk-problem.js nodejs-6.11.4~dfsg/test/parallel/test-http-chunk-problem.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-chunk-problem.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-chunk-problem.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,11 +1,10 @@ 'use strict'; // http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919 const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); if (process.argv[2] === 'request') { const http = require('http'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-abort2.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-abort2.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-abort2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-abort2.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,16 +1,17 @@ 'use strict'; -require('../common'); +const common = require('../common'); const http = require('http'); -const server = http.createServer(function(req, res) { +const server = http.createServer(common.mustCall((req, res) => { res.end('Hello'); -}); +})); -server.listen(0, function() { - const req = http.get({port: this.address().port}, function(res) { - res.on('data', function(data) { +server.listen(0, common.mustCall(() => { + const options = { port: server.address().port }; + const req = http.get(options, common.mustCall((res) => { + res.on('data', (data) => { req.abort(); server.close(); }); - }); -}); + })); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-aborted-event.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-aborted-event.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-aborted-event.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-aborted-event.js 2017-10-03 17:11:30.000000000 +0000 @@ -13,6 +13,6 @@ headers: { connection: 'keep-alive' } }, common.mustCall(function(res) { server.close(); - res.on('aborted', common.mustCall(function() {})); + res.on('aborted', common.mustCall()); })); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-abort.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-abort.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-abort.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-abort.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,55 +1,33 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); const http = require('http'); +const Countdown = require('../common/countdown'); -let clientAborts = 0; +const N = 8; + +const countdown = new Countdown(N, common.mustCall(() => server.close())); -const server = http.Server(function(req, res) { - console.log('Got connection'); +const server = http.Server(common.mustCall((req, res) => { res.writeHead(200); res.write('Working on it...'); + req.on('aborted', common.mustCall(() => countdown.dec())); +}, N)); - // I would expect an error event from req or res that the client aborted - // before completing the HTTP request / response cycle, or maybe a new - // event like "aborted" or something. - req.on('aborted', function() { - clientAborts++; - console.log(`Got abort ${clientAborts}`); - if (clientAborts === N) { - console.log('All aborts detected, you win.'); - server.close(); - } - }); -}); +server.listen(0, common.mustCall(() => { -let responses = 0; -const N = 8; -const requests = []; + const requests = []; + const reqCountdown = new Countdown(N, common.mustCall(() => { + requests.forEach((req) => req.abort()); + })); -server.listen(0, function() { - console.log('Server listening.'); + const options = { port: server.address().port }; for (let i = 0; i < N; i++) { - console.log(`Making client ${i}`); - const options = { port: this.address().port, path: `/?id=${i}` }; - const req = http.get(options, function(res) { - console.log(`Client response code ${res.statusCode}`); - - res.resume(); - if (++responses === N) { - console.log('All clients connected, destroying.'); - requests.forEach(function(outReq) { - console.log('abort'); - outReq.abort(); - }); - } - }); - - requests.push(req); + options.path = `/?id=${i}`; + requests.push( + http.get(options, common.mustCall((res) => { + res.resume(); + reqCountdown.dec(); + }))); } -}); - -process.on('exit', function() { - assert.strictEqual(N, clientAborts); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-agent.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-agent.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-agent.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-agent.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); @@ -7,23 +7,22 @@ const max = 3; let count = 0; -const server = http.Server(function(req, res) { +const server = http.Server(common.mustCall((req, res) => { if (req.url === '/0') { - setTimeout(function() { + setTimeout(common.mustCall(() => { res.writeHead(200); res.end('Hello, World!'); - }, 100); + }), 100); } else { res.writeHead(200); res.end('Hello, World!'); } -}); -server.listen(0, function() { - name = http.globalAgent.getName({ port: this.address().port }); - for (let i = 0; i < max; ++i) { +}, max)); +server.listen(0, common.mustCall(() => { + name = http.globalAgent.getName({ port: server.address().port }); + for (let i = 0; i < max; ++i) request(i); - } -}); +})); function request(i) { const req = http.get({ @@ -31,20 +30,17 @@ path: `/${i}` }, function(res) { const socket = req.socket; - socket.on('close', function() { + socket.on('close', common.mustCall(() => { ++count; if (count < max) { - assert.strictEqual(http.globalAgent.sockets[name].indexOf(socket), -1); + assert.strictEqual(http.globalAgent.sockets[name].includes(socket), + false); } else { assert(!http.globalAgent.sockets.hasOwnProperty(name)); assert(!http.globalAgent.requests.hasOwnProperty(name)); server.close(); } - }); + })); res.resume(); }); } - -process.on('exit', function() { - assert.strictEqual(count, max); -}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-default-headers-exist.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-default-headers-exist.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-default-headers-exist.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-default-headers-exist.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,7 +1,8 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const expectedHeaders = { 'DELETE': ['host', 'connection'], @@ -14,20 +15,21 @@ const expectedMethods = Object.keys(expectedHeaders); -let requestCount = 0; +const countdown = + new Countdown(expectedMethods.length, + common.mustCall(() => server.close())); -const server = http.createServer(function(req, res) { - requestCount++; +const server = http.createServer(common.mustCall((req, res) => { res.end(); assert(expectedHeaders.hasOwnProperty(req.method), `${req.method} was an unexpected method`); const requestHeaders = Object.keys(req.headers); - requestHeaders.forEach(function(header) { - assert.notStrictEqual( - expectedHeaders[req.method].indexOf(header.toLowerCase()), - -1, + requestHeaders.forEach((header) => { + assert.strictEqual( + expectedHeaders[req.method].includes(header.toLowerCase()), + true, `${header} should not exist for method ${req.method}` ); }); @@ -38,15 +40,14 @@ `some headers were missing for method: ${req.method}` ); - if (expectedMethods.length === requestCount) - server.close(); -}); + countdown.dec(); +}, expectedMethods.length)); -server.listen(0, function() { - expectedMethods.forEach(function(method) { +server.listen(0, common.mustCall(() => { + expectedMethods.forEach((method) => { http.request({ method: method, port: server.address().port }).end(); }); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-encoding.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,18 +1,18 @@ 'use strict'; -require('../common'); - +const common = require('../common'); +const assert = require('assert'); const http = require('http'); -http.createServer(function(req, res) { - res.end('ok\n'); - this.close(); -}).listen(0, test); - -function test() { +const server = http.createServer((req, res) => { + res.end('ok'); + server.close(); +}).listen(0, common.mustCall(() => { http.request({ - port: this.address().port, + port: server.address().port, encoding: 'utf8' - }, function(res) { - res.pipe(process.stdout); - }).end(); -} + }, common.mustCall((res) => { + let data = ''; + res.on('data', (chunk) => data += chunk); + res.on('end', common.mustCall(() => assert.strictEqual(data, 'ok'))); + })).end(); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-client-parse-error.js nodejs-6.11.4~dfsg/test/parallel/test-http-client-parse-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-client-parse-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-client-parse-error.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,39 +1,30 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); - const http = require('http'); const net = require('net'); +const Countdown = require('../common/countdown'); + +const countdown = new Countdown(2, common.mustCall(() => server.close())); -let connects = 0; -let parseErrors = 0; +const payloads = [ + 'HTTP/1.1 302 Object Moved\r\nContent-Length: 0\r\n\r\nhi world', + 'bad http = should trigger parse error' +]; // Create a TCP server -net.createServer(function(c) { - console.log('connection'); - if (++connects === 1) { - c.end('HTTP/1.1 302 Object Moved\r\nContent-Length: 0\r\n\r\nhi world'); - } else { - c.end('bad http - should trigger parse error\r\n'); - this.close(); - } -}).listen(0, '127.0.0.1', function() { +const server = + net.createServer(common.mustCall((c) => c.end(payloads.shift()), 2)); + +server.listen(0, common.mustCall(() => { for (let i = 0; i < 2; i++) { - http.request({ - host: '127.0.0.1', - port: this.address().port, - method: 'GET', + http.get({ + port: server.address().port, path: '/' - }).on('error', function(e) { - console.log('got error from client'); + }).on('error', common.mustCall((e) => { assert.ok(e.message.includes('Parse Error')); assert.strictEqual(e.code, 'HPE_INVALID_CONSTANT'); - parseErrors++; - }).end(); + countdown.dec(); + })); } -}); - -process.on('exit', function() { - assert.strictEqual(connects, 2); - assert.strictEqual(parseErrors, 2); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-default-port.js nodejs-6.11.4~dfsg/test/parallel/test-http-default-port.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-default-port.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-default-port.js 2017-10-03 17:11:30.000000000 +0000 @@ -17,7 +17,7 @@ if (common.hasCrypto) { https = require('https'); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } process.on('exit', function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-dns-error.js nodejs-6.11.4~dfsg/test/parallel/test-http-dns-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-dns-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-dns-error.js 2017-10-03 17:11:30.000000000 +0000 @@ -8,7 +8,7 @@ if (common.hasCrypto) { https = require('https'); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } const host = '*'.repeat(256); @@ -37,7 +37,7 @@ if (common.hasCrypto) { test(https); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } test(http); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-eof-on-connect.js nodejs-6.11.4~dfsg/test/parallel/test-http-eof-on-connect.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-eof-on-connect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-eof-on-connect.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,5 +1,27 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + 'use strict'; -require('../common'); + +const common = require('../common'); const net = require('net'); const http = require('http'); @@ -7,7 +29,7 @@ // It is separate from test-http-malformed-request.js because it is only // reproduceable on the first packet on the first connection to a server. -const server = http.createServer(function(req, res) {}); +const server = http.createServer(common.mustNotCall()); server.listen(0); server.on('listening', function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-extra-response.js nodejs-6.11.4~dfsg/test/parallel/test-http-extra-response.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-extra-response.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-extra-response.js 2017-10-03 17:11:30.000000000 +0000 @@ -11,7 +11,7 @@ const body = 'hello world\r\n'; const fullResponse = 'HTTP/1.1 500 Internal Server Error\r\n' + - 'Content-Length: ' + body.length + '\r\n' + + `Content-Length: ${body.length}\r\n` + 'Content-Type: text/plain\r\n' + 'Date: Fri + 18 Feb 2011 06:22:45 GMT\r\n' + 'Host: 10.20.149.2\r\n' + diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-full-response.js nodejs-6.11.4~dfsg/test/parallel/test-http-full-response.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-full-response.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-full-response.js 2017-10-03 17:11:30.000000000 +0000 @@ -21,21 +21,20 @@ const command = `ab ${opts} http://127.0.0.1:${server.address().port}/`; exec(command, function(err, stdout, stderr) { if (err) { - if (/ab|apr/mi.test(stderr)) { - common.skip(`problem spawning \`ab\`.\n${stderr}`); + if (/ab|apr/i.test(stderr)) { + common.printSkipMessage(`problem spawning \`ab\`.\n${stderr}`); process.reallyExit(0); } - process.exit(); - return; + throw err; } - let m = /Document Length:\s*(\d+) bytes/mi.exec(stdout); + let m = /Document Length:\s*(\d+) bytes/i.exec(stdout); const documentLength = parseInt(m[1]); - m = /Complete requests:\s*(\d+)/mi.exec(stdout); + m = /Complete requests:\s*(\d+)/i.exec(stdout); const completeRequests = parseInt(m[1]); - m = /HTML transferred:\s*(\d+) bytes/mi.exec(stdout); + m = /HTML transferred:\s*(\d+) bytes/i.exec(stdout); const htmlTransfered = parseInt(m[1]); assert.strictEqual(bodyLength, documentLength); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-header-read.js nodejs-6.11.4~dfsg/test/parallel/test-http-header-read.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-header-read.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-header-read.js 2017-10-03 17:11:30.000000000 +0000 @@ -17,9 +17,9 @@ // This checks that after the headers have been sent, getHeader works // and does not throw an exception (Issue 752) assert.doesNotThrow( - function() { - assert.strictEqual(plain, res.getHeader(contentType)); - } + function() { + assert.strictEqual(plain, res.getHeader(contentType)); + } ); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-host-header-ipv6-fail.js nodejs-6.11.4~dfsg/test/parallel/test-http-host-header-ipv6-fail.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-host-header-ipv6-fail.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-host-header-ipv6-fail.js 2017-10-03 17:11:30.000000000 +0000 @@ -10,6 +10,10 @@ */ const common = require('../common'); + +if (!common.hasIPv6) + common.skip('Skipping test, no IPv6 support'); + const assert = require('assert'); const http = require('http'); @@ -25,11 +29,6 @@ req.end(); } -if (!common.hasIPv6) { - console.error('Skipping test, no IPv6 support'); - return; -} - const server = http.createServer(common.mustCall(function(req, res) { assert.ok(req.headers.host, `[${hostname}]`); res.end(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-invalidheaderfield2.js nodejs-6.11.4~dfsg/test/parallel/test-http-invalidheaderfield2.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-invalidheaderfield2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-invalidheaderfield2.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,8 +2,7 @@ require('../common'); const assert = require('assert'); const inspect = require('util').inspect; -const checkIsHttpToken = require('_http_common')._checkIsHttpToken; -const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar; +const { _checkIsHttpToken, _checkInvalidHeaderChar } = require('_http_common'); // Good header field names [ @@ -29,8 +28,8 @@ '3.14159265359' ].forEach(function(str) { assert.strictEqual( - checkIsHttpToken(str), true, - `checkIsHttpToken(${inspect(str)}) unexpectedly failed`); + _checkIsHttpToken(str), true, + `_checkIsHttpToken(${inspect(str)}) unexpectedly failed`); }); // Bad header field names [ @@ -55,8 +54,8 @@ 'This,That' ].forEach(function(str) { assert.strictEqual( - checkIsHttpToken(str), false, - `checkIsHttpToken(${inspect(str)}) unexpectedly succeeded`); + _checkIsHttpToken(str), false, + `_checkIsHttpToken(${inspect(str)}) unexpectedly succeeded`); }); @@ -68,8 +67,8 @@ '!@#$%^&*()-_=+\\;\':"[]{}<>,./?|~`' ].forEach(function(str) { assert.strictEqual( - checkInvalidHeaderChar(str), false, - `checkInvalidHeaderChar(${inspect(str)}) unexpectedly failed`); + _checkInvalidHeaderChar(str), false, + `_checkInvalidHeaderChar(${inspect(str)}) unexpectedly failed`); }); // Bad header field values @@ -84,6 +83,6 @@ 'Ding!\x07' ].forEach(function(str) { assert.strictEqual( - checkInvalidHeaderChar(str), true, - `checkInvalidHeaderChar(${inspect(str)}) unexpectedly succeeded`); + _checkInvalidHeaderChar(str), true, + `_checkInvalidHeaderChar(${inspect(str)}) unexpectedly succeeded`); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-invalidheaderfield.js nodejs-6.11.4~dfsg/test/parallel/test-http-invalidheaderfield.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-invalidheaderfield.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-invalidheaderfield.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,5 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); + const assert = require('assert'); const EventEmitter = require('events'); const http = require('http'); @@ -28,7 +29,7 @@ port: server.address().port, headers: {'testing 123': 123} }; - http.get(options, function() {}); + http.get(options, common.mustNotCall()); }, function(err) { ee.emit('done'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-keepalive-maxsockets.js nodejs-6.11.4~dfsg/test/parallel/test-http-keepalive-maxsockets.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-keepalive-maxsockets.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-keepalive-maxsockets.js 2017-10-03 17:11:30.000000000 +0000 @@ -7,7 +7,7 @@ const serverSockets = []; const server = http.createServer(function(req, res) { - if (serverSockets.indexOf(req.socket) === -1) { + if (!serverSockets.includes(req.socket)) { serverSockets.push(req.socket); } res.end(req.url); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-localaddress.js nodejs-6.11.4~dfsg/test/parallel/test-http-localaddress.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-localaddress.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-localaddress.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasMultiLocalhost()) + common.skip('platform-specific test.'); + const http = require('http'); const assert = require('assert'); -if (!common.hasMultiLocalhost()) { - common.skip('platform-specific test.'); - return; -} - const server = http.createServer(function(req, res) { console.log(`Connect from: ${req.connection.remoteAddress}`); assert.strictEqual('127.0.0.2', req.connection.remoteAddress); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-methods.js nodejs-6.11.4~dfsg/test/parallel/test-http-methods.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-methods.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-methods.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,11 +2,44 @@ require('../common'); const assert = require('assert'); const http = require('http'); -const util = require('util'); -assert(Array.isArray(http.METHODS)); -assert(http.METHODS.length > 0); -assert.notStrictEqual(http.METHODS.indexOf('GET'), -1); -assert.notStrictEqual(http.METHODS.indexOf('HEAD'), -1); -assert.notStrictEqual(http.METHODS.indexOf('POST'), -1); -assert.deepStrictEqual(util._extend([], http.METHODS), http.METHODS.sort()); +// This test ensures all http methods from HTTP parser are exposed +// to http library + +const methods = [ + 'DELETE', + 'GET', + 'HEAD', + 'POST', + 'PUT', + 'CONNECT', + 'OPTIONS', + 'TRACE', + 'COPY', + 'LOCK', + 'MKCOL', + 'MOVE', + 'PROPFIND', + 'PROPPATCH', + 'SEARCH', + 'UNLOCK', + 'BIND', + 'REBIND', + 'UNBIND', + 'ACL', + 'REPORT', + 'MKACTIVITY', + 'CHECKOUT', + 'MERGE', + 'M-SEARCH', + 'NOTIFY', + 'SUBSCRIBE', + 'UNSUBSCRIBE', + 'PATCH', + 'PURGE', + 'MKCALENDAR', + 'LINK', + 'UNLINK' +]; + +assert.deepStrictEqual(http.METHODS, methods.sort()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-multi-line-headers.js nodejs-6.11.4~dfsg/test/parallel/test-http-multi-line-headers.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-multi-line-headers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-multi-line-headers.js 2017-10-03 17:11:30.000000000 +0000 @@ -11,7 +11,7 @@ const response = 'HTTP/1.1 200 OK\r\n' + 'Connection: close\r\n' + - 'Content-Length: ' + body.length + '\r\n' + + `Content-Length: ${body.length}\r\n` + 'Content-Type: text/plain;\r\n' + ' x-unix-mode=0600;\r\n' + ' name="hello.txt"\r\n' + diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js 2017-10-03 17:11:30.000000000 +0000 @@ -24,7 +24,7 @@ const headerEnd = received.indexOf('\r\n\r\n', 'utf8'); assert.notStrictEqual(headerEnd, -1); - const header = received.toString('utf8', 0, headerEnd).split(/\r\n/g); + const header = received.toString('utf8', 0, headerEnd).split('\r\n'); const body = received.toString(enc, headerEnd + 4); assert.strictEqual(header[0], 'HTTP/1.1 200 OK'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-parser-bad-ref.js nodejs-6.11.4~dfsg/test/parallel/test-http-parser-bad-ref.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-parser-bad-ref.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-parser-bad-ref.js 2017-10-03 17:11:30.000000000 +0000 @@ -39,7 +39,7 @@ console.log('url', info.url); }; - parser[kOnBody] = function(b, start, len) { }; + parser[kOnBody] = () => {}; parser[kOnMessageComplete] = function() { messagesComplete++; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-parser.js nodejs-6.11.4~dfsg/test/parallel/test-http-parser.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-parser.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-parser.js 2017-10-03 17:11:30.000000000 +0000 @@ -32,7 +32,7 @@ parser.url += url; }; - parser[kOnHeadersComplete] = function(info) { + parser[kOnHeadersComplete] = function() { }; parser[kOnBody] = function(b, start, len) { @@ -76,8 +76,7 @@ const request = Buffer.from(`GET /hello HTTP/1.1${CRLF}${CRLF}`); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); assert.strictEqual(method, methods.indexOf('GET')); @@ -93,7 +92,7 @@ // thrown from parser.execute() // - parser[kOnHeadersComplete] = function(info) { + parser[kOnHeadersComplete] = function() { throw new Error('hello world'); }; @@ -110,15 +109,14 @@ // { const request = Buffer.from( - 'HTTP/1.1 200 OK' + CRLF + + 'HTTP/1.1 200 OK' + CRLF + 'Content-Type: text/plain' + CRLF + 'Content-Length: 4' + CRLF + CRLF + 'pong'); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url, statusCode, statusMessage) => { assert.strictEqual(method, undefined); assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); @@ -146,8 +144,7 @@ `HTTP/1.0 200 Connection established${CRLF}${CRLF}`); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url, statusCode, statusMessage) => { assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 0); assert.strictEqual(method, undefined); @@ -167,7 +164,7 @@ // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + '4' + CRLF + @@ -179,15 +176,14 @@ let seen_body = false; - const onHeaders = (headers, url) => { + const onHeaders = (headers) => { assert.ok(seen_body); // trailers should come after the body assert.deepStrictEqual(headers, ['Vary', '*', 'Content-Type', 'text/plain']); }; const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/it'); assert.strictEqual(versionMajor, 1); @@ -214,21 +210,20 @@ // { const request = Buffer.from( - 'GET / HTTP/1.0' + CRLF + + 'GET / HTTP/1.0' + CRLF + 'X-Filler: 1337' + CRLF + 'X-Filler: 42' + CRLF + 'X-Filler2: 42' + CRLF + CRLF); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method) => { assert.strictEqual(method, methods.indexOf('GET')); assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 0); assert.deepStrictEqual( - headers || parser.headers, - ['X-Filler', '1337', 'X-Filler', '42', 'X-Filler2', '42']); + headers || parser.headers, + ['X-Filler', '1337', 'X-Filler', '42', 'X-Filler2', '42']); }; const parser = newParser(REQUEST); @@ -245,13 +240,12 @@ const lots_of_headers = `X-Filler: 42${CRLF}`.repeat(256); const request = Buffer.from( - 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF + + 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF + lots_of_headers + CRLF); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('GET')); assert.strictEqual(url || parser.url, '/foo/bar/baz?quux=42#1337'); assert.strictEqual(versionMajor, 1); @@ -277,15 +271,14 @@ // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: application/x-www-form-urlencoded' + CRLF + 'Content-Length: 15' + CRLF + CRLF + 'foo=42&bar=1337'); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/it'); assert.strictEqual(versionMajor, 1); @@ -309,7 +302,7 @@ // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -322,8 +315,7 @@ '0' + CRLF); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/it'); assert.strictEqual(versionMajor, 1); @@ -350,7 +342,7 @@ // { let request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -360,8 +352,7 @@ '123456' + CRLF); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/it'); assert.strictEqual(versionMajor, 1); @@ -383,7 +374,7 @@ parser.execute(request, 0, request.length); request = Buffer.from( - '9' + CRLF + + '9' + CRLF + '123456789' + CRLF + 'C' + CRLF + '123456789ABC' + CRLF + @@ -400,7 +391,7 @@ // { const request = Buffer.from( - 'POST /helpme HTTP/1.1' + CRLF + + 'POST /helpme HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -418,8 +409,7 @@ function test(a, b) { const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/helpme'); assert.strictEqual(versionMajor, 1); @@ -458,7 +448,7 @@ // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -475,15 +465,14 @@ '0' + CRLF); const onHeadersComplete = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url || parser.url, '/it'); assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); assert.deepStrictEqual( - headers || parser.headers, - ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); + headers || parser.headers, + ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); }; let expected_body = '123123456123456789123456789ABC123456789ABCDEF'; @@ -511,7 +500,7 @@ // { const req1 = Buffer.from( - 'PUT /this HTTP/1.1' + CRLF + + 'PUT /this HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -520,27 +509,25 @@ '0' + CRLF); const req2 = Buffer.from( - 'POST /that HTTP/1.0' + CRLF + + 'POST /that HTTP/1.0' + CRLF + 'Content-Type: text/plain' + CRLF + 'Content-Length: 4' + CRLF + CRLF + 'pong'); const onHeadersComplete1 = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('PUT')); assert.strictEqual(url, '/this'); assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); assert.deepStrictEqual( - headers, - ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); + headers, + ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); }; const onHeadersComplete2 = (versionMajor, versionMinor, headers, - method, url, statusCode, statusMessage, - upgrade, shouldKeepAlive) => { + method, url) => { assert.strictEqual(method, methods.indexOf('POST')); assert.strictEqual(url, '/that'); assert.strictEqual(versionMajor, 1); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-pause-resume-one-end.js nodejs-6.11.4~dfsg/test/parallel/test-http-pause-resume-one-end.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-pause-resume-one-end.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-pause-resume-one-end.js 2017-10-03 17:11:30.000000000 +0000 @@ -22,6 +22,6 @@ }); })); - res.on('end', common.mustCall(function() {})); + res.on('end', common.mustCall()); })); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-create-connection.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-create-connection.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-create-connection.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-create-connection.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-disable-session-reuse.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-disable-session-reuse.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-disable-session-reuse.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-disable-session-reuse.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} - -const TOTAL_REQS = 2; +const assert = require('assert'); const https = require('https'); - const fs = require('fs'); +const TOTAL_REQS = 2; + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-servername.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-servername.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-servername.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-servername.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const https = require('https'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-session-eviction.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-session-eviction.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-session-eviction.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-session-eviction.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-session-reuse.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-session-reuse.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-session-reuse.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-session-reuse.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const https = require('https'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-sni.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-sni.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-sni.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-sni.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-agent-sockets-leak.js nodejs-6.11.4~dfsg/test/parallel/test-https-agent-sockets-leak.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-agent-sockets-leak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-agent-sockets-leak.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-byteswritten.js nodejs-6.11.4~dfsg/test/parallel/test-https-byteswritten.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-byteswritten.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-byteswritten.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-client-checkServerIdentity.js nodejs-6.11.4~dfsg/test/parallel/test-https-client-checkServerIdentity.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-client-checkServerIdentity.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-client-checkServerIdentity.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-client-get-url.js nodejs-6.11.4~dfsg/test/parallel/test-https-client-get-url.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-client-get-url.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-client-get-url.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,16 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-client-reject.js nodejs-6.11.4~dfsg/test/parallel/test-https-client-reject.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-client-reject.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-client-reject.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-client-resume.js nodejs-6.11.4~dfsg/test/parallel/test-https-client-resume.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-client-resume.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-client-resume.js 2017-10-03 17:11:30.000000000 +0000 @@ -3,14 +3,11 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-close.js nodejs-6.11.4~dfsg/test/parallel/test-https-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-close.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const fs = require('fs'); const https = require('https'); const options = { @@ -31,7 +29,7 @@ }); function shutdown() { - server.close(common.mustCall(function() {})); + server.close(common.mustCall()); for (const key in connections) { connections[key].destroy(); @@ -49,7 +47,7 @@ }; const req = https.request(requestOptions, function(res) { - res.on('data', function(d) {}); + res.on('data', () => {}); setImmediate(shutdown); }); req.end(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-connect-address-family.js nodejs-6.11.4~dfsg/test/parallel/test-https-connect-address-family.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-connect-address-family.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-connect-address-family.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const assert = require('assert'); const https = require('https'); @@ -37,10 +33,9 @@ dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') { + if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); - return; - } + throw err; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-connecting-to-http.js nodejs-6.11.4~dfsg/test/parallel/test-https-connecting-to-http.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-connecting-to-http.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-connecting-to-http.js 2017-10-03 17:11:30.000000000 +0000 @@ -2,14 +2,11 @@ // This tests the situation where you try to connect a https client // to an http server. You should get an error and exit. const common = require('../common'); -const http = require('http'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const http = require('http'); +const https = require('https'); const server = http.createServer(common.mustNotCall()); server.listen(0, common.mustCall(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-drain.js nodejs-6.11.4~dfsg/test/parallel/test-https-drain.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-drain.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-drain.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-eof-for-eom.js nodejs-6.11.4~dfsg/test/parallel/test-https-eof-for-eom.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-eof-for-eom.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-eof-for-eom.js 2017-10-03 17:11:30.000000000 +0000 @@ -8,15 +8,12 @@ // correctly. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const https = require('https'); const tls = require('tls'); - const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-server-stale-close.js nodejs-6.11.4~dfsg/test/parallel/test-http-server-stale-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-server-stale-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-server-stale-close.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,7 +1,6 @@ 'use strict'; require('../common'); const http = require('http'); -const util = require('util'); const fork = require('child_process').fork; if (process.env.NODE_TEST_FORK_PORT) { @@ -24,7 +23,9 @@ }); server.listen(0, function() { fork(__filename, { - env: util._extend(process.env, {NODE_TEST_FORK_PORT: this.address().port}) + env: Object.assign({}, process.env, { + NODE_TEST_FORK_PORT: this.address().port + }) }); }); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-set-timeout-server.js nodejs-6.11.4~dfsg/test/parallel/test-http-set-timeout-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-set-timeout-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-set-timeout-server.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); + const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -9,137 +10,119 @@ function test(fn) { if (!tests.length) process.nextTick(run); - tests.push(fn); + tests.push(common.mustCall(fn)); } function run() { const fn = tests.shift(); if (fn) { - console.log('# %s', fn.name); fn(run); - } else { - console.log('ok'); } } test(function serverTimeout(cb) { - let caughtTimeout = false; - process.on('exit', function() { - assert(caughtTimeout); - }); - const server = http.createServer(function(req, res) { - // just do nothing, we should get a timeout event. - }); - server.listen(common.mustCall(function() { - http.get({ port: server.address().port }).on('error', function() {}); + const server = http.createServer(); + server.listen(common.mustCall(() => { + const s = server.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + assert.ok(s instanceof http.Server); + http.get({ + port: server.address().port + }).on('error', common.mustCall()); })); - const s = server.setTimeout(50, function(socket) { - caughtTimeout = true; - socket.destroy(); - server.close(); - cb(); - }); - assert.ok(s instanceof http.Server); }); test(function serverRequestTimeout(cb) { - let caughtTimeout = false; - process.on('exit', function() { - assert(caughtTimeout); - }); - const server = http.createServer(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = req.setTimeout(50, function() { - caughtTimeout = true; - req.socket.destroy(); + const s = req.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); server.close(); cb(); - }); + })); assert.ok(s instanceof http.IncomingMessage); - }); - server.listen(common.mustCall(function() { - const port = server.address().port; - const req = http.request({ port: port, method: 'POST' }); - req.on('error', function() {}); + })); + server.listen(common.mustCall(() => { + const req = http.request({ + port: server.address().port, + method: 'POST' + }); + req.on('error', common.mustCall()); req.write('Hello'); // req is in progress })); }); test(function serverResponseTimeout(cb) { - let caughtTimeout = false; - process.on('exit', function() { - assert(caughtTimeout); - }); - const server = http.createServer(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = res.setTimeout(50, function() { - caughtTimeout = true; - res.socket.destroy(); + const s = res.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); server.close(); cb(); - }); + })); assert.ok(s instanceof http.OutgoingMessage); - }); - server.listen(common.mustCall(function() { - const port = server.address().port; - http.get({ port: port }).on('error', function() {}); + })); + server.listen(common.mustCall(() => { + http.get({ + port: server.address().port + }).on('error', common.mustCall()); })); }); test(function serverRequestNotTimeoutAfterEnd(cb) { - let caughtTimeoutOnRequest = false; - let caughtTimeoutOnResponse = false; - process.on('exit', function() { - assert(!caughtTimeoutOnRequest); - assert(caughtTimeoutOnResponse); - }); - const server = http.createServer(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = req.setTimeout(50, function(socket) { - caughtTimeoutOnRequest = true; - }); + const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); - res.on('timeout', function(socket) { - caughtTimeoutOnResponse = true; - }); - }); - server.on('timeout', function(socket) { + res.on('timeout', common.mustCall()); + })); + server.on('timeout', common.mustCall((socket) => { socket.destroy(); server.close(); cb(); - }); - server.listen(common.mustCall(function() { - const port = server.address().port; - http.get({ port: port }).on('error', function() {}); + })); + server.listen(common.mustCall(() => { + http.get({ + port: server.address().port + }).on('error', common.mustCall()); })); }); test(function serverResponseTimeoutWithPipeline(cb) { let caughtTimeout = ''; let secReceived = false; - process.on('exit', function() { + process.on('exit', () => { assert.strictEqual(caughtTimeout, '/2'); }); - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { if (req.url === '/2') secReceived = true; - const s = res.setTimeout(50, function() { + if (req.url === '/1') { + res.end(); + return; + } + const s = res.setTimeout(50, () => { caughtTimeout += req.url; }); assert.ok(s instanceof http.OutgoingMessage); - if (req.url === '/1') res.end(); }); - server.on('timeout', function(socket) { + server.on('timeout', common.mustCall((socket) => { if (secReceived) { socket.destroy(); server.close(); cb(); } - }); - server.listen(common.mustCall(function() { - const port = server.address().port; - const c = net.connect({ port: port, allowHalfOpen: true }, function() { + })); + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + }; + const c = net.connect(options, () => { c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); @@ -148,33 +131,62 @@ }); test(function idleTimeout(cb) { - let caughtTimeoutOnRequest = false; - let caughtTimeoutOnResponse = false; - let caughtTimeoutOnServer = false; - process.on('exit', function() { - assert(!caughtTimeoutOnRequest); - assert(!caughtTimeoutOnResponse); - assert(caughtTimeoutOnServer); - }); - const server = http.createServer(function(req, res) { - req.on('timeout', function(socket) { - caughtTimeoutOnRequest = true; - }); - res.on('timeout', function(socket) { - caughtTimeoutOnResponse = true; - }); - res.end(); - }); - const s = server.setTimeout(50, function(socket) { - caughtTimeoutOnServer = true; + // Test that the an idle connection invokes the timeout callback. + const server = http.createServer(); + const s = server.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); - }); + })); + assert.ok(s instanceof http.Server); + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + }; + const c = net.connect(options, () => { + // ECONNRESET could happen on a heavily-loaded server. + c.on('error', (e) => { + if (e.message !== 'read ECONNRESET') + throw e; + }); + c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + // Keep-Alive + }); + })); +}); + +test(function fastTimeout(cb) { + let connectionHandlerInvoked = false; + let timeoutHandlerInvoked = false; + let connectionSocket; + + function invokeCallbackIfDone() { + if (connectionHandlerInvoked && timeoutHandlerInvoked) { + connectionSocket.destroy(); + server.close(); + cb(); + } + } + + const server = http.createServer(common.mustCall((req, res) => { + req.on('timeout', common.mustNotCall()); + res.end(); + connectionHandlerInvoked = true; + invokeCallbackIfDone(); + })); + const s = server.setTimeout(1, common.mustCall((socket) => { + connectionSocket = socket; + timeoutHandlerInvoked = true; + invokeCallbackIfDone(); + })); assert.ok(s instanceof http.Server); - server.listen(common.mustCall(function() { - const port = server.address().port; - const c = net.connect({ port: port, allowHalfOpen: true }, function() { + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + }; + const c = net.connect(options, () => { c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); // Keep-Alive }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-set-trailers.js nodejs-6.11.4~dfsg/test/parallel/test-http-set-trailers.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-set-trailers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-set-trailers.js 2017-10-03 17:11:30.000000000 +0000 @@ -63,8 +63,8 @@ outstanding_reqs--; clearTimeout(tid); assert.ok( - /0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer), - 'No trailer in HTTP/1.1 response.' + /0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer), + 'No trailer in HTTP/1.1 response.' ); if (outstanding_reqs === 0) { server.close(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-foafssl.js nodejs-6.11.4~dfsg/test/parallel/test-https-foafssl.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-foafssl.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-foafssl.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,21 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} const assert = require('assert'); const join = require('path').join; - const fs = require('fs'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-host-headers.js nodejs-6.11.4~dfsg/test/parallel/test-https-host-headers.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-host-headers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-host-headers.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-should-keep-alive.js nodejs-6.11.4~dfsg/test/parallel/test-http-should-keep-alive.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-should-keep-alive.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-should-keep-alive.js 2017-10-03 17:11:30.000000000 +0000 @@ -33,7 +33,7 @@ assert.strictEqual( req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], `${SERVER_RESPONSES[responses]} should ${ - SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); + SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); ++responses; if (responses < SHOULD_KEEP_ALIVE.length) { makeRequest(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-localaddress-bind-error.js nodejs-6.11.4~dfsg/test/parallel/test-https-localaddress-bind-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-localaddress-bind-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-localaddress-bind-error.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,11 +1,10 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const fs = require('fs'); const https = require('https'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-localaddress.js nodejs-6.11.4~dfsg/test/parallel/test-https-localaddress.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-localaddress.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-localaddress.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); -if (!common.hasMultiLocalhost()) { +if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); - return; -} + +const fs = require('fs'); +const assert = require('assert'); +const https = require('https'); const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-pfx.js nodejs-6.11.4~dfsg/test/parallel/test-https-pfx.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-pfx.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-pfx.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-req-split.js nodejs-6.11.4~dfsg/test/parallel/test-https-req-split.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-req-split.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-req-split.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-set-timeout-server.js nodejs-6.11.4~dfsg/test/parallel/test-https-set-timeout-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-set-timeout-server.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-set-timeout-server.js 2017-10-03 17:11:30.000000000 +0000 @@ -0,0 +1,221 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const https = require('https'); +const http = require('http'); + +const tls = require('tls'); +const fs = require('fs'); + +const tests = []; + +const serverOptions = { + key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), + cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) +}; + +function test(fn) { + if (!tests.length) + process.nextTick(run); + tests.push(common.mustCall(fn)); +} + +function run() { + const fn = tests.shift(); + if (fn) { + fn(run); + } +} + +test(function serverTimeout(cb) { + const server = https.createServer(serverOptions); + server.listen(common.mustCall(() => { + const s = server.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + assert.ok(s instanceof https.Server); + https.get({ + port: server.address().port, + rejectUnauthorized: false + }).on('error', () => {}); + })); +}); + +test(function serverRequestTimeout(cb) { + const server = https.createServer( + serverOptions, + common.mustCall((req, res) => { + // just do nothing, we should get a timeout event. + const s = req.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + assert.ok(s instanceof http.IncomingMessage); + })); + server.listen(common.mustCall(() => { + const req = https.request({ + port: server.address().port, + method: 'POST', + rejectUnauthorized: false + }); + req.on('error', () => {}); + req.write('Hello'); + // req is in progress + })); +}); + +test(function serverResponseTimeout(cb) { + const server = https.createServer( + serverOptions, + common.mustCall((req, res) => { + // just do nothing, we should get a timeout event. + const s = res.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + assert.ok(s instanceof http.OutgoingMessage); + })); + server.listen(common.mustCall(() => { + https.get({ + port: server.address().port, + rejectUnauthorized: false + }).on('error', common.mustCall()); + })); +}); + +test(function serverRequestNotTimeoutAfterEnd(cb) { + const server = https.createServer( + serverOptions, + common.mustCall((req, res) => { + // just do nothing, we should get a timeout event. + const s = req.setTimeout(50, common.mustNotCall()); + assert.ok(s instanceof http.IncomingMessage); + res.on('timeout', common.mustCall()); + })); + server.on('timeout', common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + server.listen(common.mustCall(() => { + https.get({ + port: server.address().port, + rejectUnauthorized: false + }).on('error', common.mustCall()); + })); +}); + +test(function serverResponseTimeoutWithPipeline(cb) { + let caughtTimeout = ''; + let secReceived = false; + process.on('exit', () => { + assert.strictEqual(caughtTimeout, '/2'); + }); + const server = https.createServer(serverOptions, (req, res) => { + if (req.url === '/2') + secReceived = true; + if (req.url === '/1') { + res.end(); + return; + } + const s = res.setTimeout(50, () => { + caughtTimeout += req.url; + }); + assert.ok(s instanceof http.OutgoingMessage); + }); + server.on('timeout', common.mustCall((socket) => { + if (secReceived) { + socket.destroy(); + server.close(); + cb(); + } + })); + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + rejectUnauthorized: false + }; + const c = tls.connect(options, () => { + c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + }); + })); +}); + +test(function idleTimeout(cb) { + // Test that the an idle connection invokes the timeout callback. + const server = https.createServer(serverOptions); + const s = server.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); + assert.ok(s instanceof https.Server); + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + rejectUnauthorized: false + }; + const c = tls.connect(options, () => { + // ECONNRESET could happen on a heavily-loaded server. + c.on('error', (e) => { + if (e.message !== 'read ECONNRESET') + throw e; + }); + c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + // Keep-Alive + }); + })); +}); + +test(function fastTimeout(cb) { + // Test that the socket timeout fires but no timeout fires for the request. + let connectionHandlerInvoked = false; + let timeoutHandlerInvoked = false; + let connectionSocket; + + function invokeCallbackIfDone() { + if (connectionHandlerInvoked && timeoutHandlerInvoked) { + connectionSocket.destroy(); + server.close(); + cb(); + } + } + + const server = https.createServer(serverOptions, common.mustCall( + (req, res) => { + req.on('timeout', common.mustNotCall()); + res.end(); + connectionHandlerInvoked = true; + invokeCallbackIfDone(); + } + )); + const s = server.setTimeout(1, common.mustCall((socket) => { + connectionSocket = socket; + timeoutHandlerInvoked = true; + invokeCallbackIfDone(); + })); + assert.ok(s instanceof https.Server); + server.listen(common.mustCall(() => { + const options = { + port: server.address().port, + allowHalfOpen: true, + rejectUnauthorized: false + }; + const c = tls.connect(options, () => { + c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + // Keep-Alive + }); + })); +}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-simple.js nodejs-6.11.4~dfsg/test/parallel/test-https-simple.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-simple.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-simple.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-socket-options.js nodejs-6.11.4~dfsg/test/parallel/test-https-socket-options.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-socket-options.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-socket-options.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const https = require('https'); const fs = require('fs'); - const http = require('http'); const options = { @@ -37,7 +34,7 @@ }); // These methods should exist on the request and get passed down to the socket req.setNoDelay(true); - req.setTimeout(1000, function() { }); + req.setTimeout(1000, () => {}); req.setSocketKeepAlive(true, 1000); req.end(); }); @@ -61,7 +58,7 @@ }); // These methods should exist on the request and get passed down to the socket req.setNoDelay(true); - req.setTimeout(1000, function() { }); + req.setTimeout(1000, () => {}); req.setSocketKeepAlive(true, 1000); req.end(); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-strict.js nodejs-6.11.4~dfsg/test/parallel/test-https-strict.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-strict.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-strict.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,16 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const path = require('path'); @@ -128,9 +125,9 @@ const req = https.get(options); expectResponseCount++; const server = port === server1.address().port ? server1 - : port === server2.address().port ? server2 + : port === server2.address().port ? server2 : port === server3.address().port ? server3 - : null; + : null; if (!server) throw new Error(`invalid port: ${port}`); server.expectCount++; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-https-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-timeout.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-timeout-server-2.js nodejs-6.11.4~dfsg/test/parallel/test-https-timeout-server-2.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-timeout-server-2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-timeout-server-2.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-timeout-server.js nodejs-6.11.4~dfsg/test/parallel/test-https-timeout-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-timeout-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-timeout-server.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-truncate.js nodejs-6.11.4~dfsg/test/parallel/test-https-truncate.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-truncate.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-truncate.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-https-unix-socket-self-signed.js nodejs-6.11.4~dfsg/test/parallel/test-https-unix-socket-self-signed.js --- nodejs-6.11.2~dfsg/test/parallel/test-https-unix-socket-self-signed.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-https-unix-socket-self-signed.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,18 +1,16 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} common.refreshTmpDir(); const fs = require('fs'); const https = require('https'); const options = { - cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'), - key: fs.readFileSync(common.fixturesDir + '/test_key.pem') + cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`), + key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`) }; const server = https.createServer(options, common.mustCall((req, res) => { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-client2.js nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-client2.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-client2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-client2.js 2017-10-03 17:11:30.000000000 +0000 @@ -6,9 +6,10 @@ const server = http.createServer(); server.on('upgrade', function(req, socket, head) { - socket.write('HTTP/1.1 101 Ok' + CRLF + - 'Connection: Upgrade' + CRLF + - 'Upgrade: Test' + CRLF + CRLF + 'head'); + socket.write(`HTTP/1.1 101 Ok${CRLF}` + + `Connection: Upgrade${CRLF}` + + `Upgrade: Test${CRLF}${CRLF}` + + 'head'); socket.on('end', function() { socket.end(); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-reconsume-stream.js nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-reconsume-stream.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-reconsume-stream.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-reconsume-stream.js 2017-10-03 17:11:30.000000000 +0000 @@ -0,0 +1,29 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +const tls = require('tls'); +const http = require('http'); + +// Tests that, after the HTTP parser stopped owning a socket that emits an +// 'upgrade' event, another C++ stream can start owning it (e.g. a TLSSocket). + +const server = http.createServer(common.mustNotCall()); + +server.on('upgrade', common.mustCall((request, socket, head) => { + // This should not crash. + new tls.TLSSocket(socket); + server.close(); + socket.destroy(); +})); + +server.listen(0, common.mustCall(() => { + http.get({ + port: server.address().port, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket' + } + }).on('error', () => {}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-server.js nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-upgrade-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-upgrade-server.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,4 +1,5 @@ 'use strict'; + require('../common'); const assert = require('assert'); @@ -16,7 +17,7 @@ } function testServer() { - http.Server.call(this, function() {}); + http.Server.call(this, () => {}); this.on('connection', function() { requests_recv++; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-url.parse-https.request.js nodejs-6.11.4~dfsg/test/parallel/test-http-url.parse-https.request.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-url.parse-https.request.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-url.parse-https.request.js 2017-10-03 17:11:30.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const url = require('url'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-http-write-head.js nodejs-6.11.4~dfsg/test/parallel/test-http-write-head.js --- nodejs-6.11.2~dfsg/test/parallel/test-http-write-head.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-http-write-head.js 2017-10-03 17:11:30.000000000 +0000 @@ -46,7 +46,7 @@ http.get({ port: this.address().port }, common.mustCall((response) => { response.on('end', common.mustCall(() => { assert.strictEqual(response.headers['test'], '2'); - assert.notStrictEqual(response.rawHeaders.indexOf('Test'), -1); + assert(response.rawHeaders.includes('Test')); s.close(); })); response.resume(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-icu-punycode.js nodejs-6.11.4~dfsg/test/parallel/test-icu-punycode.js --- nodejs-6.11.2~dfsg/test/parallel/test-icu-punycode.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-icu-punycode.js 2017-10-03 17:11:30.000000000 +0000 @@ -12,10 +12,8 @@ } } -if (!icu) { +if (!icu) common.skip('icu punycode tests because ICU is not present.'); - return; -} // Credit for list: http://www.i18nguy.com/markup/idna-examples.html const tests = [ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-instanceof.js nodejs-6.11.4~dfsg/test/parallel/test-instanceof.js --- nodejs-6.11.2~dfsg/test/parallel/test-instanceof.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-instanceof.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,7 +1,11 @@ 'use strict'; + require('../common'); const assert = require('assert'); + +// Regression test for instanceof, see +// https://github.com/nodejs/node/issues/7592 const F = () => {}; F.prototype = {}; assert(Object.create(F.prototype) instanceof F); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-internal-modules-expose.js nodejs-6.11.4~dfsg/test/parallel/test-internal-modules-expose.js --- nodejs-6.11.2~dfsg/test/parallel/test-internal-modules-expose.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-internal-modules-expose.js 2017-10-03 17:11:31.000000000 +0000 @@ -3,5 +3,9 @@ require('../common'); const assert = require('assert'); +const config = process.binding('config'); + +console.log(config, process.argv); assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); +assert.strictEqual(config.exposeInternals, true); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-intl.js nodejs-6.11.4~dfsg/test/parallel/test-intl.js --- nodejs-6.11.2~dfsg/test/parallel/test-intl.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-intl.js 2017-10-03 17:11:31.000000000 +0000 @@ -24,11 +24,10 @@ `"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`; assert.strictEqual(enablei18n, 0, erMsg); common.skip('Intl tests because Intl object not present.'); - } else { const erMsg = `"Intl" object is present but v8_enable_i18n_support is ${ - enablei18n}. Is this test out of date?`; + enablei18n}. Is this test out of date?`; assert.strictEqual(enablei18n, 1, erMsg); // Construct a new date at the beginning of Unix time @@ -44,7 +43,7 @@ // If list is specified and doesn't contain 'en' then return. if (process.config.variables.icu_locales && !haveLocale('en')) { - common.skip( + common.printSkipMessage( 'detailed Intl tests because English is not listed as supported.'); // Smoke test. Does it format anything, or fail? console.log(`Date(0) formatted to: ${dtf.format(date0)}`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-intl-v8BreakIterator.js nodejs-6.11.4~dfsg/test/parallel/test-intl-v8BreakIterator.js --- nodejs-6.11.2~dfsg/test/parallel/test-intl-v8BreakIterator.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-intl-v8BreakIterator.js 2017-10-03 17:11:31.000000000 +0000 @@ -2,9 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (global.Intl === undefined || Intl.v8BreakIterator === undefined) { - return common.skip('no Intl'); -} +if (global.Intl === undefined || Intl.v8BreakIterator === undefined) + common.skip('no Intl'); try { new Intl.v8BreakIterator(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-cluster.js nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-cluster.js --- nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-cluster.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-cluster.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -7,11 +10,6 @@ console.error('Cluster listen fd test', process.argv[2] || 'runner'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - // Process relationship is: // // parent: the test main script diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-detached-inherit.js nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-detached-inherit.js --- nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-detached-inherit.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-detached-inherit.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-detached.js nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-detached.js --- nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-detached.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-detached.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); @@ -66,7 +64,6 @@ }).listen(0, function() { console.error('server listening on %d', this.address().port); - const spawn = require('child_process').spawn; const child = spawn(process.execPath, [__filename, 'child'], { stdio: [ 'ignore', 'ignore', 'ignore', server._handle ], detached: true diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-server.js nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-listen-fd-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-listen-fd-server.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-module-circular-symlinks.js nodejs-6.11.4~dfsg/test/parallel/test-module-circular-symlinks.js --- nodejs-6.11.2~dfsg/test/parallel/test-module-circular-symlinks.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-module-circular-symlinks.js 2017-10-03 17:11:31.000000000 +0000 @@ -50,7 +50,6 @@ } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(tmpDir, 'index.js'), diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-module-loading-error.js nodejs-6.11.4~dfsg/test/parallel/test-module-loading-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-module-loading-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-module-loading-error.js 2017-10-03 17:11:31.000000000 +0000 @@ -8,14 +8,14 @@ win32: ['%1 is not a valid Win32 application'], linux: ['file too short', 'Exec format error'], sunos: ['unknown file type', 'not an ELF file'], - darwin: ['file too short'] + darwin: ['file too short'], + aix: ['Cannot load module', + 'Cannot run a file that does not have a valid format.'] }; const dlerror_msg = error_desc[process.platform]; -if (!dlerror_msg) { +if (!dlerror_msg) common.skip('platform not supported.'); - return; -} try { require('../fixtures/module-loading-error.node'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-module-loading-globalpaths.js nodejs-6.11.4~dfsg/test/parallel/test-module-loading-globalpaths.js --- nodejs-6.11.2~dfsg/test/parallel/test-module-loading-globalpaths.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-module-loading-globalpaths.js 2017-10-03 17:11:31.000000000 +0000 @@ -47,11 +47,11 @@ fs.mkdirSync(noPkgHomeDir); env['HOME'] = env['USERPROFILE'] = noPkgHomeDir; assert.throws( - () => { - child_process.execFileSync(testExecPath, [ __filename, 'child' ], - { encoding: 'utf8', env: env }); - }, - new RegExp(`Cannot find module '${pkgName}'`)); + () => { + child_process.execFileSync(testExecPath, [ __filename, 'child' ], + { encoding: 'utf8', env: env }); + }, + new RegExp(`Cannot find module '${pkgName}'`)); // Test module in $HOME/.node_modules. const modHomeDir = path.join(testFixturesDir, 'home-pkg-in-node_modules'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-module-symlinked-peer-modules.js nodejs-6.11.4~dfsg/test/parallel/test-module-symlinked-peer-modules.js --- nodejs-6.11.2~dfsg/test/parallel/test-module-symlinked-peer-modules.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-module-symlinked-peer-modules.js 2017-10-03 17:11:31.000000000 +0000 @@ -46,7 +46,6 @@ } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(moduleA, 'package.json'), diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-better-error-messages-path.js nodejs-6.11.4~dfsg/test/parallel/test-net-better-error-messages-path.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-better-error-messages-path.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-better-error-messages-path.js 2017-10-03 17:11:31.000000000 +0000 @@ -2,12 +2,21 @@ const common = require('../common'); const net = require('net'); const assert = require('assert'); -const fp = '/tmp/fadagagsdfgsdf'; -const c = net.connect(fp); -c.on('connect', common.mustNotCall()); +{ + const fp = '/tmp/fadagagsdfgsdf'; + const c = net.connect(fp); -c.on('error', common.mustCall(function(e) { - assert.strictEqual(e.code, 'ENOENT'); - assert.strictEqual(e.message, `connect ENOENT ${fp}`); -})); + c.on('connect', common.mustNotCall()); + c.on('error', common.mustCall(function(e) { + assert.strictEqual(e.code, 'ENOENT'); + assert.strictEqual(e.message, `connect ENOENT ${fp}`); + })); +} + +{ + assert.throws( + () => net.createConnection({ path: {} }), + /"path" option must be a string: \[object Object]/ + ); +} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-can-reset-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-net-can-reset-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-can-reset-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-can-reset-timeout.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); + +// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481 + const net = require('net'); const server = net.createServer(common.mustCall(function(stream) { @@ -7,7 +10,7 @@ stream.resume(); - stream.on('timeout', common.mustCall(function() { + stream.once('timeout', common.mustCall(function() { console.log('timeout'); // try to reset the timeout. stream.write('WHAT.'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-connect-options-ipv6.js nodejs-6.11.4~dfsg/test/parallel/test-net-connect-options-ipv6.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-connect-options-ipv6.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-connect-options-ipv6.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const net = require('net'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const hosts = common.localIPv6Hosts; let hostIdx = 0; let host = hosts[hostIdx]; @@ -15,7 +13,7 @@ const server = net.createServer({allowHalfOpen: true}, function(socket) { socket.resume(); - socket.on('end', common.mustCall(function() {})); + socket.on('end', common.mustCall()); socket.end(); }); @@ -60,8 +58,8 @@ if (host) tryConnect(); else { - common.skip('no IPv6 localhost support'); server.close(); + common.skip('no IPv6 localhost support'); } return; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-connect-options.js nodejs-6.11.4~dfsg/test/parallel/test-net-connect-options.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-connect-options.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-connect-options.js 2017-10-03 17:11:31.000000000 +0000 @@ -7,7 +7,7 @@ allowHalfOpen: true }, common.mustCall(function(socket) { socket.resume(); - socket.on('end', common.mustCall(function() {})); + socket.on('end', common.mustCall()); socket.end(); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-listen-close-server-callback-is-not-function.js nodejs-6.11.4~dfsg/test/parallel/test-net-listen-close-server-callback-is-not-function.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-listen-close-server-callback-is-not-function.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-listen-close-server-callback-is-not-function.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,7 +4,7 @@ const server = net.createServer(common.mustNotCall()); -server.on('close', common.mustCall(function() {})); +server.on('close', common.mustCall()); server.listen(0, common.mustNotCall()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-listen-exclusive-random-ports.js nodejs-6.11.4~dfsg/test/parallel/test-net-listen-exclusive-random-ports.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-listen-exclusive-random-ports.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-listen-exclusive-random-ports.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,11 +1,10 @@ 'use strict'; + require('../common'); const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -function noop() {} - if (cluster.isMaster) { const worker1 = cluster.fork(); @@ -21,7 +20,7 @@ }); }); } else { - const server = net.createServer(noop); + const server = net.createServer(() => {}); server.on('error', function(err) { process.send(err.code); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-listen-port-option.js nodejs-6.11.4~dfsg/test/parallel/test-net-listen-port-option.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-listen-port-option.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-listen-port-option.js 2017-10-03 17:11:31.000000000 +0000 @@ -26,3 +26,47 @@ net.Server().listen({ port: port }, common.fail); }, /invalid listen argument/i); }); + +// Repeat the tests, passing port as an argument, which validates somewhat +// differently. + +net.Server().listen(undefined, close); +net.Server().listen('0', close); + +// 'nan', skip, treated as a path, not a port +//'+Infinity', skip, treated as a path, not a port +//'-Infinity' skip, treated as a path, not a port + +// 4.x treats these as 0, but 6.x treats them as invalid numbers. +[ + -1, + 123.456, + 0x10000, + 1 / 0, + -1 / 0, +].forEach(function(port) { + assert.throws(function() { + net.Server().listen(port, common.fail); + }, /"port" argument must be >= 0 and < 65536/i); +}); + +// null is treated as 0 +net.Server().listen(null, close); + +// false/true are converted to 0/1, arguably a bug, but fixing would be +// semver-major. Note that true fails when port 1 low can't be listened on by +// unprivileged processes (Linux) but the listen does succeed on some Windows +// versions. +net.Server().listen(false, close); + +(function() { + const done = common.mustCall(function(err) { + if (err) + return assert.strictEqual(err.code, 'EACCES'); + + assert.strictEqual(this.address().port, 1); + this.close(); + }); + + net.Server().listen(true).on('error', done).on('listening', done); +})(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-options-lookup.js nodejs-6.11.4~dfsg/test/parallel/test-net-options-lookup.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-options-lookup.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-options-lookup.js 2017-10-03 17:11:31.000000000 +0000 @@ -20,7 +20,7 @@ }, expectedError); } -[() => {}].forEach((input) => connectDoesNotThrow(input)); +connectDoesNotThrow(() => {}); function connectDoesNotThrow(input) { const opts = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-pause-resume-connecting.js nodejs-6.11.4~dfsg/test/parallel/test-net-pause-resume-connecting.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-pause-resume-connecting.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-pause-resume-connecting.js 2017-10-03 17:11:31.000000000 +0000 @@ -19,27 +19,27 @@ server.listen(0, function() { // Client 1 - conn = require('net').createConnection(this.address().port, 'localhost'); + conn = net.createConnection(this.address().port, 'localhost'); conn.resume(); conn.on('data', onDataOk); // Client 2 - conn = require('net').createConnection(this.address().port, 'localhost'); + conn = net.createConnection(this.address().port, 'localhost'); conn.pause(); conn.resume(); conn.on('data', onDataOk); // Client 3 - conn = require('net').createConnection(this.address().port, 'localhost'); + conn = net.createConnection(this.address().port, 'localhost'); conn.pause(); conn.on('data', common.mustNotCall()); scheduleTearDown(conn); // Client 4 - conn = require('net').createConnection(this.address().port, 'localhost'); + conn = net.createConnection(this.address().port, 'localhost'); conn.resume(); conn.pause(); conn.resume(); @@ -47,7 +47,7 @@ // Client 5 - conn = require('net').createConnection(this.address().port, 'localhost'); + conn = net.createConnection(this.address().port, 'localhost'); conn.resume(); conn.resume(); conn.pause(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-server-bind.js nodejs-6.11.4~dfsg/test/parallel/test-net-server-bind.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-server-bind.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-server-bind.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - - -// With only a callback, server should get a port assigned by the OS - -let address0; -const server0 = net.createServer(function(socket) { }); - -server0.listen(function() { - address0 = server0.address(); - console.log('address0 %j', address0); - server0.close(); -}); - - -// No callback to listen(), assume we can bind in 100 ms - -let address1; -let connectionKey1; -const server1 = net.createServer(function(socket) { }); - -server1.listen(common.PORT); - -setTimeout(function() { - address1 = server1.address(); - connectionKey1 = server1._connectionKey; - console.log('address1 %j', address1); - server1.close(); -}, 100); - - -// Callback to listen() - -let address2; -const server2 = net.createServer(function(socket) { }); - -server2.listen(common.PORT + 1, function() { - address2 = server2.address(); - console.log('address2 %j', address2); - server2.close(); -}); - - -// Backlog argument - -let address3; -const server3 = net.createServer(function(socket) { }); - -server3.listen(common.PORT + 2, '0.0.0.0', 127, function() { - address3 = server3.address(); - console.log('address3 %j', address3); - server3.close(); -}); - - -// Backlog argument without host argument - -let address4; -const server4 = net.createServer(function(socket) { }); - -server4.listen(common.PORT + 3, 127, function() { - address4 = server4.address(); - console.log('address4 %j', address4); - server4.close(); -}); - - -process.on('exit', function() { - assert.ok(address0.port > 100); - assert.strictEqual(common.PORT, address1.port); - - let expectedConnectionKey1; - - if (address1.family === 'IPv6') - expectedConnectionKey1 = `6::::${address1.port}`; - else - expectedConnectionKey1 = `4:0.0.0.0:${address1.port}`; - - assert.strictEqual(connectionKey1, expectedConnectionKey1); - assert.strictEqual(common.PORT + 1, address2.port); - assert.strictEqual(common.PORT + 2, address3.port); - assert.strictEqual(common.PORT + 3, address4.port); -}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-server-connections.js nodejs-6.11.4~dfsg/test/parallel/test-net-server-connections.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-server-connections.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-server-connections.js 2017-10-03 17:11:31.000000000 +0000 @@ -6,7 +6,6 @@ // test that server.connections property is no longer enumerable now that it // has been marked as deprecated - const server = new net.Server(); -assert.strictEqual(Object.keys(server).indexOf('connections'), -1); +assert.strictEqual(Object.keys(server).includes('connections'), false); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-socket-destroy-twice.js nodejs-6.11.4~dfsg/test/parallel/test-net-socket-destroy-twice.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-socket-destroy-twice.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-socket-destroy-twice.js 2017-10-03 17:11:31.000000000 +0000 @@ -11,5 +11,5 @@ conn.destroy(); })); -conn.on('close', common.mustCall(function() {})); +conn.on('close', common.mustCall()); server.close(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-socket-local-address.js nodejs-6.11.4~dfsg/test/parallel/test-net-socket-local-address.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-socket-local-address.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-socket-local-address.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - // skip test in FreeBSD jails -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const net = require('net'); let conns = 0; const clientLocalPorts = []; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-socket-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-net-socket-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-socket-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-socket-timeout.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,10 +4,9 @@ const assert = require('assert'); // Verify that invalid delays throw -const noop = () => {}; const s = new net.Socket(); const nonNumericDelays = [ - '100', true, false, undefined, null, '', {}, noop, [] + '100', true, false, undefined, null, '', {}, () => {}, [] ]; const badRangeDelays = [-0.001, -1, -Infinity, Infinity, NaN]; const validDelays = [0, 0.001, 1, 1e6]; @@ -15,19 +14,19 @@ for (let i = 0; i < nonNumericDelays.length; i++) { assert.throws(function() { - s.setTimeout(nonNumericDelays[i], noop); + s.setTimeout(nonNumericDelays[i], () => {}); }, TypeError); } for (let i = 0; i < badRangeDelays.length; i++) { assert.throws(function() { - s.setTimeout(badRangeDelays[i], noop); + s.setTimeout(badRangeDelays[i], () => {}); }, RangeError); } for (let i = 0; i < validDelays.length; i++) { assert.doesNotThrow(function() { - s.setTimeout(validDelays[i], noop); + s.setTimeout(validDelays[i], () => {}); }); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-net-stream.js nodejs-6.11.4~dfsg/test/parallel/test-net-stream.js --- nodejs-6.11.2~dfsg/test/parallel/test-net-stream.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-net-stream.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,4 +1,5 @@ 'use strict'; + require('../common'); const assert = require('assert'); const net = require('net'); @@ -32,7 +33,7 @@ }); for (let i = 0; i < N; ++i) { - socket.write(buf, function() { }); + socket.write(buf, () => {}); } socket.end(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-next-tick.js nodejs-6.11.4~dfsg/test/parallel/test-next-tick.js --- nodejs-6.11.2~dfsg/test/parallel/test-next-tick.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-next-tick.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,15 +4,15 @@ process.nextTick(common.mustCall(function() { process.nextTick(common.mustCall(function() { - process.nextTick(common.mustCall(function() {})); + process.nextTick(common.mustCall()); })); })); setTimeout(common.mustCall(function() { - process.nextTick(common.mustCall(function() {})); + process.nextTick(common.mustCall()); }), 50); -process.nextTick(common.mustCall(function() {})); +process.nextTick(common.mustCall()); const obj = {}; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-npm-install.js nodejs-6.11.4~dfsg/test/parallel/test-npm-install.js --- nodejs-6.11.2~dfsg/test/parallel/test-npm-install.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-npm-install.js 2017-10-03 17:11:31.000000000 +0000 @@ -2,7 +2,7 @@ const common = require('../common'); const path = require('path'); -const spawn = require('child_process').spawn; +const exec = require('child_process').exec; const assert = require('assert'); const fs = require('fs'); @@ -22,11 +22,6 @@ 'npm-cli.js' ); -const args = [ - npmPath, - 'install' -]; - const pkgContent = JSON.stringify({ dependencies: { 'package-name': `${common.fixturesDir}/packages/main` @@ -37,23 +32,29 @@ fs.writeFileSync(pkgPath, pkgContent); -const env = Object.create(process.env); -env['PATH'] = path.dirname(process.execPath); -env['NPM_CONFIG_PREFIX'] = path.join(npmSandbox, 'npm-prefix'); -env['NPM_CONFIG_TMP'] = path.join(npmSandbox, 'npm-tmp'); -env['HOME'] = path.join(npmSandbox, 'home'); +const env = Object.assign({}, process.env, { + PATH: path.dirname(process.execPath), + NPM_CONFIG_PREFIX: path.join(npmSandbox, 'npm-prefix'), + NPM_CONFIG_TMP: path.join(npmSandbox, 'npm-tmp'), + HOME: path.join(npmSandbox, 'home'), +}); -const proc = spawn(process.execPath, args, { +exec(`${process.execPath} ${npmPath} install`, { cwd: installDir, env: env -}); +}, common.mustCall(handleExit)); + +function handleExit(error, stdout, stderr) { + const code = error ? error.code : 0; + const signalCode = error ? error.signal : null; + + if (code !== 0) { + process.stderr.write(stderr); + } -function handleExit(code, signalCode) { assert.strictEqual(code, 0, `npm install got error code ${code}`); assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`); assert.doesNotThrow(function() { fs.accessSync(`${installDir}/node_modules/package-name`); }); } - -proc.on('exit', common.mustCall(handleExit)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-os.js nodejs-6.11.4~dfsg/test/parallel/test-os.js --- nodejs-6.11.2~dfsg/test/parallel/test-os.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-os.js 2017-10-03 17:11:31.000000000 +0000 @@ -103,25 +103,26 @@ console.error(interfaces); switch (platform) { case 'linux': - { - const filter = (e) => e.address === '127.0.0.1'; - const actual = interfaces.lo.filter(filter); - const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', - mac: '00:00:00:00:00:00', family: 'IPv4', - internal: true }]; - assert.deepStrictEqual(actual, expected); - break; - } + { + const filter = + (e) => e.address === '127.0.0.1' && e.netmask === '255.0.0.0'; + const actual = interfaces.lo.filter(filter); + const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', + mac: '00:00:00:00:00:00', family: 'IPv4', + internal: true }]; + assert.deepStrictEqual(actual, expected); + break; + } case 'win32': - { - const filter = (e) => e.address === '127.0.0.1'; - const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter); - const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', - mac: '00:00:00:00:00:00', family: 'IPv4', - internal: true }]; - assert.deepStrictEqual(actual, expected); - break; - } + { + const filter = (e) => e.address === '127.0.0.1'; + const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter); + const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', + mac: '00:00:00:00:00:00', family: 'IPv4', + internal: true }]; + assert.deepStrictEqual(actual, expected); + break; + } } const EOL = os.EOL; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-path.js nodejs-6.11.4~dfsg/test/parallel/test-path.js --- nodejs-6.11.2~dfsg/test/parallel/test-path.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-path.js 2017-10-03 17:11:31.000000000 +0000 @@ -51,6 +51,16 @@ assert.strictEqual(path.win32.basename('aaa\\bbb\\\\\\\\', 'bbb'), 'bbb'); assert.strictEqual(path.win32.basename('aaa\\bbb', 'bb'), 'b'); assert.strictEqual(path.win32.basename('aaa\\bbb', 'b'), 'bb'); +assert.strictEqual(path.win32.basename('C:'), ''); +assert.strictEqual(path.win32.basename('C:.'), '.'); +assert.strictEqual(path.win32.basename('C:\\'), ''); +assert.strictEqual(path.win32.basename('C:\\dir\\base.ext'), 'base.ext'); +assert.strictEqual(path.win32.basename('C:\\basename.ext'), 'basename.ext'); +assert.strictEqual(path.win32.basename('C:basename.ext'), 'basename.ext'); +assert.strictEqual(path.win32.basename('C:basename.ext\\'), 'basename.ext'); +assert.strictEqual(path.win32.basename('C:basename.ext\\\\'), 'basename.ext'); +assert.strictEqual(path.win32.basename('C:foo'), 'foo'); +assert.strictEqual(path.win32.basename('file:stream'), 'file:stream'); // On unix a backslash is just treated as any other character. assert.strictEqual(path.posix.basename('\\dir\\basename.ext'), @@ -99,6 +109,8 @@ assert.strictEqual(path.win32.dirname('c:foo\\bar'), 'c:foo'); assert.strictEqual(path.win32.dirname('c:foo\\bar\\'), 'c:foo'); assert.strictEqual(path.win32.dirname('c:foo\\bar\\baz'), 'c:foo\\bar'); +assert.strictEqual(path.win32.dirname('file:stream'), '.'); +assert.strictEqual(path.win32.dirname('dir\\file:stream'), 'dir'); assert.strictEqual(path.win32.dirname('\\\\unc\\share'), '\\\\unc\\share'); assert.strictEqual(path.win32.dirname('\\\\unc\\share\\foo'), @@ -166,6 +178,7 @@ ['file./', '.'], ['file.//', '.'], ].forEach((test) => { + const expected = test[1]; [path.posix.extname, path.win32.extname].forEach((extname) => { let input = test[0]; let os; @@ -176,12 +189,19 @@ os = 'posix'; } const actual = extname(input); - const expected = test[1]; const message = `path.${os}.extname(${JSON.stringify(input)})\n expect=${ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; if (actual !== expected) failures.push(`\n${message}`); }); + { + const input = `C:${test[0].replace(slashRE, '\\')}`; + const actual = path.win32.extname(input); + const message = `path.win32.extname(${JSON.stringify(input)})\n expect=${ + JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; + if (actual !== expected) + failures.push(`\n${message}`); + } }); assert.strictEqual(failures.length, 0, failures.join('')); @@ -266,51 +286,51 @@ path.win32.join, joinTests[0][1].slice(0).concat( [// arguments result - // UNC path expected - [['//foo/bar'], '\\\\foo\\bar\\'], - [['\\/foo/bar'], '\\\\foo\\bar\\'], - [['\\\\foo/bar'], '\\\\foo\\bar\\'], - // UNC path expected - server and share separate - [['//foo', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', 'bar'], '\\\\foo\\bar\\'], - [['//foo', '/bar'], '\\\\foo\\bar\\'], - // UNC path expected - questionable - [['//foo', '', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', '', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', '', '/bar'], '\\\\foo\\bar\\'], - // UNC path expected - even more questionable - [['', '//foo', 'bar'], '\\\\foo\\bar\\'], - [['', '//foo/', 'bar'], '\\\\foo\\bar\\'], - [['', '//foo/', '/bar'], '\\\\foo\\bar\\'], - // No UNC path expected (no double slash in first component) - [['\\', 'foo/bar'], '\\foo\\bar'], - [['\\', '/foo/bar'], '\\foo\\bar'], - [['', '/', '/foo/bar'], '\\foo\\bar'], - // No UNC path expected (no non-slashes in first component - - // questionable) - [['//', 'foo/bar'], '\\foo\\bar'], - [['//', '/foo/bar'], '\\foo\\bar'], - [['\\\\', '/', '/foo/bar'], '\\foo\\bar'], - [['//'], '/'], - // No UNC path expected (share name missing - questionable). - [['//foo'], '\\foo'], - [['//foo/'], '\\foo\\'], - [['//foo', '/'], '\\foo\\'], - [['//foo', '', '/'], '\\foo\\'], - // No UNC path expected (too many leading slashes - questionable) - [['///foo/bar'], '\\foo\\bar'], - [['////foo', 'bar'], '\\foo\\bar'], - [['\\\\\\/foo/bar'], '\\foo\\bar'], - // Drive-relative vs drive-absolute paths. This merely describes the - // status quo, rather than being obviously right - [['c:'], 'c:.'], - [['c:.'], 'c:.'], - [['c:', ''], 'c:.'], - [['', 'c:'], 'c:.'], - [['c:.', '/'], 'c:.\\'], - [['c:.', 'file'], 'c:file'], - [['c:', '/'], 'c:\\'], - [['c:', 'file'], 'c:\\file'] + // UNC path expected + [['//foo/bar'], '\\\\foo\\bar\\'], + [['\\/foo/bar'], '\\\\foo\\bar\\'], + [['\\\\foo/bar'], '\\\\foo\\bar\\'], + // UNC path expected - server and share separate + [['//foo', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', 'bar'], '\\\\foo\\bar\\'], + [['//foo', '/bar'], '\\\\foo\\bar\\'], + // UNC path expected - questionable + [['//foo', '', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', '', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', '', '/bar'], '\\\\foo\\bar\\'], + // UNC path expected - even more questionable + [['', '//foo', 'bar'], '\\\\foo\\bar\\'], + [['', '//foo/', 'bar'], '\\\\foo\\bar\\'], + [['', '//foo/', '/bar'], '\\\\foo\\bar\\'], + // No UNC path expected (no double slash in first component) + [['\\', 'foo/bar'], '\\foo\\bar'], + [['\\', '/foo/bar'], '\\foo\\bar'], + [['', '/', '/foo/bar'], '\\foo\\bar'], + // No UNC path expected (no non-slashes in first component - + // questionable) + [['//', 'foo/bar'], '\\foo\\bar'], + [['//', '/foo/bar'], '\\foo\\bar'], + [['\\\\', '/', '/foo/bar'], '\\foo\\bar'], + [['//'], '/'], + // No UNC path expected (share name missing - questionable). + [['//foo'], '\\foo'], + [['//foo/'], '\\foo\\'], + [['//foo', '/'], '\\foo\\'], + [['//foo', '', '/'], '\\foo\\'], + // No UNC path expected (too many leading slashes - questionable) + [['///foo/bar'], '\\foo\\bar'], + [['////foo', 'bar'], '\\foo\\bar'], + [['\\\\\\/foo/bar'], '\\foo\\bar'], + // Drive-relative vs drive-absolute paths. This merely describes the + // status quo, rather than being obviously right + [['c:'], 'c:.'], + [['c:.'], 'c:.'], + [['c:', ''], 'c:.'], + [['', 'c:'], 'c:.'], + [['c:.', '/'], 'c:.\\'], + [['c:.', 'file'], 'c:file'], + [['c:', '/'], 'c:\\'], + [['c:', 'file'], 'c:\\file'] ] ) ]); @@ -385,6 +405,12 @@ assert.strictEqual(path.win32.normalize('//server/share/dir/file.ext'), '\\\\server\\share\\dir\\file.ext'); assert.strictEqual(path.win32.normalize('/a/b/c/../../../x/y/z'), '\\x\\y\\z'); +assert.strictEqual(path.win32.normalize('C:'), 'C:.'); +assert.strictEqual(path.win32.normalize('C:..\\abc'), 'C:..\\abc'); +assert.strictEqual(path.win32.normalize('C:..\\..\\abc\\..\\def'), + 'C:..\\..\\def'); +assert.strictEqual(path.win32.normalize('C:\\.'), 'C:\\'); +assert.strictEqual(path.win32.normalize('file:stream'), 'file:stream'); assert.strictEqual(path.posix.normalize('./fixtures///b/../b/c.js'), 'fixtures/b/c.js'); @@ -440,7 +466,7 @@ const expected = test[1]; const message = `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${ - JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; + JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; if (actual !== expected && actualAlt !== expected) failures.push(`\n${message}`); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-path-parse-format.js nodejs-6.11.4~dfsg/test/parallel/test-path-parse-format.js --- nodejs-6.11.2~dfsg/test/parallel/test-path-parse-format.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-path-parse-format.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,24 +4,33 @@ const path = require('path'); const winPaths = [ - 'C:\\path\\dir\\index.html', - 'C:\\another_path\\DIR\\1\\2\\33\\\\index', - 'another_path\\DIR with spaces\\1\\2\\33\\index', - '\\foo\\C:', - 'file', - '.\\file', - 'C:\\', - '', + // [path, root] + ['C:\\path\\dir\\index.html', 'C:\\'], + ['C:\\another_path\\DIR\\1\\2\\33\\\\index', 'C:\\'], + ['another_path\\DIR with spaces\\1\\2\\33\\index', ''], + ['\\', '\\'], + ['\\foo\\C:', '\\'], + ['file', ''], + ['file:stream', ''], + ['.\\file', ''], + ['C:', 'C:'], + ['C:.', 'C:'], + ['C:..', 'C:'], + ['C:abc', 'C:'], + ['C:\\', 'C:\\'], + ['C:\\abc', 'C:\\' ], + ['', ''], // unc - '\\\\server\\share\\file_path', - '\\\\server two\\shared folder\\file path.zip', - '\\\\teela\\admin$\\system32', - '\\\\?\\UNC\\server\\share' + ['\\\\server\\share\\file_path', '\\\\server\\share\\'], + ['\\\\server two\\shared folder\\file path.zip', + '\\\\server two\\shared folder\\'], + ['\\\\teela\\admin$\\system32', '\\\\teela\\admin$\\'], + ['\\\\?\\UNC\\server\\share', '\\\\?\\UNC\\'] ]; const winSpecialCaseParseTests = [ - ['/foo/bar', {root: '/'}] + ['/foo/bar', { root: '/' }], ]; const winSpecialCaseFormatTests = [ @@ -35,26 +44,27 @@ ]; const unixPaths = [ - '/home/user/dir/file.txt', - '/home/user/a dir/another File.zip', - '/home/user/a dir//another&File.', - '/home/user/a$$$dir//another File.zip', - 'user/dir/another File.zip', - 'file', - '.\\file', - './file', - 'C:\\foo', - '/', - '', - '.', - '..', - '/foo', - '/foo.', - '/foo.bar', - '/.', - '/.foo', - '/.foo.bar', - '/foo/bar.baz', + // [path, root] + ['/home/user/dir/file.txt', '/'], + ['/home/user/a dir/another File.zip', '/'], + ['/home/user/a dir//another&File.', '/'], + ['/home/user/a$$$dir//another File.zip', '/'], + ['user/dir/another File.zip', ''], + ['file', ''], + ['.\\file', ''], + ['./file', ''], + ['C:\\foo', ''], + ['/', '/'], + ['', ''], + ['.', ''], + ['..', ''], + ['/foo', '/'], + ['/foo.', '/'], + ['/foo.bar', '/'], + ['/.', '/'], + ['/.foo', '/'], + ['/.foo.bar', '/'], + ['/foo/bar.baz', '/'] ]; const unixSpecialCaseFormatTests = [ @@ -144,7 +154,7 @@ if (!failed) { for (let i = 0; i < actualKeys.length; ++i) { const key = actualKeys[i]; - if (expectedKeys.indexOf(key) === -1 || actual[key] !== expected[key]) { + if (!expectedKeys.includes(key) || actual[key] !== expected[key]) { failed = true; break; } @@ -165,7 +175,7 @@ } function checkParseFormat(path, paths) { - paths.forEach(function(element) { + paths.forEach(function([element, root]) { const output = path.parse(element); assert.strictEqual(typeof output.root, 'string'); assert.strictEqual(typeof output.dir, 'string'); @@ -173,6 +183,8 @@ assert.strictEqual(typeof output.ext, 'string'); assert.strictEqual(typeof output.name, 'string'); assert.strictEqual(path.format(output), element); + assert.strictEqual(output.root, root); + assert(output.dir.startsWith(output.root)); assert.strictEqual(output.dir, output.dir ? path.dirname(element) : ''); assert.strictEqual(output.base, path.basename(element)); assert.strictEqual(output.ext, path.extname(element)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-pipe-writev.js nodejs-6.11.4~dfsg/test/parallel/test-pipe-writev.js --- nodejs-6.11.2~dfsg/test/parallel/test-pipe-writev.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-pipe-writev.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Unix-specific test'); + const assert = require('assert'); const net = require('net'); -if (common.isWindows) { - common.skip('Unix-specific test'); - return; -} - common.refreshTmpDir(); const server = net.createServer((connection) => { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-preload.js nodejs-6.11.4~dfsg/test/parallel/test-preload.js --- nodejs-6.11.2~dfsg/test/parallel/test-preload.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-preload.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); +// Refs: https://github.com/nodejs/node/pull/2253 +if (common.isSunOS) + common.skip('unreliable on SunOS'); + const assert = require('assert'); const path = require('path'); const childProcess = require('child_process'); -// Refs: https://github.com/nodejs/node/pull/2253 -if (common.isSunOS) { - common.skip('unreliable on SunOS'); - return; -} - const nodeBinary = process.argv[0]; const preloadOption = (preloads) => { @@ -106,7 +104,7 @@ // also test that duplicated preload only gets loaded once childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');" ${ - preloadOption([fixtureA, fixtureB])}`, + preloadOption([fixtureA, fixtureB])}`, function(err, stdout, stderr) { if (err) throw err; assert.strictEqual(stdout, 'A\nB\nhello\n'); @@ -127,7 +125,7 @@ childProcess.exec( `"${nodeBinary}" --require "${fixture('cluster-preload.js')}" "${ - fixture('cluster-preload-test.js')}"`, + fixture('cluster-preload-test.js')}"`, function(err, stdout, stderr) { if (err) throw err; assert.ok(/worker terminated with code 43/.test(stdout)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-execpath.js nodejs-6.11.4~dfsg/test/parallel/test-process-execpath.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-execpath.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-execpath.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('symlinks are weird on windows'); + const assert = require('assert'); const child_process = require('child_process'); const path = require('path'); @@ -7,11 +10,6 @@ assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); -if (common.isWindows) { - common.skip('symlinks are weird on windows'); - return; -} - if (process.argv[2] === 'child') { // The console.log() output is part of the test here. console.log(process.execPath); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-exit-code.js nodejs-6.11.4~dfsg/test/parallel/test-process-exit-code.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-exit-code.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-exit-code.js 2017-10-03 17:11:31.000000000 +0000 @@ -62,22 +62,23 @@ } function parent() { + const { spawn } = require('child_process'); + const node = process.execPath; + const f = __filename; + const option = { stdio: [ 0, 1, 'ignore' ] }; + + const test = (arg, exit) => { + spawn(node, [f, arg], option).on('exit', (code) => { + assert.strictEqual( + code, exit, + `wrong exit for ${arg}\nexpected:${exit} but got:${code}`); + console.log('ok - %s exited with %d', arg, exit); + }); + }; + test('child1', 42); test('child2', 42); test('child3', 0); test('child4', 1); test('child5', 99); } - -function test(arg, exit) { - const spawn = require('child_process').spawn; - const node = process.execPath; - const f = __filename; - const option = { stdio: [ 0, 1, 'ignore' ] }; - spawn(node, [f, arg], option).on('exit', function(code) { - assert.strictEqual( - code, exit, - `wrong exit for ${arg}\nexpected:${exit} but got:${code}`); - console.log('ok - %s exited with %d', arg, exit); - }); -} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-getactiverequests.js nodejs-6.11.4~dfsg/test/parallel/test-process-getactiverequests.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-getactiverequests.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-getactiverequests.js 2017-10-03 17:11:31.000000000 +0000 @@ -5,6 +5,6 @@ const fs = require('fs'); for (let i = 0; i < 12; i++) - fs.open(__filename, 'r', function() { }); + fs.open(__filename, 'r', () => {}); assert.strictEqual(12, process._getActiveRequests().length); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-geteuid-getegid.js nodejs-6.11.4~dfsg/test/parallel/test-process-geteuid-getegid.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-geteuid-getegid.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-geteuid-getegid.js 2017-10-03 17:11:31.000000000 +0000 @@ -0,0 +1,49 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); + +if (common.isWindows) { + assert.strictEqual(process.geteuid, undefined); + assert.strictEqual(process.getegid, undefined); + assert.strictEqual(process.seteuid, undefined); + assert.strictEqual(process.setegid, undefined); + return; +} + +assert.throws(() => { + process.seteuid({}); +}, /^TypeError: seteuid argument must be a number or string$/); + +assert.throws(() => { + process.seteuid('fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf'); +}, /^Error: seteuid user id does not exist$/); + +// If we're not running as super user... +if (process.getuid() !== 0) { + assert.doesNotThrow(() => { + process.getegid(); + process.geteuid(); + }); + + assert.throws(() => { + process.setegid('nobody'); + }, /^Error: (?:EPERM, .+|setegid group id does not exist)$/); + + assert.throws(() => { + process.seteuid('nobody'); + }, /^Error: (?:EPERM, .+|seteuid user id does not exist)$/); + + return; +} + +// If we are running as super user... +const oldgid = process.getegid(); +process.setegid('nobody'); +const newgid = process.getegid(); +assert.notStrictEqual(newgid, oldgid); + +const olduid = process.geteuid(); +process.seteuid('nobody'); +const newuid = process.geteuid(); +assert.notStrictEqual(newuid, olduid); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-getgroups.js nodejs-6.11.4~dfsg/test/parallel/test-process-getgroups.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-getgroups.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-getgroups.js 2017-10-03 17:11:31.000000000 +0000 @@ -3,10 +3,9 @@ // Check `id -G` and `process.getgroups()` return same groups. -if (common.isOSX) { +if (common.isOSX) common.skip('Output of `id -G` is unreliable on Darwin.'); - return; -} + const assert = require('assert'); const exec = require('child_process').exec; @@ -24,7 +23,7 @@ } function check(a, b) { - for (let i = 0; i < a.length; ++i) assert.notStrictEqual(b.indexOf(a[i]), -1); + for (let i = 0; i < a.length; ++i) assert(b.includes(a[i])); } function unique(groups) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-next-tick.js nodejs-6.11.4~dfsg/test/parallel/test-process-next-tick.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-next-tick.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-next-tick.js 2017-10-03 17:11:31.000000000 +0000 @@ -10,7 +10,7 @@ process.nextTick(common.mustCall(cb)); } -process.on('uncaughtException', common.mustCall(function() {}, N)); +process.on('uncaughtException', common.mustCall(() => {}, N)); process.on('exit', function() { process.removeAllListeners('uncaughtException'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-process-remove-all-signal-listeners.js nodejs-6.11.4~dfsg/test/parallel/test-process-remove-all-signal-listeners.js --- nodejs-6.11.2~dfsg/test/parallel/test-process-remove-all-signal-listeners.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-process-remove-all-signal-listeners.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Win32 does not support signals.'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('Win32 doesn\'t have signals, just a kind of ' + - 'emulation, insufficient for this test to apply.'); - return; -} - if (process.argv[2] !== '--do-test') { // We are the master, fork a child so we can verify it exits with correct // status. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-promises-unhandled-rejections.js nodejs-6.11.4~dfsg/test/parallel/test-promises-unhandled-rejections.js --- nodejs-6.11.2~dfsg/test/parallel/test-promises-unhandled-rejections.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-promises-unhandled-rejections.js 2017-10-03 17:11:31.000000000 +0000 @@ -12,8 +12,8 @@ function fail(error) { const stack = currentTest - ? `${error.stack}\nFrom previous event:\n${currentTest.stack}` - : error.stack; + ? `${error.stack}\nFrom previous event:\n${currentTest.stack}` + : error.stack; if (currentTest) process.stderr.write(`'${currentTest.description}' failed\n\n`); @@ -164,7 +164,7 @@ }); _reject(e); setImmediate(function() { - promise.then(common.fail, function() {}); + promise.then(common.fail, () => {}); }); }); @@ -240,7 +240,7 @@ function(done) { const e = new Error(); onUnhandledFail(done); - Promise.reject(e).then(common.fail, function() {}); + Promise.reject(e).then(common.fail, () => {}); } ); @@ -252,7 +252,7 @@ onUnhandledFail(done); new Promise(function(_, reject) { reject(e); - }).then(common.fail, function() {}); + }).then(common.fail, () => {}); } ); @@ -262,7 +262,7 @@ onUnhandledFail(done); const promise = Promise.reject(e); process.nextTick(function() { - promise.then(common.fail, function() {}); + promise.then(common.fail, () => {}); }); }); @@ -274,7 +274,7 @@ reject(e); }); process.nextTick(function() { - promise.then(common.fail, function() {}); + promise.then(common.fail, () => {}); }); }); @@ -385,7 +385,7 @@ 'rejected promise prevents unhandledRejection', function(done) { const e = new Error(); onUnhandledFail(done); - Promise.all([Promise.reject(e)]).then(common.fail, function() {}); + Promise.all([Promise.reject(e)]).then(common.fail, () => {}); }); asyncTest( @@ -401,7 +401,7 @@ }); p = Promise.all([p]); process.nextTick(function() { - p.then(common.fail, function() {}); + p.then(common.fail, () => {}); }); } ); @@ -455,7 +455,7 @@ Promise.resolve().then(function() { process.nextTick(function() { Promise.resolve().then(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -474,7 +474,7 @@ Promise.resolve().then(function() { process.nextTick(function() { Promise.resolve().then(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -494,7 +494,7 @@ Promise.resolve().then(function() { process.nextTick(function() { Promise.resolve().then(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -514,7 +514,7 @@ process.nextTick(function() { Promise.resolve().then(function() { process.nextTick(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -535,7 +535,7 @@ process.nextTick(function() { Promise.resolve().then(function() { process.nextTick(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -556,7 +556,7 @@ process.nextTick(function() { Promise.resolve().then(function() { process.nextTick(function() { - a.catch(function() {}); + a.catch(() => {}); }); }); }); @@ -575,7 +575,7 @@ let p = Promise.reject(e); setImmediate(function() { Promise.resolve().then(function() { - p.catch(function() {}); + p.catch(() => {}); }); }); }); @@ -592,7 +592,7 @@ Promise.resolve().then(function() { Promise.resolve().then(function() { Promise.resolve().then(function() { - p.catch(function() {}); + p.catch(() => {}); }); }); }); @@ -614,7 +614,7 @@ Promise.resolve().then(function() { Promise.resolve().then(function() { Promise.resolve().then(function() { - p.catch(function() {}); + p.catch(() => {}); }); }); }); @@ -682,7 +682,7 @@ const p = Promise.reject(e); setTimeout(function() { try { - p.catch(function() {}); + p.catch(() => {}); } catch (e) { done(new Error('fail')); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-querystring.js nodejs-6.11.4~dfsg/test/parallel/test-querystring.js --- nodejs-6.11.2~dfsg/test/parallel/test-querystring.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-querystring.js 2017-10-03 17:11:31.000000000 +0000 @@ -72,7 +72,7 @@ const qsWeirdObjects = [ [{regexp: /./g}, 'regexp=', {'regexp': ''}], [{regexp: new RegExp('.', 'g')}, 'regexp=', {'regexp': ''}], - [{fn: function() {}}, 'fn=', {'fn': ''}], + [{fn: () => {}}, 'fn=', {'fn': ''}], [{fn: new Function('')}, 'fn=', {'fn': ''}], [{math: Math}, 'math=', {'math': ''}], [{e: extendedFunction}, 'e=', {'e': ''}], @@ -252,8 +252,8 @@ // Test limiting assert.strictEqual( - Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length, - 1); + Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length, + 1); // Test removing limit { @@ -275,7 +275,7 @@ { const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' + '%0d%ac%a2%2f%9d%eb%d8%a2%e6'); -// + // assert.strictEqual(0xd3, b[0]); assert.strictEqual(0xf2, b[1]); assert.strictEqual(0x55, b[2]); @@ -313,9 +313,9 @@ } check(qs.parse('a=a&b=b&c=c', null, null, {decodeURIComponent: demoDecode}), - {aa: 'aa', bb: 'bb', cc: 'cc'}); + {aa: 'aa', bb: 'bb', cc: 'cc'}); check(qs.parse('a=a&b=b&c=c', null, '==', {decodeURIComponent: (str) => str}), - {'a=a': '', 'b=b': '', 'c=c': ''}); + {'a=a': '', 'b=b': '', 'c=c': ''}); } // Test QueryString.unescape @@ -325,7 +325,7 @@ } check(qs.parse('a=a', null, null, {decodeURIComponent: errDecode}), - {a: 'a'}); + {a: 'a'}); } // Test custom encode diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-readline-interface.js nodejs-6.11.4~dfsg/test/parallel/test-readline-interface.js --- nodejs-6.11.2~dfsg/test/parallel/test-readline-interface.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-readline-interface.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,17 +4,16 @@ const readline = require('readline'); const EventEmitter = require('events').EventEmitter; const inherits = require('util').inherits; -const Writable = require('stream').Writable; -const Readable = require('stream').Readable; +const { Writable, Readable } = require('stream'); function FakeInput() { EventEmitter.call(this); } inherits(FakeInput, EventEmitter); -FakeInput.prototype.resume = function() {}; -FakeInput.prototype.pause = function() {}; -FakeInput.prototype.write = function() {}; -FakeInput.prototype.end = function() {}; +FakeInput.prototype.resume = () => {}; +FakeInput.prototype.pause = () => {}; +FakeInput.prototype.write = () => {}; +FakeInput.prototype.end = () => {}; function isWarned(emitter) { for (const name in emitter) { @@ -41,192 +40,248 @@ } { - // Maximum crlfDelay is 2000ms + // set crlfDelay to float 100.5ms const fi = new FakeInput(); const rli = new readline.Interface({ input: fi, output: fi, - crlfDelay: 1 << 30 + crlfDelay: 100.5 }); - assert.strictEqual(rli.crlfDelay, 2000); + assert.strictEqual(rli.crlfDelay, 100.5); rli.close(); } -[ true, false ].forEach(function(terminal) { - let fi; - let rli; - let called; +{ + const fi = new FakeInput(); + const rli = new readline.Interface({ + input: fi, + output: fi, + crlfDelay: 5000 + }); + assert.strictEqual(rli.crlfDelay, 5000); + rli.close(); +} +[ true, false ].forEach(function(terminal) { // disable history - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal, - historySize: 0 }); - assert.strictEqual(rli.historySize, 0); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal, historySize: 0 } + ); + assert.strictEqual(rli.historySize, 0); - fi.emit('data', 'asdf\n'); - assert.deepStrictEqual(rli.history, terminal ? [] : undefined); - rli.close(); + fi.emit('data', 'asdf\n'); + assert.deepStrictEqual(rli.history, terminal ? [] : undefined); + rli.close(); + } // default history size 30 - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal}); - assert.strictEqual(rli.historySize, 30); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + assert.strictEqual(rli.historySize, 30); - fi.emit('data', 'asdf\n'); - assert.deepStrictEqual(rli.history, terminal ? ['asdf'] : undefined); - rli.close(); + fi.emit('data', 'asdf\n'); + assert.deepStrictEqual(rli.history, terminal ? ['asdf'] : undefined); + rli.close(); + } // sending a full line - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - called = false; - rli.on('line', function(line) { - called = true; - assert.strictEqual(line, 'asdf'); - }); - fi.emit('data', 'asdf\n'); - assert.ok(called); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + let called = false; + rli.on('line', function(line) { + called = true; + assert.strictEqual(line, 'asdf'); + }); + fi.emit('data', 'asdf\n'); + assert.ok(called); + } // sending a blank line - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - called = false; - rli.on('line', function(line) { - called = true; - assert.strictEqual(line, ''); - }); - fi.emit('data', '\n'); - assert.ok(called); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + let called = false; + rli.on('line', function(line) { + called = true; + assert.strictEqual(line, ''); + }); + fi.emit('data', '\n'); + assert.ok(called); + } // sending a single character with no newline - fi = new FakeInput(); - rli = new readline.Interface(fi, {}); - called = false; - rli.on('line', function(line) { - called = true; - }); - fi.emit('data', 'a'); - assert.ok(!called); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface(fi, {}); + let called = false; + rli.on('line', function(line) { + called = true; + }); + fi.emit('data', 'a'); + assert.ok(!called); + rli.close(); + } // sending a single character with no newline and then a newline - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - called = false; - rli.on('line', function(line) { - called = true; - assert.strictEqual(line, 'a'); - }); - fi.emit('data', 'a'); - assert.ok(!called); - fi.emit('data', '\n'); - assert.ok(called); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + let called = false; + rli.on('line', function(line) { + called = true; + assert.strictEqual(line, 'a'); + }); + fi.emit('data', 'a'); + assert.ok(!called); + fi.emit('data', '\n'); + assert.ok(called); + rli.close(); + } // sending multiple newlines at once - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - let expectedLines = ['foo', 'bar', 'baz']; - let callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', `${expectedLines.join('\n')}\n`); - assert.strictEqual(callCount, expectedLines.length); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar', 'baz']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', `${expectedLines.join('\n')}\n`); + assert.strictEqual(callCount, expectedLines.length); + rli.close(); + } // sending multiple newlines at once that does not end with a new line - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo', 'bar', 'baz', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', expectedLines.join('\n')); - assert.strictEqual(callCount, expectedLines.length - 1); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar', 'baz', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', expectedLines.join('\n')); + assert.strictEqual(callCount, expectedLines.length - 1); + rli.close(); + } // sending multiple newlines at once that does not end with a new(empty) // line and a `end` event - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo', 'bar', 'baz', '']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - rli.on('close', function() { - callCount++; - }); - fi.emit('data', expectedLines.join('\n')); - fi.emit('end'); - assert.strictEqual(callCount, expectedLines.length); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar', 'baz', '']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + rli.on('close', function() { + callCount++; + }); + fi.emit('data', expectedLines.join('\n')); + fi.emit('end'); + assert.strictEqual(callCount, expectedLines.length); + rli.close(); + } // sending multiple newlines at once that does not end with a new line // and a `end` event(last line is) // \r\n should emit one line event, not two - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo', 'bar', 'baz', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', expectedLines.join('\r\n')); - assert.strictEqual(callCount, expectedLines.length - 1); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar', 'baz', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', expectedLines.join('\r\n')); + assert.strictEqual(callCount, expectedLines.length - 1); + rli.close(); + } // \r\n should emit one line event when split across multiple writes. - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo', 'bar', 'baz', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - expectedLines.forEach(function(line) { - fi.emit('data', `${line}\r`); - fi.emit('data', '\n'); - }); - assert.strictEqual(callCount, expectedLines.length); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar', 'baz', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + expectedLines.forEach(function(line) { + fi.emit('data', `${line}\r`); + fi.emit('data', '\n'); + }); + assert.strictEqual(callCount, expectedLines.length); + rli.close(); + } // \r should behave like \n when alone - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: true }); - expectedLines = ['foo', 'bar', 'baz', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', expectedLines.join('\r')); - assert.strictEqual(callCount, expectedLines.length - 1); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: true } + ); + const expectedLines = ['foo', 'bar', 'baz', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', expectedLines.join('\r')); + assert.strictEqual(callCount, expectedLines.length - 1); + rli.close(); + } // \r at start of input should output blank line - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: true }); - expectedLines = ['', 'foo' ]; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', '\rfoo\r'); - assert.strictEqual(callCount, expectedLines.length); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: true } + ); + const expectedLines = ['', 'foo' ]; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', '\rfoo\r'); + assert.strictEqual(callCount, expectedLines.length); + rli.close(); + } // Emit two line events when the delay - // between \r and \n exceeds crlfDelay + // between \r and \n exceeds crlfDelay { const fi = new FakeInput(); const delay = 200; @@ -248,191 +303,270 @@ }), delay * 2); } + // Emit one line events when the delay between \r and \n is + // over the default crlfDelay but within the setting value + { + const fi = new FakeInput(); + const delay = 125; + const crlfDelay = common.platformTimeout(1000); + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: terminal, + crlfDelay + }); + let callCount = 0; + rli.on('line', function(line) { + callCount++; + }); + fi.emit('data', '\r'); + setTimeout(common.mustCall(() => { + fi.emit('data', '\n'); + assert.strictEqual(callCount, 1); + rli.close(); + }), delay); + } + + // set crlfDelay to `Infinity` is allowed + { + const fi = new FakeInput(); + const delay = 200; + const crlfDelay = Infinity; + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: terminal, + crlfDelay + }); + let callCount = 0; + rli.on('line', function(line) { + callCount++; + }); + fi.emit('data', '\r'); + setTimeout(common.mustCall(() => { + fi.emit('data', '\n'); + assert.strictEqual(callCount, 1); + rli.close(); + }), delay); + } + // \t when there is no completer function should behave like an ordinary - // character - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: true }); - called = false; - rli.on('line', function(line) { - assert.strictEqual(line, '\t'); - assert.strictEqual(called, false); - called = true; - }); - fi.emit('data', '\t'); - fi.emit('data', '\n'); - assert.ok(called); - rli.close(); + // character + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: true } + ); + let called = false; + rli.on('line', function(line) { + assert.strictEqual(line, '\t'); + assert.strictEqual(called, false); + called = true; + }); + fi.emit('data', '\t'); + fi.emit('data', '\n'); + assert.ok(called); + rli.close(); + } // \t does not become part of the input when there is a completer function - fi = new FakeInput(); - const completer = (line) => [[], line]; - rli = new readline.Interface({ - input: fi, - output: fi, - terminal: true, - completer: completer - }); - called = false; - rli.on('line', function(line) { - assert.strictEqual(line, 'foo'); - assert.strictEqual(called, false); - called = true; - }); - for (const character of '\tfo\to\t') { - fi.emit('data', character); + { + const fi = new FakeInput(); + const completer = (line) => [[], line]; + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: true, + completer: completer + }); + let called = false; + rli.on('line', function(line) { + assert.strictEqual(line, 'foo'); + assert.strictEqual(called, false); + called = true; + }); + for (const character of '\tfo\to\t') { + fi.emit('data', character); + } + fi.emit('data', '\n'); + assert.ok(called); + rli.close(); } - fi.emit('data', '\n'); - assert.ok(called); - rli.close(); // constructor throws if completer is not a function or undefined - fi = new FakeInput(); - assert.throws(function() { - readline.createInterface({ - input: fi, - completer: 'string is not valid' - }); - }, function(err) { - if (err instanceof TypeError) { - if (/Argument "completer" must be a function/.test(err)) { - return true; + { + const fi = new FakeInput(); + assert.throws(function() { + readline.createInterface({ + input: fi, + completer: 'string is not valid' + }); + }, function(err) { + if (err instanceof TypeError) { + if (/Argument "completer" must be a function/.test(err)) { + return true; + } } - } - return false; - }); + return false; + }); + } // duplicate lines are removed from history when // `options.removeHistoryDuplicates` is `true` - fi = new FakeInput(); - rli = new readline.Interface({ - input: fi, - output: fi, - terminal: true, - removeHistoryDuplicates: true - }); - expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', `${expectedLines.join('\n')}\n`); - assert.strictEqual(callCount, expectedLines.length); - fi.emit('keypress', '.', { name: 'up' }); // 'bat' - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'bar' - assert.notStrictEqual(rli.line, expectedLines[--callCount]); - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'baz' - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'foo' - assert.notStrictEqual(rli.line, expectedLines[--callCount]); - assert.strictEqual(rli.line, expectedLines[--callCount]); - assert.strictEqual(callCount, 0); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: true, + removeHistoryDuplicates: true + }); + const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', `${expectedLines.join('\n')}\n`); + assert.strictEqual(callCount, expectedLines.length); + fi.emit('keypress', '.', { name: 'up' }); // 'bat' + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'bar' + assert.notStrictEqual(rli.line, expectedLines[--callCount]); + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'baz' + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'foo' + assert.notStrictEqual(rli.line, expectedLines[--callCount]); + assert.strictEqual(rli.line, expectedLines[--callCount]); + assert.strictEqual(callCount, 0); + rli.close(); + } // duplicate lines are not removed from history when // `options.removeHistoryDuplicates` is `false` - fi = new FakeInput(); - rli = new readline.Interface({ - input: fi, - output: fi, - terminal: true, - removeHistoryDuplicates: false - }); - expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; - callCount = 0; - rli.on('line', function(line) { - assert.strictEqual(line, expectedLines[callCount]); - callCount++; - }); - fi.emit('data', `${expectedLines.join('\n')}\n`); - assert.strictEqual(callCount, expectedLines.length); - fi.emit('keypress', '.', { name: 'up' }); // 'bat' - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'bar' - assert.notStrictEqual(rli.line, expectedLines[--callCount]); - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'baz' - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'bar' - assert.strictEqual(rli.line, expectedLines[--callCount]); - fi.emit('keypress', '.', { name: 'up' }); // 'foo' - assert.strictEqual(rli.line, expectedLines[--callCount]); - assert.strictEqual(callCount, 0); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: true, + removeHistoryDuplicates: false + }); + const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; + let callCount = 0; + rli.on('line', function(line) { + assert.strictEqual(line, expectedLines[callCount]); + callCount++; + }); + fi.emit('data', `${expectedLines.join('\n')}\n`); + assert.strictEqual(callCount, expectedLines.length); + fi.emit('keypress', '.', { name: 'up' }); // 'bat' + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'bar' + assert.notStrictEqual(rli.line, expectedLines[--callCount]); + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'baz' + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'bar' + assert.strictEqual(rli.line, expectedLines[--callCount]); + fi.emit('keypress', '.', { name: 'up' }); // 'foo' + assert.strictEqual(rli.line, expectedLines[--callCount]); + assert.strictEqual(callCount, 0); + rli.close(); + } // sending a multi-byte utf8 char over multiple writes - const buf = Buffer.from('☮', 'utf8'); - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - callCount = 0; - rli.on('line', function(line) { - callCount++; - assert.strictEqual(line, buf.toString('utf8')); - }); - [].forEach.call(buf, function(i) { - fi.emit('data', Buffer.from([i])); - }); - assert.strictEqual(callCount, 0); - fi.emit('data', '\n'); - assert.strictEqual(callCount, 1); - rli.close(); + { + const buf = Buffer.from('☮', 'utf8'); + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + let callCount = 0; + rli.on('line', function(line) { + callCount++; + assert.strictEqual(line, buf.toString('utf8')); + }); + [].forEach.call(buf, function(i) { + fi.emit('data', Buffer.from([i])); + }); + assert.strictEqual(callCount, 0); + fi.emit('data', '\n'); + assert.strictEqual(callCount, 1); + rli.close(); + } // Regression test for repl freeze, #1968: // check that nothing fails if 'keypress' event throws. - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: true }); - const keys = []; - fi.on('keypress', function(key) { - keys.push(key); - if (key === 'X') { - throw new Error('bad thing happened'); - } - }); - try { - fi.emit('data', 'fooX'); - } catch (e) { } - fi.emit('data', 'bar'); - assert.strictEqual(keys.join(''), 'fooXbar'); - rli.close(); + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: true } + ); + const keys = []; + fi.on('keypress', function(key) { + keys.push(key); + if (key === 'X') { + throw new Error('bad thing happened'); + } + }); + try { + fi.emit('data', 'fooX'); + } catch (e) { } + fi.emit('data', 'bar'); + assert.strictEqual(keys.join(''), 'fooXbar'); + rli.close(); + } // calling readline without `new` - fi = new FakeInput(); - rli = readline.Interface({ input: fi, output: fi, terminal: terminal }); - called = false; - rli.on('line', function(line) { - called = true; - assert.strictEqual(line, 'asdf'); - }); - fi.emit('data', 'asdf\n'); - assert.ok(called); - rli.close(); + { + const fi = new FakeInput(); + const rli = readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + let called = false; + rli.on('line', function(line) { + called = true; + assert.strictEqual(line, 'asdf'); + }); + fi.emit('data', 'asdf\n'); + assert.ok(called); + rli.close(); + } if (terminal) { // question - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo']; - rli.question(expectedLines[0], function() { + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo']; + rli.question(expectedLines[0], function() { + rli.close(); + }); + const cursorPos = rli._getCursorPos(); + assert.strictEqual(cursorPos.rows, 0); + assert.strictEqual(cursorPos.cols, expectedLines[0].length); rli.close(); - }); - let cursorPos = rli._getCursorPos(); - assert.strictEqual(cursorPos.rows, 0); - assert.strictEqual(cursorPos.cols, expectedLines[0].length); - rli.close(); + } // sending a multi-line question - fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); - expectedLines = ['foo', 'bar']; - rli.question(expectedLines.join('\n'), function() { + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: fi, terminal: terminal } + ); + const expectedLines = ['foo', 'bar']; + rli.question(expectedLines.join('\n'), function() { + rli.close(); + }); + const cursorPos = rli._getCursorPos(); + assert.strictEqual(cursorPos.rows, expectedLines.length - 1); + assert.strictEqual(cursorPos.cols, expectedLines.slice(-1)[0].length); rli.close(); - }); - cursorPos = rli._getCursorPos(); - assert.strictEqual(cursorPos.rows, expectedLines.length - 1); - assert.strictEqual(cursorPos.cols, expectedLines.slice(-1)[0].length); - rli.close(); + } } // isFullWidthCodePoint() should return false for non-numeric values @@ -482,7 +616,10 @@ assert.strictEqual(readline.getStringWidth('\u001b[31m\u001b[39m'), 0); assert.strictEqual(readline.getStringWidth('> '), 2); - assert.deepStrictEqual(fi.listeners(terminal ? 'keypress' : 'data'), []); + { + const fi = new FakeInput(); + assert.deepStrictEqual(fi.listeners(terminal ? 'keypress' : 'data'), []); + } // check EventEmitter memory leak for (let i = 0; i < 12; i++) { @@ -495,36 +632,40 @@ assert.strictEqual(isWarned(process.stdout._events), false); } - //can create a new readline Interface with a null output arugument - fi = new FakeInput(); - rli = new readline.Interface({input: fi, output: null, terminal: terminal }); - - called = false; - rli.on('line', function(line) { - called = true; - assert.strictEqual(line, 'asdf'); - }); - fi.emit('data', 'asdf\n'); - assert.ok(called); + // can create a new readline Interface with a null output arugument + { + const fi = new FakeInput(); + const rli = new readline.Interface( + { input: fi, output: null, terminal: terminal } + ); - assert.doesNotThrow(function() { - rli.setPrompt('ddd> '); - }); + let called = false; + rli.on('line', function(line) { + called = true; + assert.strictEqual(line, 'asdf'); + }); + fi.emit('data', 'asdf\n'); + assert.ok(called); - assert.doesNotThrow(function() { - rli.prompt(); - }); + assert.doesNotThrow(function() { + rli.setPrompt('ddd> '); + }); - assert.doesNotThrow(function() { - rli.write('really shouldnt be seeing this'); - }); + assert.doesNotThrow(function() { + rli.prompt(); + }); - assert.doesNotThrow(function() { - rli.question('What do you think of node.js? ', function(answer) { - console.log('Thank you for your valuable feedback:', answer); - rli.close(); + assert.doesNotThrow(function() { + rli.write('really shouldnt be seeing this'); }); - }); + + assert.doesNotThrow(function() { + rli.question('What do you think of node.js? ', function(answer) { + console.log('Thank you for your valuable feedback:', answer); + rli.close(); + }); + }); + } { const expected = terminal @@ -541,7 +682,7 @@ }); const rl = readline.createInterface({ - input: new Readable({ read: () => {} }), + input: new Readable({ read: common.mustCall() }), output: output, prompt: '$ ', terminal: terminal diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-1531.js nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-1531.js --- nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-1531.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-1531.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-3542.js nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-3542.js --- nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-3542.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-3542.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// This test is only relevant on Windows. +if (!common.isWindows) + common.skip('Windows specific test.'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); -// This test is only relevant on Windows. -if (!common.isWindows) { - common.skip('Windows specific test.'); - return; -} - function test(p) { const result = fs.realpathSync(p); assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-4948.js nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-4948.js --- nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-4948.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-4948.js 2017-10-03 17:11:31.000000000 +0000 @@ -22,10 +22,10 @@ serverRes.end(); // required for test to fail - res.on('data', function(data) { }); + res.on('data', () => {}); }); - r.on('error', function(e) {}); + r.on('error', () => {}); r.end(); serverRes.write('some data'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-5051.js nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-5051.js --- nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-5051.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-5051.js 2017-10-03 17:11:31.000000000 +0000 @@ -5,7 +5,7 @@ // small stub just so we can call addRequest directly const req = { - getHeader: function() {} + getHeader: () => {} }; agent.maxSockets = 0; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-9819.js nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-9819.js --- nodejs-6.11.2~dfsg/test/parallel/test-regress-GH-9819.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-regress-GH-9819.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const execFile = require('child_process').execFile; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const setup = 'const enc = { toString: () => { throw new Error("xyz"); } };'; const scripts = [ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-envvars.js nodejs-6.11.4~dfsg/test/parallel/test-repl-envvars.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-envvars.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-envvars.js 2017-10-03 17:11:31.000000000 +0000 @@ -36,7 +36,7 @@ ]; function run(test) { - const env = test.env; + const env = Object.assign({}, process.env, test.env); const expected = test.expected; const opts = { terminal: true, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-history-perm.js nodejs-6.11.4~dfsg/test/parallel/test-repl-history-perm.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-history-perm.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-history-perm.js 2017-10-03 17:11:31.000000000 +0000 @@ -7,7 +7,6 @@ common.skip('Win32 uses ACLs for file permissions, ' + 'modes are always 0666 and says nothing about group/other ' + 'read access.'); - return; } const assert = require('assert'); @@ -19,7 +18,7 @@ // and mode 600. const stream = new Duplex(); -stream.pause = stream.resume = function() {}; +stream.pause = stream.resume = () => {}; // ends immediately stream._read = function() { this.push(null); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl.js nodejs-6.11.4~dfsg/test/parallel/test-repl.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl.js 2017-10-03 17:11:31.000000000 +0000 @@ -65,9 +65,9 @@ read_buffer += data.toString('ascii', 0, data.length); console.error( `Unix data: ${JSON.stringify(read_buffer)}, expecting ${ - client_unix.expect.exec ? - client_unix.expect : - JSON.stringify(client_unix.expect)}`); + client_unix.expect.exec ? + client_unix.expect : + JSON.stringify(client_unix.expect)}`); if (read_buffer.includes(prompt_unix)) { // if it's an exact match, then don't do the regexp @@ -200,7 +200,7 @@ { client: client_unix, send: 'blah()', expect: `1\n${prompt_unix}` }, // Functions should not evaluate twice (#2773) - { client: client_unix, send: 'var I = [1,2,3,function() {}]; I.pop()', + { client: client_unix, send: 'var I = [1,2,3,() => {}]; I.pop()', expect: '[Function]' }, // Multiline object { client: client_unix, send: '{ a: ', @@ -248,7 +248,7 @@ // do not fail when a String is created with line continuation { client: client_unix, send: '\'the\\\nfourth\\\neye\'', expect: `${prompt_multiline}${prompt_multiline}'thefourtheye'\n${ - prompt_unix}` }, + prompt_unix}` }, // Don't fail when a partial String is created and line continuation is used // with whitespace characters at the end of the string. We are to ignore it. // This test is to make sure that we properly remove the whitespace @@ -258,11 +258,11 @@ // multiline strings preserve whitespace characters in them { client: client_unix, send: '\'the \\\n fourth\t\t\\\n eye \'', expect: `${prompt_multiline}${ - prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, + prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, // more than one multiline strings also should preserve whitespace chars { client: client_unix, send: '\'the \\\n fourth\' + \'\t\t\\\n eye \'', expect: `${prompt_multiline}${ - prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, + prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, // using REPL commands within a string literal should still work { client: client_unix, send: '\'\\\n.break', expect: prompt_unix }, @@ -275,7 +275,7 @@ // empty lines in the string literals should not affect the string { client: client_unix, send: '\'the\\\n\\\nfourtheye\'\n', expect: `${prompt_multiline}${ - prompt_multiline}'thefourtheye'\n${prompt_unix}` }, + prompt_multiline}'thefourtheye'\n${prompt_unix}` }, // Regression test for https://github.com/nodejs/node/issues/597 { client: client_unix, send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n', @@ -289,24 +289,24 @@ // regression tests for https://github.com/nodejs/node/issues/2749 { client: client_unix, send: 'function x() {\nreturn \'\\n\';\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {\nreturn \'\\\\\';\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, // regression tests for https://github.com/nodejs/node/issues/3421 { client: client_unix, send: 'function x() {\n//\'\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {\n//"\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {//\'\n }', expect: `${prompt_multiline}undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x() {//"\n }', expect: `${prompt_multiline}undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x() {\nvar i = "\'";\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x(/*optional*/) {}', expect: `undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x(/* // 5 */) {}', @@ -387,7 +387,13 @@ { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())', expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}` - } + }, + // Do not parse `...[]` as a REPL keyword + { client: client_unix, send: '...[]\n', + expect: `${prompt_multiline}` }, + // bring back the repl to prompt + { client: client_unix, send: '.break', + expect: `${prompt_unix}` } ]); } @@ -427,7 +433,7 @@ client_tcp.on('data', function(data) { read_buffer += data.toString('ascii', 0, data.length); console.error(`TCP data: ${JSON.stringify(read_buffer)}, expecting ${ - JSON.stringify(client_tcp.expect)}`); + JSON.stringify(client_tcp.expect)}`); if (read_buffer.includes(prompt_tcp)) { assert.strictEqual(client_tcp.expect, read_buffer); console.error('match'); @@ -497,7 +503,7 @@ client_unix.on('data', function(data) { read_buffer += data.toString('ascii', 0, data.length); console.error(`Unix data: ${JSON.stringify(read_buffer)}, expecting ${ - JSON.stringify(client_unix.expect)}`); + JSON.stringify(client_unix.expect)}`); if (read_buffer.includes(prompt_unix)) { assert.strictEqual(client_unix.expect, read_buffer); console.error('match'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-mode.js nodejs-6.11.4~dfsg/test/parallel/test-repl-mode.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-mode.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-mode.js 2017-10-03 17:11:31.000000000 +0000 @@ -32,7 +32,7 @@ cli.input.emit('data', 'x = 3\n'); assert.ok(/ReferenceError: x is not defined/.test( - cli.output.accumulator.join(''))); + cli.output.accumulator.join(''))); cli.output.accumulator.length = 0; cli.input.emit('data', 'let y = 3\n'); @@ -52,7 +52,7 @@ function initRepl(mode) { const input = new Stream(); - input.write = input.pause = input.resume = function() {}; + input.write = input.pause = input.resume = () => {}; input.readable = true; const output = new Stream(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-persistent-history.js nodejs-6.11.4~dfsg/test/parallel/test-repl-persistent-history.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-persistent-history.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-persistent-history.js 2017-10-03 17:11:31.000000000 +0000 @@ -58,7 +58,7 @@ 'user-writable path to enable.\n'; const convertMsg = '\nConverting old JSON repl history to line-separated ' + 'history.\nThe new repl history file can be found at ' + - path.join(common.tmpDir, '.node_repl_history') + '.\n'; + `${path.join(common.tmpDir, '.node_repl_history')}.\n`; const homedirErr = '\nError: Could not get the home directory.\n' + 'REPL session history will not be persisted.\n'; const replFailedRead = '\nError: Could not open history file.\n' + diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-.save.load.js nodejs-6.11.4~dfsg/test/parallel/test-repl-.save.load.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-.save.load.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-.save.load.js 2017-10-03 17:11:31.000000000 +0000 @@ -77,16 +77,15 @@ // make sure I get a failed to load message and not some crazy error assert.strictEqual(data, 'Failed to load:' + loadFile + '\n'); // eat me to avoid work - putIn.write = function() {}; + putIn.write = () => {}; }; putIn.run(['.load ' + loadFile]); // throw error on loading directory loadFile = common.tmpDir; putIn.write = function(data) { - assert.strictEqual(data, 'Failed to load:' + loadFile + - ' is not a valid file\n'); - putIn.write = function() {}; + assert.strictEqual(data, `Failed to load:${loadFile} is not a valid file\n`); + putIn.write = () => {}; }; putIn.run(['.load ' + loadFile]); @@ -102,7 +101,7 @@ // make sure I get a failed to save message and not some other error assert.strictEqual(data, 'Failed to save:' + invalidFileName + '\n'); // reset to no-op - putIn.write = function() {}; + putIn.write = () => {}; }; // save it to a file diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-setprompt.js nodejs-6.11.4~dfsg/test/parallel/test-repl-setprompt.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-setprompt.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-setprompt.js 2017-10-03 17:11:31.000000000 +0000 @@ -23,6 +23,6 @@ child.on('close', function(code, signal) { assert.strictEqual(code, 0); assert.ok(!signal); - const lines = data.split(/\n/); + const lines = data.split('\n'); assert.strictEqual(lines.pop(), p); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-sigint.js nodejs-6.11.4~dfsg/test/parallel/test-repl-sigint.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-sigint.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-sigint.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-sigint-nested-eval.js nodejs-6.11.4~dfsg/test/parallel/test-repl-sigint-nested-eval.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-sigint-nested-eval.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-sigint-nested-eval.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-tab-complete-crash.js nodejs-6.11.4~dfsg/test/parallel/test-repl-tab-complete-crash.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-tab-complete-crash.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-tab-complete-crash.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,7 +4,7 @@ const assert = require('assert'); const repl = require('repl'); -common.ArrayStream.prototype.write = function(msg) {}; +common.ArrayStream.prototype.write = () => {}; const putIn = new common.ArrayStream(); const testMe = repl.start('', putIn); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-tab-complete.js nodejs-6.11.4~dfsg/test/parallel/test-repl-tab-complete.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-tab-complete.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-tab-complete.js 2017-10-03 17:11:31.000000000 +0000 @@ -186,7 +186,7 @@ testMe.complete('require(\'', common.mustCall(function(error, data) { assert.strictEqual(error, null); repl._builtinLibs.forEach(function(lib) { - assert.notStrictEqual(data[0].indexOf(lib), -1, `${lib} not found`); + assert(data[0].includes(lib), `${lib} not found`); }); })); @@ -194,7 +194,7 @@ assert.strictEqual(error, null); assert.strictEqual(data.length, 2); assert.strictEqual(data[1], 'n'); - assert.notStrictEqual(data[0].indexOf('net'), -1); + assert(data[0].includes('net')); // It's possible to pick up non-core modules too data[0].forEach(function(completion) { if (completion) @@ -239,9 +239,9 @@ putIn.run(['var ary = [1,2,3];']); testMe.complete('ary.', common.mustCall(function(error, data) { - assert.strictEqual(data[0].indexOf('ary.0'), -1); - assert.strictEqual(data[0].indexOf('ary.1'), -1); - assert.strictEqual(data[0].indexOf('ary.2'), -1); + assert.strictEqual(data[0].includes('ary.0'), false); + assert.strictEqual(data[0].includes('ary.1'), false); + assert.strictEqual(data[0].includes('ary.2'), false); })); // Make sure tab completion does not include integer keys in an object @@ -249,9 +249,9 @@ putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']); testMe.complete('obj.', common.mustCall(function(error, data) { - assert.strictEqual(data[0].indexOf('obj.1'), -1); - assert.strictEqual(data[0].indexOf('obj.1a'), -1); - assert.notStrictEqual(data[0].indexOf('obj.a'), -1); + assert.strictEqual(data[0].includes('obj.1'), false); + assert.strictEqual(data[0].includes('obj.1a'), false); + assert(data[0].includes('obj.a')); })); // Don't try to complete results of non-simple expressions @@ -265,9 +265,9 @@ putIn.run(['var obj = {1:"a","1a":"b",a:"b"};']); testMe.complete(' obj.', common.mustCall((error, data) => { - assert.strictEqual(data[0].indexOf('obj.1'), -1); - assert.strictEqual(data[0].indexOf('obj.1a'), -1); - assert.notStrictEqual(data[0].indexOf('obj.a'), -1); + assert.strictEqual(data[0].includes('obj.1'), false); + assert.strictEqual(data[0].includes('obj.1a'), false); + assert(data[0].includes('obj.a')); })); // Works inside assignments diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-repl-use-global.js nodejs-6.11.4~dfsg/test/parallel/test-repl-use-global.js --- nodejs-6.11.2~dfsg/test/parallel/test-repl-use-global.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-repl-use-global.js 2017-10-03 17:11:31.000000000 +0000 @@ -80,7 +80,7 @@ }; repl.createInternalRepl( - process.env, - opts, - testFunc(useGlobal, cb, opts.output)); + process.env, + opts, + testFunc(useGlobal, cb, opts.output)); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-main.js nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-main.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-main.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-main.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,7 +4,7 @@ const fixturesRequire = require(`${common.fixturesDir}/require-bin/bin/req.js`); assert.strictEqual( - fixturesRequire, - '', - 'test-require-extensions-main failed to import fixture requirements' + fixturesRequire, + '', + 'test-require-extensions-main failed to import fixture requirements' ); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-same-filename-as-dir.js nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-same-filename-as-dir.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-same-filename-as-dir.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-same-filename-as-dir.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,9 +1,17 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); +const path = require('path'); -const content = require(common.fixturesDir + - '/json-with-directory-name-module/module-stub/one/two/three.js'); +const filePath = path.join( + common.fixturesDir, + 'json-with-directory-name-module', + 'module-stub', + 'one', + 'two', + 'three.js' +); +const content = require(filePath); assert.notStrictEqual(content.rocko, 'artischocko'); assert.strictEqual(content, 'hello from module-stub!'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js 2017-10-03 17:11:31.000000000 +0000 @@ -2,9 +2,8 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); - -const content = require(common.fixturesDir + - '/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js'); +const filePath = '/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js'; +const content = require(`${common.fixturesDir}${filePath}`); assert.notStrictEqual(content.rocko, 'artischocko'); assert.strictEqual(content, 'hello from module-stub!'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-long-path.js nodejs-6.11.4~dfsg/test/parallel/test-require-long-path.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-long-path.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-long-path.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - common.tmpDir.length, 1); const dirName = path.join(common.tmpDir, 'x'.repeat(dirNameLen)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-nul.js nodejs-6.11.4~dfsg/test/parallel/test-require-nul.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-nul.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-nul.js 2017-10-03 17:11:31.000000000 +0000 @@ -0,0 +1,9 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +// Nul bytes should throw, not abort. +assert.throws(() => require('\u0000ab'), /Cannot find module '\u0000ab'/); +assert.throws(() => require('a\u0000b'), /Cannot find module 'a\u0000b'/); +assert.throws(() => require('ab\u0000'), /Cannot find module 'ab\u0000'/); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-resolve.js nodejs-6.11.4~dfsg/test/parallel/test-require-resolve.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-resolve.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-resolve.js 2017-10-03 17:11:31.000000000 +0000 @@ -5,14 +5,14 @@ const path = require('path'); assert.strictEqual( - path.join(__dirname, '../fixtures/a.js').toLowerCase(), - require.resolve('../fixtures/a').toLowerCase()); + path.join(__dirname, '../fixtures/a.js').toLowerCase(), + require.resolve('../fixtures/a').toLowerCase()); assert.strictEqual( - path.join(fixturesDir, 'a.js').toLowerCase(), - require.resolve(path.join(fixturesDir, 'a')).toLowerCase()); + path.join(fixturesDir, 'a.js').toLowerCase(), + require.resolve(path.join(fixturesDir, 'a')).toLowerCase()); assert.strictEqual( - path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(), - require.resolve('../fixtures/nested-index/one').toLowerCase()); + path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(), + require.resolve('../fixtures/nested-index/one').toLowerCase()); assert.strictEqual('path', require.resolve('path')); console.log('ok'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-require-symlink.js nodejs-6.11.4~dfsg/test/parallel/test-require-symlink.js --- nodejs-6.11.2~dfsg/test/parallel/test-require-symlink.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-require-symlink.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,8 +4,7 @@ const assert = require('assert'); const path = require('path'); const fs = require('fs'); -const exec = require('child_process').exec; -const spawn = require('child_process').spawn; +const { exec, spawn } = require('child_process'); common.refreshTmpDir(); @@ -26,10 +25,8 @@ // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { - if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { + if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) common.skip('insufficient privileges'); - return; - } test(); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-setproctitle.js nodejs-6.11.4~dfsg/test/parallel/test-setproctitle.js --- nodejs-6.11.2~dfsg/test/parallel/test-setproctitle.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-setproctitle.js 2017-10-03 17:11:31.000000000 +0000 @@ -3,9 +3,8 @@ const common = require('../common'); // FIXME add sunos support -if (!(common.isFreeBSD || common.isOSX || common.isLinux)) { - return common.skip(`Unsupported platform [${process.platform}]`); -} +if (!(common.isFreeBSD || common.isOSX || common.isLinux)) + common.skip(`Unsupported platform [${process.platform}]`); const assert = require('assert'); const exec = require('child_process').exec; @@ -23,8 +22,8 @@ // To pass this test on alpine, since Busybox `ps` does not // support `-p` switch, use `ps -o` and `grep` instead. const cmd = common.isLinux ? - `ps -o pid,args | grep '${process.pid} ${title}' | grep -v grep` : - `ps -p ${process.pid} -o args=`; + `ps -o pid,args | grep '${process.pid} ${title}' | grep -v grep` : + `ps -p ${process.pid} -o args=`; exec(cmd, common.mustCall((error, stdout, stderr) => { assert.ifError(error); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-signal-handler.js nodejs-6.11.4~dfsg/test/parallel/test-signal-handler.js --- nodejs-6.11.2~dfsg/test/parallel/test-signal-handler.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-signal-handler.js 2017-10-03 17:11:31.000000000 +0000 @@ -2,14 +2,12 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('SIGUSR1 and SIGHUP signals are not supported'); - return; -} console.log(`process.pid: ${process.pid}`); -process.on('SIGUSR1', common.mustCall(function() {})); +process.on('SIGUSR1', common.mustCall()); process.on('SIGUSR1', common.mustCall(function() { setTimeout(function() { @@ -31,5 +29,5 @@ // has been previously registered, and `process.listeners(SIGNAL).length === 1` process.on('SIGHUP', common.mustNotCall()); process.removeAllListeners('SIGHUP'); -process.on('SIGHUP', common.mustCall(function() {})); +process.on('SIGHUP', common.mustCall()); process.kill(process.pid, 'SIGHUP'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-signal-safety.js nodejs-6.11.4~dfsg/test/parallel/test-signal-safety.js --- nodejs-6.11.2~dfsg/test/parallel/test-signal-safety.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-signal-safety.js 2017-10-03 17:11:31.000000000 +0000 @@ -9,4 +9,4 @@ const s = new Signal(); const nots = { start: s.start }; nots.start(9); -}, TypeError); +}, /^TypeError: Illegal invocation$/); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-spawn-cmd-named-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-spawn-cmd-named-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-spawn-cmd-named-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-spawn-cmd-named-pipe.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - // This test is intended for Windows only -if (!common.isWindows) { +if (!common.isWindows) common.skip('this test is Windows-specific.'); - return; -} + +const assert = require('assert'); if (!process.argv[2]) { // parent diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stdin-child-proc.js nodejs-6.11.4~dfsg/test/parallel/test-stdin-child-proc.js --- nodejs-6.11.2~dfsg/test/parallel/test-stdin-child-proc.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stdin-child-proc.js 2017-10-03 17:11:31.000000000 +0000 @@ -5,8 +5,10 @@ const assert = require('assert'); const child_process = require('child_process'); const path = require('path'); -const cp = child_process.spawn(process.execPath, - [path.resolve(__dirname, 'test-stdin-pause-resume.js')]); +const cp = child_process.spawn( + process.execPath, + [path.resolve(__dirname, 'test-stdin-pause-resume.js')] +); cp.on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stdin-script-child.js nodejs-6.11.4~dfsg/test/parallel/test-stdin-script-child.js --- nodejs-6.11.2~dfsg/test/parallel/test-stdin-script-child.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stdin-script-child.js 2017-10-03 17:11:31.000000000 +0000 @@ -4,7 +4,7 @@ const spawn = require('child_process').spawn; const child = spawn(process.execPath, [], { - env: Object.assign(process.env, { + env: Object.assign({}, process.env, { NODE_DEBUG: process.argv[2] }) }); @@ -18,7 +18,7 @@ child.stderr.setEncoding('utf8'); child.stderr.on('data', function(c) { - console.error(`> ${c.trim().split(/\n/).join('\n> ')}`); + console.error(`> ${c.trim().split('\n').join('\n> ')}`); }); child.on('close', common.mustCall(function(c) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stdout-close-catch.js nodejs-6.11.4~dfsg/test/parallel/test-stdout-close-catch.js --- nodejs-6.11.2~dfsg/test/parallel/test-stdout-close-catch.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stdout-close-catch.js 2017-10-03 17:11:31.000000000 +0000 @@ -6,9 +6,9 @@ const testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); -const cmd = JSON.stringify(process.execPath) + ' ' + - JSON.stringify(testScript) + ' | ' + - JSON.stringify(process.execPath) + ' ' + +const cmd = `${JSON.stringify(process.execPath)} ` + + `${JSON.stringify(testScript)} | ` + + `${JSON.stringify(process.execPath)} ` + '-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; const child = child_process.exec(cmd); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stdout-to-file.js nodejs-6.11.4~dfsg/test/parallel/test-stdout-to-file.js --- nodejs-6.11.2~dfsg/test/parallel/test-stdout-to-file.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stdout-to-file.js 2017-10-03 17:11:31.000000000 +0000 @@ -14,7 +14,7 @@ function test(size, useBuffer, cb) { const cmd = `"${process.argv[0]}" "${ - useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`; + useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`; try { fs.unlinkSync(tmpFile); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-basic.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-basic.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-basic.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-basic.js 2017-10-03 17:11:31.000000000 +0000 @@ -0,0 +1,453 @@ +'use strict'; +const common = require('../common'); +const R = require('_stream_readable'); +const assert = require('assert'); + +const util = require('util'); +const EE = require('events').EventEmitter; + +function TestReader(n) { + R.apply(this); + this._buffer = Buffer.alloc(n || 100, 'x'); + this._pos = 0; + this._bufs = 10; +} + +util.inherits(TestReader, R); + +TestReader.prototype._read = function(n) { + const max = this._buffer.length - this._pos; + n = Math.max(n, 0); + const toRead = Math.min(n, max); + if (toRead === 0) { + // simulate the read buffer filling up with some more bytes some time + // in the future. + setTimeout(function() { + this._pos = 0; + this._bufs -= 1; + if (this._bufs <= 0) { + // read them all! + if (!this.ended) + this.push(null); + } else { + // now we have more. + // kinda cheating by calling _read, but whatever, + // it's just fake anyway. + this._read(n); + } + }.bind(this), 10); + return; + } + + const ret = this._buffer.slice(this._pos, this._pos + toRead); + this._pos += toRead; + this.push(ret); +}; + +///// + +function TestWriter() { + EE.apply(this); + this.received = []; + this.flush = false; +} + +util.inherits(TestWriter, EE); + +TestWriter.prototype.write = function(c) { + this.received.push(c.toString()); + this.emit('write', c); + return true; +}; + +TestWriter.prototype.end = function(c) { + if (c) this.write(c); + this.emit('end', this.received); +}; + +//////// + +// tiny node-tap lookalike. +const tests = []; +let count = 0; + +function test(name, fn) { + count++; + tests.push([name, fn]); +} + +function run() { + const next = tests.shift(); + if (!next) + return console.error('ok'); + + const name = next[0]; + const fn = next[1]; + console.log('# %s', name); + fn({ + end: function() { + count--; + run(); + } + }); +} + +// ensure all tests have run +process.on('exit', function() { + assert.strictEqual(count, 0); +}); + +process.nextTick(run); + + +test('a most basic test', function(t) { + const r = new TestReader(20); + + const reads = []; + const expect = [ 'x', + 'xx', + 'xxx', + 'xxxx', + 'xxxxx', + 'xxxxxxxxx', + 'xxxxxxxxxx', + 'xxxxxxxxxxxx', + 'xxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxxxxxxxxxx', + 'xxxxxxxxxxxxxxxxxxxxx' ]; + + r.on('end', function() { + assert.deepStrictEqual(reads, expect); + t.end(); + }); + + let readSize = 1; + function flow() { + let res; + while (null !== (res = r.read(readSize++))) { + reads.push(res.toString()); + } + r.once('readable', flow); + } + + flow(); +}); + +test('pipe', function(t) { + const r = new TestReader(5); + + const expect = [ 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx' ]; + + const w = new TestWriter(); + + w.on('end', function(received) { + assert.deepStrictEqual(received, expect); + t.end(); + }); + + r.pipe(w); +}); + + +[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { + test('unpipe', function(t) { + const r = new TestReader(5); + + // unpipe after 3 writes, then write to another stream instead. + let expect = [ 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx' ]; + expect = [ expect.slice(0, SPLIT), expect.slice(SPLIT) ]; + + const w = [ new TestWriter(), new TestWriter() ]; + + let writes = SPLIT; + w[0].on('write', function() { + if (--writes === 0) { + r.unpipe(); + assert.strictEqual(r._readableState.pipes, null); + w[0].end(); + r.pipe(w[1]); + assert.strictEqual(r._readableState.pipes, w[1]); + } + }); + + let ended = 0; + + let ended0 = false; + let ended1 = false; + w[0].on('end', function(results) { + assert.strictEqual(ended0, false); + ended0 = true; + ended++; + assert.deepStrictEqual(results, expect[0]); + }); + + w[1].on('end', function(results) { + assert.strictEqual(ended1, false); + ended1 = true; + ended++; + assert.strictEqual(ended, 2); + assert.deepStrictEqual(results, expect[1]); + t.end(); + }); + + r.pipe(w[0]); + }); +}); + + +// both writers should get the same exact data. +test('multipipe', function(t) { + const r = new TestReader(5); + const w = [ new TestWriter(), new TestWriter() ]; + + const expect = [ 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx' ]; + + let c = 2; + w[0].on('end', function(received) { + assert.deepStrictEqual(received, expect, 'first'); + if (--c === 0) t.end(); + }); + w[1].on('end', function(received) { + assert.deepStrictEqual(received, expect, 'second'); + if (--c === 0) t.end(); + }); + + r.pipe(w[0]); + r.pipe(w[1]); +}); + + +[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { + test('multi-unpipe', function(t) { + const r = new TestReader(5); + + // unpipe after 3 writes, then write to another stream instead. + let expect = [ 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx', + 'xxxxx' ]; + expect = [ expect.slice(0, SPLIT), expect.slice(SPLIT) ]; + + const w = [ new TestWriter(), new TestWriter(), new TestWriter() ]; + + let writes = SPLIT; + w[0].on('write', function() { + if (--writes === 0) { + r.unpipe(); + w[0].end(); + r.pipe(w[1]); + } + }); + + let ended = 0; + + w[0].on('end', function(results) { + ended++; + assert.deepStrictEqual(results, expect[0]); + }); + + w[1].on('end', function(results) { + ended++; + assert.strictEqual(ended, 2); + assert.deepStrictEqual(results, expect[1]); + t.end(); + }); + + r.pipe(w[0]); + r.pipe(w[2]); + }); +}); + +test('back pressure respected', function(t) { + const r = new R({ objectMode: true }); + r._read = common.mustNotCall(); + let counter = 0; + r.push(['one']); + r.push(['two']); + r.push(['three']); + r.push(['four']); + r.push(null); + + const w1 = new R(); + w1.write = function(chunk) { + console.error('w1.emit("close")'); + assert.strictEqual(chunk[0], 'one'); + w1.emit('close'); + process.nextTick(function() { + r.pipe(w2); + r.pipe(w3); + }); + }; + w1.end = common.mustNotCall(); + + r.pipe(w1); + + const expected = ['two', 'two', 'three', 'three', 'four', 'four']; + + let w2 = new R(); + w2.write = function(chunk) { + console.error('w2 write', chunk, counter); + assert.strictEqual(chunk[0], expected.shift()); + assert.strictEqual(counter, 0); + + counter++; + + if (chunk[0] === 'four') { + return true; + } + + setTimeout(function() { + counter--; + console.error('w2 drain'); + w2.emit('drain'); + }, 10); + + return false; + }; + w2.end = common.mustCall(); + + let w3 = new R(); + w3.write = function(chunk) { + console.error('w3 write', chunk, counter); + assert.strictEqual(chunk[0], expected.shift()); + assert.strictEqual(counter, 1); + + counter++; + + if (chunk[0] === 'four') { + return true; + } + + setTimeout(function() { + counter--; + console.error('w3 drain'); + w3.emit('drain'); + }, 50); + + return false; + }; + w3.end = function() { + assert.strictEqual(counter, 2); + assert.strictEqual(expected.length, 0); + t.end(); + }; +}); + +test('read(0) for ended streams', function(t) { + const r = new R(); + let written = false; + let ended = false; + r._read = common.mustNotCall(); + + r.push(Buffer.from('foo')); + r.push(null); + + const v = r.read(0); + + assert.strictEqual(v, null); + + const w = new R(); + + w.write = function(buffer) { + written = true; + assert.strictEqual(ended, false); + assert.strictEqual(buffer.toString(), 'foo'); + }; + + w.end = function() { + ended = true; + assert.strictEqual(written, true); + t.end(); + }; + + r.pipe(w); +}); + +test('sync _read ending', function(t) { + const r = new R(); + let called = false; + r._read = function(n) { + r.push(null); + }; + + r.once('end', function() { + called = true; + }); + + r.read(); + + process.nextTick(function() { + assert.strictEqual(called, true); + t.end(); + }); +}); + +test('adding readable triggers data flow', function(t) { + const r = new R({ highWaterMark: 5 }); + let onReadable = false; + let readCalled = 0; + + r._read = function(n) { + if (readCalled++ === 2) + r.push(null); + else + r.push(Buffer.from('asdf')); + }; + + r.on('readable', function() { + onReadable = true; + r.read(); + }); + + r.on('end', function() { + assert.strictEqual(readCalled, 3); + assert.ok(onReadable); + t.end(); + }); +}); + +test('chainable', function(t) { + const r = new R(); + r._read = common.mustCall(); + const r2 = r.setEncoding('utf8').pause().resume().pause(); + assert.strictEqual(r, r2); + t.end(); +}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-finish-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-finish-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-finish-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-finish-pipe.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,7 +1,6 @@ 'use strict'; require('../common'); const stream = require('stream'); -const Buffer = require('buffer').Buffer; const r = new stream.Readable(); r._read = function(size) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-objects.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-objects.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-objects.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-objects.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const Readable = require('_stream_readable'); const Writable = require('_stream_writable'); const assert = require('assert'); @@ -54,7 +54,7 @@ function fromArray(list) { const r = new Readable({ objectMode: true }); - r._read = noop; + r._read = common.mustNotCall(); list.forEach(function(chunk) { r.push(chunk); }); @@ -63,8 +63,6 @@ return r; } -function noop() {} - test('can read objects from stream', function(t) { const r = fromArray([{ one: '1'}, { two: '2' }]); @@ -144,7 +142,7 @@ const r = new Readable({ objectMode: true }); - r._read = noop; + r._read = common.mustNotCall(); const list = ['one', 'two', 'three']; list.forEach(function(str) { r.push(str); @@ -162,7 +160,7 @@ const r = new Readable({ objectMode: true }); - r._read = noop; + r._read = common.mustNotCall(); r.push('foobar'); r.push(null); @@ -178,7 +176,7 @@ const r = new Readable({ objectMode: true }); - r._read = noop; + r._read = common.mustNotCall(); r.push(false); r.push(0); @@ -229,7 +227,7 @@ highWaterMark: 6, objectMode: true }); - r._read = function(n) {}; + r._read = common.mustNotCall(); for (let i = 0; i < 6; i++) { const bool = r.push(i); assert.strictEqual(bool, i !== 5); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-pipe-error-once-listener.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-pipe-error-once-listener.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-pipe-error-once-listener.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-pipe-error-once-listener.js 2017-10-03 17:11:31.000000000 +0000 @@ -29,7 +29,7 @@ const read = new Read(); const write = new Write(); -write.once('error', function(err) {}); +write.once('error', () => {}); write.once('alldone', function(err) { console.log('ok'); }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-legacy-drain.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-legacy-drain.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-legacy-drain.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-legacy-drain.js 2017-10-03 17:11:31.000000000 +0000 @@ -12,7 +12,7 @@ return r.push(++reads === N ? null : Buffer.allocUnsafe(1)); }; -r.on('end', common.mustCall(function() {})); +r.on('end', common.mustCall()); const w = new Stream(); w.writable = true; @@ -29,7 +29,7 @@ w.emit('drain'); } -w.end = common.mustCall(function() {}); +w.end = common.mustCall(); // Just for kicks, let's mess with the drain count. // This verifies that even if it gets negative in the diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-non-empty-end.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-non-empty-end.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-non-empty-end.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-non-empty-end.js 2017-10-03 17:11:31.000000000 +0000 @@ -40,7 +40,7 @@ function next() { // now let's make 'end' happen test.removeListener('end', thrower); - test.on('end', common.mustCall(function() {})); + test.on('end', common.mustCall()); // one to get the last byte let r = test.read(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-wrap-empty.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-wrap-empty.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-wrap-empty.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-wrap-empty.js 2017-10-03 17:11:31.000000000 +0000 @@ -5,13 +5,13 @@ const EE = require('events').EventEmitter; const oldStream = new EE(); -oldStream.pause = function() {}; -oldStream.resume = function() {}; +oldStream.pause = () => {}; +oldStream.resume = () => {}; const newStream = new Readable().wrap(oldStream); newStream - .on('readable', function() {}) - .on('end', common.mustCall(function() {})); + .on('readable', () => {}) + .on('end', common.mustCall()); oldStream.emit('end'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-wrap.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-wrap.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-readable-wrap.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-readable-wrap.js 2017-10-03 17:11:31.000000000 +0000 @@ -12,7 +12,7 @@ objectMode: objectMode }); assert.strictEqual(r, r.wrap(old)); - r.on('end', common.mustCall(function() {})); + r.on('end', common.mustCall()); old.pause = function() { old.emit('pause'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-read-sync-stack.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-read-sync-stack.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-read-sync-stack.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-read-sync-stack.js 2017-10-03 17:11:31.000000000 +0000 @@ -20,6 +20,6 @@ r.read(N * 2); }); -r.on('end', common.mustCall(function() {})); +r.on('end', common.mustCall()); r.read(0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream2-writable.js nodejs-6.11.4~dfsg/test/parallel/test-stream2-writable.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream2-writable.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream2-writable.js 2017-10-03 17:11:31.000000000 +0000 @@ -283,7 +283,7 @@ test('writables are not pipable', function(t) { const w = new W(); - w._write = function() {}; + w._write = () => {}; let gotError = false; w.on('error', function() { gotError = true; @@ -295,8 +295,8 @@ test('duplexes are pipable', function(t) { const d = new D(); - d._read = function() {}; - d._write = function() {}; + d._read = () => {}; + d._write = () => {}; let gotError = false; d.on('error', function() { gotError = true; @@ -308,7 +308,7 @@ test('end(chunk) two times is an error', function(t) { const w = new W(); - w._write = function() {}; + w._write = () => {}; let gotError = false; w.on('error', function(er) { gotError = true; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-big-push.js nodejs-6.11.4~dfsg/test/parallel/test-stream-big-push.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-big-push.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-big-push.js 2017-10-03 17:11:31.000000000 +0000 @@ -28,7 +28,7 @@ r._read = common.mustCall(_read, 3); -r.on('end', common.mustCall(function() {})); +r.on('end', common.mustCall()); // push some data in to start. // we've never gotten any read event at this point. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-decoder-objectmode.js nodejs-6.11.4~dfsg/test/parallel/test-stream-decoder-objectmode.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-decoder-objectmode.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-decoder-objectmode.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,4 +1,5 @@ 'use strict'; + require('../common'); const stream = require('stream'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-duplex.js nodejs-6.11.4~dfsg/test/parallel/test-stream-duplex.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-duplex.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-duplex.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,4 +1,5 @@ 'use strict'; + require('../common'); const assert = require('assert'); const Duplex = require('stream').Duplex; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-end-paused.js nodejs-6.11.4~dfsg/test/parallel/test-stream-end-paused.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-end-paused.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-end-paused.js 2017-10-03 17:11:31.000000000 +0000 @@ -19,7 +19,7 @@ stream.pause(); setTimeout(common.mustCall(function() { - stream.on('end', common.mustCall(function() {})); + stream.on('end', common.mustCall()); stream.resume(); }), 1); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-events-prepend.js nodejs-6.11.4~dfsg/test/parallel/test-stream-events-prepend.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-events-prepend.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-events-prepend.js 2017-10-03 17:11:31.000000000 +0000 @@ -23,7 +23,7 @@ }; const w = new Writable(); -w.on('pipe', common.mustCall(function() {})); +w.on('pipe', common.mustCall()); const r = new Readable(); r.pipe(w); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-inheritance.js nodejs-6.11.4~dfsg/test/parallel/test-stream-inheritance.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-inheritance.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-inheritance.js 2017-10-03 17:11:31.000000000 +0000 @@ -33,8 +33,14 @@ // Simple inheritance check for `Writable` works fine in a subclass constructor. function CustomWritable() { - assert.ok(this instanceof Writable, 'inherits from Writable'); - assert.ok(this instanceof CustomWritable, 'inherits from CustomWritable'); + assert.ok( + this instanceof CustomWritable, + `${this} does not inherit from CustomWritable` + ); + assert.ok( + this instanceof Writable, + `${this} does not inherit from Writable` + ); } Object.setPrototypeOf(CustomWritable, Writable); @@ -42,4 +48,9 @@ new CustomWritable(); -assert.throws(CustomWritable, /AssertionError: inherits from Writable/); +assert.throws(CustomWritable, /AssertionError: undefined does not inherit from CustomWritable/); + +class OtherCustomWritable extends Writable {} + +assert(!(new OtherCustomWritable() instanceof CustomWritable)); +assert(!(new CustomWritable() instanceof OtherCustomWritable)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-after-end.js nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-after-end.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-after-end.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-after-end.js 2017-10-03 17:11:31.000000000 +0000 @@ -42,11 +42,11 @@ piper.read(); setTimeout(common.mustCall(function() { - ender.on('end', common.mustCall(function() {})); + ender.on('end', common.mustCall()); const c = ender.read(); assert.strictEqual(c, null); const w = new TestWritable(); - w.on('finish', common.mustCall(function() {})); + w.on('finish', common.mustCall()); piper.pipe(w); }), 1); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-await-drain.js nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-await-drain.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-await-drain.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-await-drain.js 2017-10-03 17:11:31.000000000 +0000 @@ -15,7 +15,7 @@ // See: https://github.com/nodejs/node/issues/5820 const buffer = Buffer.allocUnsafe(560000); -reader._read = function(n) {}; +reader._read = () => {}; writer1._write = common.mustCall(function(chunk, encoding, cb) { this.emit('chunk-received'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-cleanup-pause.js nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-cleanup-pause.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-cleanup-pause.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-cleanup-pause.js 2017-10-03 17:11:31.000000000 +0000 @@ -11,7 +11,7 @@ // See: https://github.com/nodejs/node/issues/2323 const buffer = Buffer.allocUnsafe(560000); -reader._read = function(n) {}; +reader._read = () => {}; writer1._write = common.mustCall(function(chunk, encoding, cb) { this.emit('chunk-received'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-error-handling.js nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-error-handling.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-pipe-error-handling.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-pipe-error-handling.js 2017-10-03 17:11:31.000000000 +0000 @@ -79,11 +79,11 @@ }), 1); }); - w.on('error', common.mustCall(function() {})); - w._write = function() {}; + w.on('error', common.mustCall()); + w._write = () => {}; r.pipe(w); // Removing some OTHER random listener should not do anything - w.removeListener('error', function() {}); + w.removeListener('error', () => {}); removed = true; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-readable-event.js nodejs-6.11.4~dfsg/test/parallel/test-stream-readable-event.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-readable-event.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-readable-event.js 2017-10-03 17:11:31.000000000 +0000 @@ -19,7 +19,7 @@ setTimeout(function() { // we're testing what we think we are assert(!r._readableState.reading); - r.on('readable', common.mustCall(function() {})); + r.on('readable', common.mustCall()); }, 1); } @@ -39,7 +39,7 @@ setTimeout(function() { // assert we're testing what we think we are assert(r._readableState.reading); - r.on('readable', common.mustCall(function() {})); + r.on('readable', common.mustCall()); }, 1); } @@ -59,6 +59,6 @@ setTimeout(function() { // assert we're testing what we think we are assert(!r._readableState.reading); - r.on('readable', common.mustCall(function() {})); + r.on('readable', common.mustCall()); }, 1); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-readable-invalid-chunk.js nodejs-6.11.4~dfsg/test/parallel/test-stream-readable-invalid-chunk.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-readable-invalid-chunk.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-readable-invalid-chunk.js 2017-10-03 17:11:31.000000000 +0000 @@ -1,4 +1,5 @@ 'use strict'; + require('../common'); const stream = require('stream'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-wrap.js nodejs-6.11.4~dfsg/test/parallel/test-stream-wrap.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-wrap.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-wrap.js 2017-10-03 17:11:31.000000000 +0000 @@ -28,4 +28,4 @@ req.handle.shutdown(req); } -testShutdown(common.mustCall(function() {})); +testShutdown(common.mustCall()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-writable-change-default-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-stream-writable-change-default-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-writable-change-default-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-writable-change-default-encoding.js 2017-10-03 17:11:31.000000000 +0000 @@ -40,7 +40,7 @@ m.setDefaultEncoding({}); m.write('bar'); m.end(); -}, TypeError); +}, /^TypeError: Unknown encoding: \[object Object\]$/); (function checkVairableCaseEncoding() { const m = new MyWritable(function(isBuffer, type, enc) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-writable-null.js nodejs-6.11.4~dfsg/test/parallel/test-stream-writable-null.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-writable-null.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-writable-null.js 2017-10-03 17:11:31.000000000 +0000 @@ -19,7 +19,7 @@ assert.throws(() => { const m = new MyWritable({objectMode: true}); m.write(null, (err) => assert.ok(err)); -}, TypeError, 'May not write null values to stream'); +}, /^TypeError: May not write null values to stream$/); assert.doesNotThrow(() => { const m = new MyWritable({objectMode: true}).on('error', (e) => { assert.ok(e); @@ -32,7 +32,7 @@ assert.throws(() => { const m = new MyWritable(); m.write(false, (err) => assert.ok(err)); -}, TypeError, 'Invalid non-string/buffer chunk'); +}, /^TypeError: Invalid non-string\/buffer chunk$/); assert.doesNotThrow(() => { const m = new MyWritable().on('error', (e) => { assert.ok(e); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-stream-writev.js nodejs-6.11.4~dfsg/test/parallel/test-stream-writev.js --- nodejs-6.11.2~dfsg/test/parallel/test-stream-writev.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-stream-writev.js 2017-10-03 17:11:31.000000000 +0000 @@ -68,7 +68,7 @@ return { encoding: chunk.encoding, chunk: Buffer.isBuffer(chunk.chunk) ? - Array.prototype.slice.call(chunk.chunk) : chunk.chunk + Array.prototype.slice.call(chunk.chunk) : chunk.chunk }; }); cb(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-immediate.js nodejs-6.11.4~dfsg/test/parallel/test-timers-immediate.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-immediate.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-immediate.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,10 +2,6 @@ const common = require('../common'); const assert = require('assert'); -let immediateB; -let immediateC; -let immediateD; - let mainFinished = false; setImmediate(common.mustCall(function() { @@ -13,21 +9,16 @@ clearImmediate(immediateB); })); -immediateB = setImmediate(function() { +let immediateB = setImmediate(function() { common.fail('this immediate should not run'); }); -setImmediate(function(x, y, z) { - immediateC = [x, y, z]; -}, 1, 2, 3); - -setImmediate(function(x, y, z, a, b) { - immediateD = [x, y, z, a, b]; -}, 1, 2, 3, 4, 5); - -process.on('exit', function() { - assert.deepStrictEqual(immediateC, [1, 2, 3], 'immediateC args should match'); - assert.deepStrictEqual(immediateD, [1, 2, 3, 4, 5], '5 args should match'); -}); +setImmediate(common.mustCall((...args) => { + assert.deepStrictEqual(args, [1, 2, 3]); +}), 1, 2, 3); + +setImmediate(common.mustCall((...args) => { + assert.deepStrictEqual(args, [1, 2, 3, 4, 5]); +}), 1, 2, 3, 4, 5); mainFinished = true; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers.js nodejs-6.11.4~dfsg/test/parallel/test-timers.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers.js 2017-10-03 17:11:32.000000000 +0000 @@ -56,5 +56,5 @@ }), 2); // Test 10 ms timeout separately. -setTimeout(common.mustCall(function() {}), 10); +setTimeout(common.mustCall(), 10); setInterval(common.mustCall(function() { clearInterval(this); }), 10); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-non-integer-delay.js nodejs-6.11.4~dfsg/test/parallel/test-timers-non-integer-delay.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-non-integer-delay.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-non-integer-delay.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); /* * This test makes sure that non-integer timer delays do not make the process @@ -18,13 +18,11 @@ */ const TIMEOUT_DELAY = 1.1; -const NB_TIMEOUTS_FIRED = 50; +let N = 50; -let nbTimeoutFired = 0; -const interval = setInterval(function() { - ++nbTimeoutFired; - if (nbTimeoutFired === NB_TIMEOUTS_FIRED) { +const interval = setInterval(common.mustCall(() => { + if (--N === 0) { clearInterval(interval); process.exit(0); } -}, TIMEOUT_DELAY); +}, N), TIMEOUT_DELAY); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js nodejs-6.11.4~dfsg/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js 2017-10-03 17:11:32.000000000 +0000 @@ -6,6 +6,7 @@ const common = require('../common'); const net = require('net'); +const Countdown = require('../common/countdown'); const clients = []; @@ -19,7 +20,7 @@ * the list of unref timers when traversing it, and exposes the * original issue in joyent/node#8897. */ - clients[0].setTimeout(1, function onTimeout() { + clients[0].setTimeout(1, () => { clients[1].setTimeout(0); clients[0].end(); clients[1].end(); @@ -31,19 +32,16 @@ } }); -server.listen(0, common.localhostIPv4, function() { - let nbClientsEnded = 0; +server.listen(0, common.localhostIPv4, common.mustCall(() => { + const countdown = new Countdown(2, common.mustCall(() => server.close())); - function addEndedClient(client) { - ++nbClientsEnded; - if (nbClientsEnded === 2) { - server.close(); - } + { + const client = net.connect({ port: server.address().port }); + client.on('end', () => countdown.dec()); } - const client1 = net.connect({ port: this.address().port }); - client1.on('end', addEndedClient); - - const client2 = net.connect({ port: this.address().port }); - client2.on('end', addEndedClient); -}); + { + const client = net.connect({ port: server.address().port }); + client.on('end', () => countdown.dec()); + } +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-uncaught-exception.js nodejs-6.11.4~dfsg/test/parallel/test-timers-uncaught-exception.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-uncaught-exception.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-uncaught-exception.js 2017-10-03 17:11:32.000000000 +0000 @@ -10,7 +10,7 @@ }), 1); // ...but the second one should still run -setTimeout(common.mustCall(function() {}), 1); +setTimeout(common.mustCall(), 1); function uncaughtException(err) { assert.strictEqual(err.message, errorMsg); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-call.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-call.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-call.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-call.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,12 @@ 'use strict'; + require('../common'); const Timer = process.binding('timer_wrap').Timer; Timer.now = function() { return ++Timer.now.ticks; }; Timer.now.ticks = 0; -const t = setInterval(function() {}, 1); +const t = setInterval(() => {}, 1); const o = { _idleStart: 0, _idleTimeout: 1 }; t.unref.call(o); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unrefd-interval-still-fires.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unrefd-interval-still-fires.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unrefd-interval-still-fires.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unrefd-interval-still-fires.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,23 +5,20 @@ const common = require('../common'); const TEST_DURATION = common.platformTimeout(1000); -const N = 3; -let nbIntervalFired = 0; +let N = 3; -const keepOpen = setTimeout(() => { - console.error('[FAIL] Interval fired %d/%d times.', nbIntervalFired, N); - throw new Error('Test timed out. keepOpen was not canceled.'); -}, TEST_DURATION); +const keepOpen = + setTimeout( + common.mustNotCall('Test timed out. keepOpen was not canceled.'), + TEST_DURATION); -const timer = setInterval(() => { - ++nbIntervalFired; - if (nbIntervalFired === N) { +const timer = setInterval(common.mustCall(() => { + if (--N === 0) { clearInterval(timer); - timer._onTimeout = () => { - throw new Error('Unrefd interval fired after being cleared.'); - }; + timer._onTimeout = + common.mustNotCall('Unrefd interal fired after being cleared'); clearTimeout(keepOpen); } -}, 1); +}, N), 1); timer.unref(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unrefed-in-beforeexit.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unrefed-in-beforeexit.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unrefed-in-beforeexit.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unrefed-in-beforeexit.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,20 +1,7 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); -let once = 0; - -process.on('beforeExit', () => { - if (once > 1) - throw new RangeError('beforeExit should only have been called once!'); - - setTimeout(() => {}, 1).unref(); - once++; -}); - -process.on('exit', (code) => { - if (code !== 0) return; - - assert.strictEqual(once, 1); -}); +process.on('beforeExit', common.mustCall(() => { + setTimeout(common.mustNotCall(), 1).unref(); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unref.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unref.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unref.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unref.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,75 +1,58 @@ 'use strict'; -require('../common'); + +const common = require('../common'); const assert = require('assert'); -let interval_fired = false; -let timeout_fired = false; let unref_interval = false; let unref_timer = false; -let unref_callbacks = 0; let checks = 0; const LONG_TIME = 10 * 1000; const SHORT_TIME = 100; -assert.doesNotThrow(function() { - setTimeout(function() {}, 10).unref().ref().unref(); +assert.doesNotThrow(() => { + setTimeout(() => {}, 10).unref().ref().unref(); }, 'ref and unref are chainable'); -assert.doesNotThrow(function() { - setInterval(function() {}, 10).unref().ref().unref(); +assert.doesNotThrow(() => { + setInterval(() => {}, 10).unref().ref().unref(); }, 'ref and unref are chainable'); -setInterval(function() { - interval_fired = true; -}, LONG_TIME).unref(); - -setTimeout(function() { - timeout_fired = true; -}, LONG_TIME).unref(); +setInterval(common.mustNotCall('Interval should not fire'), LONG_TIME).unref(); +setTimeout(common.mustNotCall('Timer should not fire'), LONG_TIME).unref(); -const interval = setInterval(function() { +const interval = setInterval(common.mustCall(() => { unref_interval = true; clearInterval(interval); -}, SHORT_TIME); +}), SHORT_TIME); interval.unref(); -setTimeout(function() { +setTimeout(common.mustCall(() => { unref_timer = true; -}, SHORT_TIME).unref(); +}), SHORT_TIME).unref(); -const check_unref = setInterval(function() { +const check_unref = setInterval(() => { if (checks > 5 || (unref_interval && unref_timer)) clearInterval(check_unref); checks += 1; }, 100); -setTimeout(function() { - unref_callbacks++; - this.unref(); -}, SHORT_TIME); - -// Should not timeout the test -setInterval(function() { - this.unref(); -}, SHORT_TIME); +{ + const timeout = + setTimeout(common.mustCall(() => { + timeout.unref(); + }), SHORT_TIME); +} + +{ + // Should not timeout the test + const timeout = + setInterval(() => timeout.unref(), SHORT_TIME); +} // Should not assert on args.Holder()->InternalFieldCount() > 0. See #4261. { - const t = setInterval(function() {}, 1); + const t = setInterval(() => {}, 1); process.nextTick(t.unref.bind({})); process.nextTick(t.unref.bind(t)); } - -process.on('exit', function() { - assert.strictEqual(interval_fired, false, - 'Interval should not fire'); - assert.strictEqual(timeout_fired, false, - 'Timeout should not fire'); - assert.strictEqual(unref_timer, true, - 'An unrefd timeout should still fire'); - assert.strictEqual(unref_interval, true, - 'An unrefd interval should still fire'); - assert.strictEqual(unref_callbacks, 1, - 'Callback should only run once'); -}); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-leak.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-leak.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-leak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-leak.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,27 +1,14 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); -let called = 0; -let closed = 0; - -const timeout = setTimeout(function() { - called++; -}, 10); +const timeout = setTimeout(common.mustCall(), 10); timeout.unref(); // Wrap `close` method to check if the handle was closed const close = timeout._handle.close; -timeout._handle.close = function() { - closed++; +timeout._handle.close = common.mustCall(function() { return close.apply(this, arguments); -}; +}); // Just to keep process alive and let previous timer's handle die -setTimeout(function() { -}, 50); - -process.on('exit', function() { - assert.strictEqual(called, 1); - assert.strictEqual(closed, 1); -}); +setTimeout(() => {}, 50); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-remove-other-unref-timers.js nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-remove-other-unref-timers.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-unref-remove-other-unref-timers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-unref-remove-other-unref-timers.js 2017-10-03 17:11:32.000000000 +0000 @@ -29,4 +29,4 @@ timers._unrefActive(foo); // Keep the process open. -setTimeout(function() {}, 100); +setTimeout(() => {}, 100); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-user-call.js nodejs-6.11.4~dfsg/test/parallel/test-timers-user-call.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-user-call.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-user-call.js 2017-10-03 17:11:32.000000000 +0000 @@ -0,0 +1,40 @@ +// Make sure `setTimeout()` and friends don't throw if the user-supplied +// function has .call() and .apply() monkey-patched to undesirable values. + +// Refs: https://github.com/nodejs/node/issues/12956 + +'use strict'; + +const common = require('../common'); + +{ + const fn = common.mustCall(10); + fn.call = 'not a function'; + fn.apply = 'also not a function'; + setTimeout(fn, 1); + setTimeout(fn, 1, 'oneArg'); + setTimeout(fn, 1, 'two', 'args'); + setTimeout(fn, 1, 'three', '(3)', 'args'); + setTimeout(fn, 1, 'more', 'than', 'three', 'args'); + + setImmediate(fn, 1); + setImmediate(fn, 1, 'oneArg'); + setImmediate(fn, 1, 'two', 'args'); + setImmediate(fn, 1, 'three', '(3)', 'args'); + setImmediate(fn, 1, 'more', 'than', 'three', 'args'); +} + +{ + const testInterval = (...args) => { + const fn = common.mustCall(() => { clearInterval(interval); }); + fn.call = 'not a function'; + fn.apply = 'also not a function'; + const interval = setInterval(fn, 1, ...args); + }; + + testInterval(); + testInterval('oneArg'); + testInterval('two', 'args'); + testInterval('three', '(3)', 'args'); + testInterval('more', 'than', 'three', 'args'); +} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-timers-zero-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-timers-zero-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-timers-zero-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-timers-zero-timeout.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,7 +5,7 @@ // https://github.com/joyent/node/issues/2079 - zero timeout drops extra args { setTimeout(common.mustCall(f), 0, 'foo', 'bar', 'baz'); - setTimeout(function() {}, 0); + setTimeout(() => {}, 0); function f(a, b, c) { assert.strictEqual(a, 'foo'); @@ -15,18 +15,14 @@ } { - let ncalled = 0; + let ncalled = 3; - const iv = setInterval(f, 0, 'foo', 'bar', 'baz'); - - function f(a, b, c) { + const f = common.mustCall((a, b, c) => { assert.strictEqual(a, 'foo'); assert.strictEqual(b, 'bar'); assert.strictEqual(c, 'baz'); - if (++ncalled === 3) clearTimeout(iv); - } + if (--ncalled === 0) clearTimeout(iv); + }, ncalled); - process.on('exit', function() { - assert.strictEqual(ncalled, 3); - }); + const iv = setInterval(f, 0, 'foo', 'bar', 'baz'); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-0-dns-altname.js nodejs-6.11.4~dfsg/test/parallel/test-tls-0-dns-altname.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-0-dns-altname.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-0-dns-altname.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); // Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const server = tls.createServer({ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-alert-handling.js nodejs-6.11.4~dfsg/test/parallel/test-tls-alert-handling.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-alert-handling.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-alert-handling.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,22 +1,19 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); -const net = require('net'); +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const fs = require('fs'); +const net = require('net'); +const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-alert.js nodejs-6.11.4~dfsg/test/parallel/test-tls-alert.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-alert.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-alert.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,25 +1,21 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const { spawn } = require('child_process'); const fs = require('fs'); -const spawn = require('child_process').spawn; +const path = require('path'); +const tls = require('tls'); let success = false; function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-alpn-server-client.js nodejs-6.11.4~dfsg/test/parallel/test-tls-alpn-server-client.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-alpn-server-client.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-alpn-server-client.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,23 +1,21 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} if (!process.features.tls_alpn || !process.features.tls_npn) { common.skip( 'Skipping because node compiled without NPN or ALPN feature of OpenSSL.'); - return; } const assert = require('assert'); const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-async-cb-after-socket-end.js nodejs-6.11.4~dfsg/test/parallel/test-tls-async-cb-after-socket-end.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-async-cb-after-socket-end.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-async-cb-after-socket-end.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,15 +2,13 @@ const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const path = require('path'); const fs = require('fs'); const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const tls = require('tls'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-cert-regression.js nodejs-6.11.4~dfsg/test/parallel/test-tls-cert-regression.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-cert-regression.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-cert-regression.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); @@ -42,5 +41,5 @@ } test(cert, key, common.mustCall(function() { - test(Buffer.from(cert), Buffer.from(key), common.mustCall(function() {})); + test(Buffer.from(cert), Buffer.from(key), common.mustCall()); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-check-server-identity.js nodejs-6.11.4~dfsg/test/parallel/test-tls-check-server-identity.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-check-server-identity.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-check-server-identity.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const util = require('util'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-cipher-list.js nodejs-6.11.4~dfsg/test/parallel/test-tls-cipher-list.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-cipher-list.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-cipher-list.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const spawn = require('child_process').spawn; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-abort2.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-abort2.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-abort2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-abort2.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const conn = tls.connect(0, common.mustNotCall()); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-abort.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-abort.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-abort.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-abort.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-default-ciphers.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-default-ciphers.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-default-ciphers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-default-ciphers.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); function Done() {} @@ -18,11 +16,8 @@ throw new Done(); }; - try { - tls.connect(common.PORT); - } catch (e) { - assert(e instanceof Done); - } + assert.throws(tls.connect, Done); + assert.strictEqual(ciphers, tls.DEFAULT_CIPHERS); } test1(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-destroy-soon.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-destroy-soon.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-destroy-soon.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-destroy-soon.js 2017-10-03 17:11:32.000000000 +0000 @@ -4,14 +4,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-getephemeralkeyinfo.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-getephemeralkeyinfo.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-getephemeralkeyinfo.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-getephemeralkeyinfo.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-mindhsize.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-mindhsize.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-mindhsize.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-mindhsize.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-reject.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-reject.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-reject.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-reject.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-resume.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-resume.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-resume.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-resume.js 2017-10-03 17:11:32.000000000 +0000 @@ -4,14 +4,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-client-verify.js nodejs-6.11.4~dfsg/test/parallel/test-tls-client-verify.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-client-verify.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-client-verify.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,50 +1,48 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); -const hosterr = /Hostname\/IP doesn't match certificate's altnames/g; +const hosterr = /Hostname\/IP doesn't match certificate's altnames/; const testCases = [{ ca: ['ca1-cert'], key: 'agent2-key', cert: 'agent2-cert', servers: [ - { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: false, key: 'agent3-key', cert: 'agent3-cert' } - ] - }, - - { ca: [], - key: 'agent2-key', - cert: 'agent2-cert', - servers: [ - { ok: false, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: false, key: 'agent3-key', cert: 'agent3-cert' } + { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: false, key: 'agent3-key', cert: 'agent3-cert' } ] }, - { ca: ['ca1-cert', 'ca2-cert'], - key: 'agent2-key', - cert: 'agent2-cert', - servers: [ - { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: true, key: 'agent3-key', cert: 'agent3-cert' } - ] - } + { ca: [], + key: 'agent2-key', + cert: 'agent2-cert', + servers: [ + { ok: false, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: false, key: 'agent3-key', cert: 'agent3-cert' } + ] + }, + + { ca: ['ca1-cert', 'ca2-cert'], + key: 'agent2-key', + cert: 'agent2-cert', + servers: [ + { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: true, key: 'agent3-key', cert: 'agent3-cert' } + ] + } ]; function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-close-error.js nodejs-6.11.4~dfsg/test/parallel/test-tls-close-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-close-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-close-error.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-close-notify.js nodejs-6.11.4~dfsg/test/parallel/test-tls-close-notify.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-close-notify.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-close-notify.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-cnnic-whitelist.js nodejs-6.11.4~dfsg/test/parallel/test-tls-cnnic-whitelist.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-cnnic-whitelist.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-cnnic-whitelist.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,15 +2,13 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); -const tls = require('tls'); const fs = require('fs'); const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { return path.join(common.fixturesDir, 'keys', `${n}.pem`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-address-family.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-address-family.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-address-family.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-address-family.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const assert = require('assert'); const tls = require('tls'); @@ -36,10 +32,9 @@ dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') { + if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); - return; - } + throw err; } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-given-socket.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-given-socket.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-given-socket.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-given-socket.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); const path = require('path'); + const options = { key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); const path = require('path'); +const tls = require('tls'); // https://github.com/joyent/node/issues/1218 // uncatchable exception on TLS connection error @@ -20,7 +18,10 @@ const options = {cert: cert, key: key, port: common.PORT}; const conn = tls.connect(options, common.fail); - conn.on('error', common.mustCall(function() {})); + conn.on( + 'error', + common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); }) + ); } // SSL_accept/SSL_connect error handling @@ -37,5 +38,8 @@ assert.ok(false); // callback should never be executed }); - conn.on('error', common.mustCall(function() {})); + conn.on( + 'error', + common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); }) + ); } diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-no-host.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-no-host.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-no-host.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-no-host.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-pipe.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-pipe.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-pipe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-pipe.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-simple.js nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-simple.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-connect-simple.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-connect-simple.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); @@ -18,8 +17,8 @@ const server = tls.Server(options, common.mustCall(function(socket) { if (++serverConnected === 2) { - server.close(common.mustCall(function() {})); - server.on('close', common.mustCall(function() {})); + server.close(common.mustCall()); + server.on('close', common.mustCall()); } }, 2)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-delayed-attach-error.js nodejs-6.11.4~dfsg/test/parallel/test-tls-delayed-attach-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-delayed-attach-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-delayed-attach-error.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); const net = require('net'); @@ -23,7 +22,7 @@ secureContext: tls.createSecureContext(options) }); - s.on('_tlsError', common.mustCall(function() {})); + s.on('_tlsError', common.mustCall()); s.on('close', function() { server.close(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-delayed-attach.js nodejs-6.11.4~dfsg/test/parallel/test-tls-delayed-attach.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-delayed-attach.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-delayed-attach.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-destroy-whilst-write.js nodejs-6.11.4~dfsg/test/parallel/test-tls-destroy-whilst-write.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-destroy-whilst-write.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-destroy-whilst-write.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const stream = require('stream'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-dhe.js nodejs-6.11.4~dfsg/test/parallel/test-tls-dhe.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-dhe.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-dhe.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,21 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const spawn = require('child_process').spawn; const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); let nsuccess = 0; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-ecdh-disable.js nodejs-6.11.4~dfsg/test/parallel/test-tls-ecdh-disable.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-ecdh-disable.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-ecdh-disable.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,26 +1,20 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const exec = require('child_process').exec; const fs = require('fs'); const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`), - ciphers: 'ECDHE-RSA-RC4-SHA', + ciphers: 'ECDHE-RSA-AES128-SHA', ecdhCurve: false }; @@ -28,7 +22,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-ecdh.js nodejs-6.11.4~dfsg/test/parallel/test-tls-ecdh.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-ecdh.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-ecdh.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} const assert = require('assert'); const tls = require('tls'); @@ -32,7 +28,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-econnreset.js nodejs-6.11.4~dfsg/test/parallel/test-tls-econnreset.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-econnreset.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-econnreset.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const cacert = @@ -57,9 +55,9 @@ clientError = err; }).listen(0, function() { const options = { - ciphers: 'AES128-GCM-SHA256', - port: this.address().port, - ca: ca + ciphers: 'AES128-GCM-SHA256', + port: this.address().port, + ca: ca }; tls.connect(options).on('error', function(err) { assert(!connectError); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-empty-sni-context.js nodejs-6.11.4~dfsg/test/parallel/test-tls-empty-sni-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-empty-sni-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-empty-sni-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,18 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!process.features.tls_sni) { +if (!process.features.tls_sni) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} const assert = require('assert'); - -if (!common.hasCrypto) { - return common.skip('missing crypto'); -} - const tls = require('tls'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-env-bad-extra-ca.js nodejs-6.11.4~dfsg/test/parallel/test-tls-env-bad-extra-ca.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-env-bad-extra-ca.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-env-bad-extra-ca.js 2017-10-03 17:11:32.000000000 +0000 @@ -3,10 +3,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-env-extra-ca.js nodejs-6.11.4~dfsg/test/parallel/test-tls-env-extra-ca.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-env-extra-ca.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-env-extra-ca.js 2017-10-03 17:11:32.000000000 +0000 @@ -3,24 +3,23 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); +const fs = require('fs'); const tls = require('tls'); + const fork = require('child_process').fork; -const fs = require('fs'); if (process.env.CHILD) { const copts = { port: process.env.PORT, - checkServerIdentity: function() {}, + checkServerIdentity: common.mustCall(), }; - const client = tls.connect(copts, function() { + const client = tls.connect(copts, common.mustCall(function() { client.end('hi'); - }); + })); return; } @@ -29,10 +28,10 @@ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`), }; -const server = tls.createServer(options, function(s) { +const server = tls.createServer(options, common.mustCall(function(s) { s.end('bye'); server.close(); -}).listen(0, common.mustCall(function() { +})).listen(0, common.mustCall(function() { const env = { CHILD: 'yes', PORT: this.address().port, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-external-accessor.js nodejs-6.11.4~dfsg/test/parallel/test-tls-external-accessor.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-external-accessor.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-external-accessor.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -// Ensure accessing ._external doesn't hit an assert in the accessor method. +const assert = require('assert'); const tls = require('tls'); + +// Ensure accessing ._external doesn't hit an assert in the accessor method. { const pctx = tls.createSecureContext().context; const cctx = Object.create(pctx); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-fast-writing.js nodejs-6.11.4~dfsg/test/parallel/test-tls-fast-writing.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-fast-writing.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-fast-writing.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const dir = common.fixturesDir; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-friendly-error-message.js nodejs-6.11.4~dfsg/test/parallel/test-tls-friendly-error-message.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-friendly-error-message.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-friendly-error-message.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-getcipher.js nodejs-6.11.4~dfsg/test/parallel/test-tls-getcipher.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-getcipher.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-getcipher.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-getprotocol.js nodejs-6.11.4~dfsg/test/parallel/test-tls-getprotocol.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-getprotocol.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-getprotocol.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-handshake-error.js nodejs-6.11.4~dfsg/test/parallel/test-tls-handshake-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-handshake-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-handshake-error.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-handshake-nohang.js nodejs-6.11.4~dfsg/test/parallel/test-tls-handshake-nohang.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-handshake-nohang.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-handshake-nohang.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); // neither should hang diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-hello-parser-failure.js nodejs-6.11.4~dfsg/test/parallel/test-tls-hello-parser-failure.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-hello-parser-failure.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-hello-parser-failure.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-honorcipherorder.js nodejs-6.11.4~dfsg/test/parallel/test-tls-honorcipherorder.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-honorcipherorder.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-honorcipherorder.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + let nconns = 0; // We explicitly set TLS version to 1.2 so as to be safe when the diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-inception.js nodejs-6.11.4~dfsg/test/parallel/test-tls-inception.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-inception.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-inception.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-interleave.js nodejs-6.11.4~dfsg/test/parallel/test-tls-interleave.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-interleave.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-interleave.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); @@ -38,7 +37,7 @@ data = data.toString(); while (data.length !== 0) { - assert.strictEqual(data.indexOf(writes[receivedWrites]), 0); + assert(data.startsWith(writes[receivedWrites])); data = data.slice(writes[receivedWrites].length); if (++receivedWrites === writes.length) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-invoke-queued.js nodejs-6.11.4~dfsg/test/parallel/test-tls-invoke-queued.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-invoke-queued.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-invoke-queued.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,31 +1,29 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); - +const tls = require('tls'); let received = ''; const server = tls.createServer({ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) -}, function(c) { - c._write('hello ', null, function() { - c._write('world!', null, function() { +}, common.mustCall(function(c) { + c._write('hello ', null, common.mustCall(function() { + c._write('world!', null, common.mustCall(function() { c.destroy(); - }); - c._write(' gosh', null, function() {}); - }); + })); + // Data on next _write() will be written but callback will not be invoked + c._write(' gosh', null, common.mustNotCall()); + })); server.close(); -}).listen(0, common.mustCall(function() { +})).listen(0, common.mustCall(function() { const c = tls.connect(this.address().port, { rejectUnauthorized: false }, common.mustCall(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-js-stream.js nodejs-6.11.4~dfsg/test/parallel/test-tls-js-stream.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-js-stream.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-js-stream.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const stream = require('stream'); const fs = require('fs'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-junk-closes-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-junk-closes-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-junk-closes-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-junk-closes-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-junk-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-junk-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-junk-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-junk-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-key-mismatch.js nodejs-6.11.4~dfsg/test/parallel/test-tls-key-mismatch.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-key-mismatch.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-key-mismatch.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-legacy-onselect.js nodejs-6.11.4~dfsg/test/parallel/test-tls-legacy-onselect.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-legacy-onselect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-legacy-onselect.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); const server = net.Server(common.mustCall(function(raw) { const pair = tls.createSecurePair(null, true, false, false); - pair.on('error', function() {}); + pair.on('error', () => {}); pair.ssl.setSNICallback(common.mustCall(function() { raw.destroy(); server.close(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-max-send-fragment.js nodejs-6.11.4~dfsg/test/parallel/test-tls-max-send-fragment.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-max-send-fragment.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-max-send-fragment.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const buf = Buffer.allocUnsafe(10000); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-multi-key.js nodejs-6.11.4~dfsg/test/parallel/test-tls-multi-key.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-multi-key.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-multi-key.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-no-cert-required.js nodejs-6.11.4~dfsg/test/parallel/test-tls-no-cert-required.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-no-cert-required.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-no-cert-required.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; -const assert = require('assert'); const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); // Omitting the cert or pfx option to tls.createServer() should not throw. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-no-rsa-key.js nodejs-6.11.4~dfsg/test/parallel/test-tls-no-rsa-key.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-no-rsa-key.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-no-rsa-key.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-no-sslv23.js nodejs-6.11.4~dfsg/test/parallel/test-tls-no-sslv23.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-no-sslv23.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-no-sslv23.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); assert.throws(function() { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-no-sslv3.js nodejs-6.11.4~dfsg/test/parallel/test-tls-no-sslv3.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-no-sslv3.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-no-sslv3.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,21 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +if (common.opensslCli === false) + common.skip('node compiled without OpenSSL CLI.'); + +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const spawn = require('child_process').spawn; -if (common.opensslCli === false) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - const cert = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`); const key = fs.readFileSync(`${common.fixturesDir}/test_key.pem`); const server = tls.createServer({ cert: cert, key: key }, common.mustNotCall()); @@ -48,7 +43,7 @@ process.on('exit', function() { if (/unknown option -ssl3/.test(stderr)) { - common.skip('`openssl s_client -ssl3` not supported.'); + common.printSkipMessage('`openssl s_client -ssl3` not supported.'); } else { assert.strictEqual(errors.length, 1); assert(/:wrong version number/.test(errors[0].message)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-npn-server-client.js nodejs-6.11.4~dfsg/test/parallel/test-tls-npn-server-client.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-npn-server-client.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-npn-server-client.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,22 +1,20 @@ 'use strict'; -if (!process.features.tls_npn) { - common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); - return; -} const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +if (!process.features.tls_npn) + common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-ocsp-callback.js nodejs-6.11.4~dfsg/test/parallel/test-tls-ocsp-callback.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-ocsp-callback.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-ocsp-callback.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,19 +1,15 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_ocsp) { +if (!process.features.tls_ocsp) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} -if (!common.opensslCli) { + +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const assert = require('assert'); @@ -76,7 +72,7 @@ port: this.address().port, requestOCSP: testOptions.ocsp !== false, secureOptions: testOptions.ocsp === false ? - SSL_OP_NO_TICKET : 0, + SSL_OP_NO_TICKET : 0, rejectUnauthorized: false }, function() { clientSecure++; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-on-empty-socket.js nodejs-6.11.4~dfsg/test/parallel/test-tls-on-empty-socket.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-on-empty-socket.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-on-empty-socket.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-over-http-tunnel.js nodejs-6.11.4~dfsg/test/parallel/test-tls-over-http-tunnel.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-over-http-tunnel.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-over-http-tunnel.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const net = require('net'); const http = require('http'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-passphrase.js nodejs-6.11.4~dfsg/test/parallel/test-tls-passphrase.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-passphrase.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-passphrase.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); @@ -39,14 +36,14 @@ passphrase: 'passphrase', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: rawKey, cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -54,7 +51,7 @@ passphrase: 'ignored', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); // Buffer[] tls.connect({ @@ -63,14 +60,14 @@ passphrase: 'passphrase', cert: [cert], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [rawKey], cert: [cert], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -78,7 +75,7 @@ passphrase: 'ignored', cert: [cert], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); // string tls.connect({ @@ -87,14 +84,14 @@ passphrase: 'passphrase', cert: cert.toString(), rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: rawKey.toString(), cert: cert.toString(), rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -102,7 +99,7 @@ passphrase: 'ignored', cert: cert.toString(), rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); // String[] tls.connect({ @@ -111,14 +108,14 @@ passphrase: 'passphrase', cert: [cert.toString()], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [rawKey.toString()], cert: [cert.toString()], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -126,7 +123,7 @@ passphrase: 'ignored', cert: [cert.toString()], rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); // Object[] tls.connect({ @@ -134,7 +131,7 @@ key: [{pem: passKey, passphrase: 'passphrase'}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -142,7 +139,7 @@ passphrase: 'ignored', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -150,28 +147,28 @@ passphrase: 'passphrase', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [{pem: passKey.toString(), passphrase: 'passphrase'}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [{pem: rawKey, passphrase: 'ignored'}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [{pem: rawKey.toString(), passphrase: 'ignored'}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -179,7 +176,7 @@ passphrase: 'ignored', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, @@ -187,21 +184,21 @@ passphrase: 'ignored', cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [{pem: rawKey}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); tls.connect({ port: this.address().port, key: [{pem: rawKey.toString()}], cert: cert, rejectUnauthorized: false - }, common.mustCall(function() {})); + }, common.mustCall()); })).unref(); const errMessagePassword = /bad password read/; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-pause.js nodejs-6.11.4~dfsg/test/parallel/test-tls-pause.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-pause.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-pause.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-peer-certificate-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-tls-peer-certificate-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-peer-certificate-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-peer-certificate-encoding.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-peer-certificate-multi-keys.js nodejs-6.11.4~dfsg/test/parallel/test-tls-peer-certificate-multi-keys.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-peer-certificate-multi-keys.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-peer-certificate-multi-keys.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-pfx-gh-5100-regr.js nodejs-6.11.4~dfsg/test/parallel/test-tls-pfx-gh-5100-regr.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-pfx-gh-5100-regr.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-pfx-gh-5100-regr.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without crypto.'); - return; -} const assert = require('assert'); const tls = require('tls'); @@ -13,7 +11,7 @@ const path = require('path'); const pfx = fs.readFileSync( - path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); + path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); const server = tls.createServer({ pfx: pfx, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-regr-gh-5108.js nodejs-6.11.4~dfsg/test/parallel/test-tls-regr-gh-5108.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-regr-gh-5108.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-regr-gh-5108.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-request-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-tls-request-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-request-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-request-timeout.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-retain-handle-no-abort.js nodejs-6.11.4~dfsg/test/parallel/test-tls-retain-handle-no-abort.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-retain-handle-no-abort.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-retain-handle-no-abort.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const util = require('util'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-securepair-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-securepair-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-securepair-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-securepair-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,19 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const join = require('path').join; const net = require('net'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-server-connection-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-server-connection-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-server-connection-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-server-connection-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js nodejs-6.11.4~dfsg/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-server-verify.js nodejs-6.11.4~dfsg/test/parallel/test-tls-server-verify.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-server-verify.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-server-verify.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} // This is a rather complex test which sets up various TLS servers with node // and connects to them using the 'openssl s_client' command line utility @@ -14,6 +15,14 @@ // - accepted and "unauthorized", or // - accepted and "authorized". +const assert = require('assert'); +const { spawn } = require('child_process'); +const { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION } = + require('crypto').constants; +const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); + const testCases = [{ title: 'Do not request certs. Everyone is unauthorized.', requestCert: false, @@ -22,98 +31,85 @@ CAs: ['ca1-cert'], clients: [{ name: 'agent1', shouldReject: false, shouldAuth: false }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] }, - { title: 'Allow both authed and unauthed connections with CA1', - requestCert: true, - rejectUnauthorized: false, - renegotiate: false, - CAs: ['ca1-cert'], - clients: + { title: 'Allow both authed and unauthed connections with CA1', + requestCert: true, + rejectUnauthorized: false, + renegotiate: false, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] - }, + }, - { title: 'Do not request certs at connection. Do that later', - requestCert: false, - rejectUnauthorized: false, - renegotiate: true, - CAs: ['ca1-cert'], - clients: + { title: 'Do not request certs at connection. Do that later', + requestCert: false, + rejectUnauthorized: false, + renegotiate: true, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] - }, + }, - { title: 'Allow only authed connections with CA1', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca1-cert'], - clients: + { title: 'Allow only authed connections with CA1', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: true }, - { name: 'agent3', shouldReject: true }, - { name: 'nocert', shouldReject: true } + { name: 'agent2', shouldReject: true }, + { name: 'agent3', shouldReject: true }, + { name: 'nocert', shouldReject: true } ] - }, + }, - { title: 'Allow only authed connections with CA1 and CA2', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca1-cert', 'ca2-cert'], - clients: + { title: 'Allow only authed connections with CA1 and CA2', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca1-cert', 'ca2-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: true }, - { name: 'agent3', shouldReject: false, shouldAuth: true }, - { name: 'nocert', shouldReject: true } + { name: 'agent2', shouldReject: true }, + { name: 'agent3', shouldReject: false, shouldAuth: true }, + { name: 'nocert', shouldReject: true } ] - }, + }, - { title: 'Allow only certs signed by CA2 but not in the CRL', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca2-cert'], - crl: 'ca2-crl', - clients: [ - { name: 'agent1', shouldReject: true, shouldAuth: false }, - { name: 'agent2', shouldReject: true, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: true }, - // Agent4 has a cert in the CRL. - { name: 'agent4', shouldReject: true, shouldAuth: false }, - { name: 'nocert', shouldReject: true } - ] - } + { title: 'Allow only certs signed by CA2 but not in the CRL', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca2-cert'], + crl: 'ca2-crl', + clients: [ + { name: 'agent1', shouldReject: true, shouldAuth: false }, + { name: 'agent2', shouldReject: true, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: true }, + // Agent4 has a cert in the CRL. + { name: 'agent4', shouldReject: true, shouldAuth: false }, + { name: 'nocert', shouldReject: true } + ] + } ]; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const tls = require('tls'); - -const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = - require('crypto').constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; - -const assert = require('assert'); -const fs = require('fs'); -const spawn = require('child_process').spawn; - function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } @@ -196,7 +192,7 @@ client.stdout.on('data', function(d) { out += d; - if (!goodbye && /_unauthed/g.test(out)) { + if (!goodbye && /_unauthed/.test(out)) { console.error(`${prefix} * unauthed`); goodbye = true; client.kill(); @@ -204,7 +200,7 @@ rejected = false; } - if (!goodbye && /_authed/g.test(out)) { + if (!goodbye && /_authed/.test(out)) { console.error(`${prefix} * authed`); goodbye = true; client.kill(); @@ -230,7 +226,7 @@ assert.strictEqual( options.shouldAuth, authed, `${prefix}${options.name} authed is ${authed} but should have been ${ - options.shouldAuth}`); + options.shouldAuth}`); } cb(); @@ -296,7 +292,7 @@ if (c.authorized) { console.error(`${prefix}- authed connection: ${ - c.getPeerCertificate().subject.CN}`); + c.getPeerCertificate().subject.CN}`); c.write('\n_authed\n'); } else { console.error(`${prefix}- unauthed connection: %s`, c.authorizationError); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-session-cache.js nodejs-6.11.4~dfsg/test/parallel/test-tls-session-cache.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-session-cache.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-session-cache.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,20 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} +const assert = require('assert'); +const tls = require('tls'); +const fs = require('fs'); +const { join } = require('path'); +const { spawn } = require('child_process'); + +const keyFile = join(common.fixturesDir, 'agent.key'); +const certFile = join(common.fixturesDir, 'agent.crt'); doTest({ tickets: false }, function() { doTest({ tickets: true }, function() { @@ -18,14 +23,6 @@ }); function doTest(testOptions, callback) { - const assert = require('assert'); - const tls = require('tls'); - const fs = require('fs'); - const join = require('path').join; - const spawn = require('child_process').spawn; - - const keyFile = join(common.fixturesDir, 'agent.key'); - const certFile = join(common.fixturesDir, 'agent.crt'); const key = fs.readFileSync(keyFile); const cert = fs.readFileSync(certFile); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-set-ciphers.js nodejs-6.11.4~dfsg/test/parallel/test-tls-set-ciphers.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-set-ciphers.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-set-ciphers.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const exec = require('child_process').exec; @@ -19,7 +15,7 @@ const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`), - ciphers: 'DES-CBC3-SHA' + ciphers: 'AES256-SHA' }; const reply = 'I AM THE WALRUS'; // something recognizable @@ -35,7 +31,7 @@ server.listen(0, '127.0.0.1', function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-set-encoding.js nodejs-6.11.4~dfsg/test/parallel/test-tls-set-encoding.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-set-encoding.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-set-encoding.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,16 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); - const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-sni-option.js nodejs-6.11.4~dfsg/test/parallel/test-tls-sni-option.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-sni-option.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-sni-option.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,21 +1,20 @@ 'use strict'; -if (!process.features.tls_sni) { - common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_sni) + common.skip('node compiled without OpenSSL or with old OpenSSL version.'); + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { @@ -123,7 +122,7 @@ options.port = server.address().port; const client = tls.connect(options, function() { clientResults.push( - /Hostname\/IP doesn't/.test(client.authorizationError || '')); + /Hostname\/IP doesn't/.test(client.authorizationError || '')); client.destroy(); next(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-sni-server-client.js nodejs-6.11.4~dfsg/test/parallel/test-tls-sni-server-client.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-sni-server-client.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-sni-server-client.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,21 +1,19 @@ 'use strict'; -if (!process.features.tls_sni) { +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!process.features.tls_sni) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} -const common = require('../common'); const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-close.js nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-close.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const assert = require('assert'); +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-default-options.js nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-default-options.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-default-options.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-default-options.js 2017-10-03 17:11:32.000000000 +0000 @@ -9,10 +9,8 @@ connect, keys, tls } = require(join(common.fixturesDir, 'tls-connect')); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} test(undefined, (err) => { assert.strictEqual(err.message, 'unable to verify the first certificate'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-destroy.js nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-destroy.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-destroy.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-destroy.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-failed-handshake-emits-error.js nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-failed-handshake-emits-error.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-socket-failed-handshake-emits-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-socket-failed-handshake-emits-error.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); const assert = require('assert'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-startcom-wosign-whitelist.js nodejs-6.11.4~dfsg/test/parallel/test-tls-startcom-wosign-whitelist.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-startcom-wosign-whitelist.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-startcom-wosign-whitelist.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); const path = require('path'); +const tls = require('tls'); + let finished = 0; function filenamePEM(n) { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-starttls-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-starttls-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-starttls-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-starttls-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,10 +5,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-ticket-cluster.js nodejs-6.11.4~dfsg/test/parallel/test-tls-ticket-cluster.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-ticket-cluster.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-ticket-cluster.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const cluster = require('cluster'); const fs = require('fs'); const join = require('path').join; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-ticket.js nodejs-6.11.4~dfsg/test/parallel/test-tls-ticket.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-ticket.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-ticket.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); const crypto = require('crypto'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-timeout-server-2.js nodejs-6.11.4~dfsg/test/parallel/test-tls-timeout-server-2.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-timeout-server-2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-timeout-server-2.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-timeout-server.js nodejs-6.11.4~dfsg/test/parallel/test-tls-timeout-server.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-timeout-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-timeout-server.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-translate-peer-certificate.js nodejs-6.11.4~dfsg/test/parallel/test-tls-translate-peer-certificate.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-translate-peer-certificate.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-translate-peer-certificate.js 2017-10-03 17:11:32.000000000 +0000 @@ -0,0 +1,55 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const { strictEqual, deepStrictEqual } = require('assert'); +const { translatePeerCertificate } = require('_tls_common'); + +const certString = 'A=1\nB=2\nC=3'; +const certObject = { A: '1', B: '2', C: '3' }; + +strictEqual(translatePeerCertificate(null), null); +strictEqual(translatePeerCertificate(undefined), null); + +strictEqual(translatePeerCertificate(0), null); +strictEqual(translatePeerCertificate(1), 1); + +deepStrictEqual(translatePeerCertificate({}), {}); + +deepStrictEqual(translatePeerCertificate({ issuer: '' }), + { issuer: {} }); +deepStrictEqual(translatePeerCertificate({ issuer: null }), + { issuer: null }); +deepStrictEqual(translatePeerCertificate({ issuer: certString }), + { issuer: certObject }); + +deepStrictEqual(translatePeerCertificate({ subject: '' }), + { subject: {} }); +deepStrictEqual(translatePeerCertificate({ subject: null }), + { subject: null }); +deepStrictEqual(translatePeerCertificate({ subject: certString }), + { subject: certObject }); + +deepStrictEqual(translatePeerCertificate({ issuerCertificate: '' }), + { issuerCertificate: null }); +deepStrictEqual(translatePeerCertificate({ issuerCertificate: null }), + { issuerCertificate: null }); +deepStrictEqual( + translatePeerCertificate({ issuerCertificate: { subject: certString } }), + { issuerCertificate: { subject: certObject } }); + +{ + const cert = {}; + cert.issuerCertificate = cert; + deepStrictEqual(translatePeerCertificate(cert), { issuerCertificate: cert }); +} + +deepStrictEqual(translatePeerCertificate({ infoAccess: '' }), + { infoAccess: {} }); +deepStrictEqual(translatePeerCertificate({ infoAccess: null }), + { infoAccess: null }); +deepStrictEqual( + translatePeerCertificate({ infoAccess: 'OCSP - URI:file:///etc/passwd' }), + { infoAccess: { 'OCSP - URI': ['file:///etc/passwd'] } }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-wrap-timeout.js nodejs-6.11.4~dfsg/test/parallel/test-tls-wrap-timeout.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-wrap-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-wrap-timeout.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-writewrap-leak.js nodejs-6.11.4~dfsg/test/parallel/test-tls-writewrap-leak.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-writewrap-leak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-writewrap-leak.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const net = require('net'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-tls-zero-clear-in.js nodejs-6.11.4~dfsg/test/parallel/test-tls-zero-clear-in.js --- nodejs-6.11.2~dfsg/test/parallel/test-tls-zero-clear-in.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-tls-zero-clear-in.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-url.js nodejs-6.11.4~dfsg/test/parallel/test-url.js --- nodejs-6.11.2~dfsg/test/parallel/test-url.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-url.js 2017-10-03 17:11:32.000000000 +0000 @@ -1684,7 +1684,7 @@ true, false, 0, - function() {} + () => {} ]; for (let i = 0; i < throws.length; i++) { assert.throws(function() { url.format(throws[i]); }, TypeError); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util-format.js nodejs-6.11.4~dfsg/test/parallel/test-util-format.js --- nodejs-6.11.2~dfsg/test/parallel/test-util-format.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util-format.js 2017-10-03 17:11:32.000000000 +0000 @@ -25,7 +25,7 @@ assert.strictEqual(util.format('%j', symbol), 'undefined'); assert.throws(function() { util.format('%d', symbol); -}, TypeError); +}, /^TypeError: Cannot convert a Symbol value to a number$/); assert.strictEqual(util.format('%d', 42.0), '42'); assert.strictEqual(util.format('%d', 42), '42'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util-inherits.js nodejs-6.11.4~dfsg/test/parallel/test-util-inherits.js --- nodejs-6.11.2~dfsg/test/parallel/test-util-inherits.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util-inherits.js 2017-10-03 17:11:32.000000000 +0000 @@ -28,7 +28,7 @@ assert.strictEqual(b.b(), 'b'); assert.strictEqual(b.constructor, B); - // two levels of inheritance +// two levels of inheritance function C() { B.call(this, 'b'); this._c = 'c'; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util-inspect.js nodejs-6.11.4~dfsg/test/parallel/test-util-inspect.js --- nodejs-6.11.2~dfsg/test/parallel/test-util-inspect.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util-inspect.js 2017-10-03 17:11:32.000000000 +0000 @@ -42,8 +42,9 @@ '{ a: [Object] }'); assert.strictEqual(util.inspect({'a': {'b': { 'c': 2}}}, false, 1), '{ a: { b: [Object] } }'); -assert.strictEqual(util.inspect(Object.create({}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}})), +assert.strictEqual(util.inspect( + Object.create({}, + {visible: {value: 1, enumerable: true}, hidden: {value: 2}})), '{ visible: 1 }' ); @@ -137,14 +138,14 @@ Uint32Array, Uint8Array, Uint8ClampedArray ].forEach((constructor) => { - const length = 2; - const byteLength = length * constructor.BYTES_PER_ELEMENT; - const array = new constructor(new ArrayBuffer(byteLength), 0, length); - array[0] = 65; - array[1] = 97; - assert.strictEqual( - util.inspect(array, true), - `${constructor.name} [\n` + + const length = 2; + const byteLength = length * constructor.BYTES_PER_ELEMENT; + const array = new constructor(new ArrayBuffer(byteLength), 0, length); + array[0] = 65; + array[1] = 97; + assert.strictEqual( + util.inspect(array, true), + `${constructor.name} [\n` + ' 65,\n' + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + @@ -152,11 +153,11 @@ ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( - util.inspect(array, false), - `${constructor.name} [ 65, 97 ]` - ); - }); + assert.strictEqual( + util.inspect(array, false), + `${constructor.name} [ 65, 97 ]` + ); +}); // Now check that declaring a TypedArray in a different context works the same [ Float32Array, @@ -168,17 +169,17 @@ Uint32Array, Uint8Array, Uint8ClampedArray ].forEach((constructor) => { - const length = 2; - const byteLength = length * constructor.BYTES_PER_ELEMENT; - const array = vm.runInNewContext( - 'new constructor(new ArrayBuffer(byteLength), 0, length)', - { constructor, byteLength, length } - ); - array[0] = 65; - array[1] = 97; - assert.strictEqual( - util.inspect(array, true), - `${constructor.name} [\n` + + const length = 2; + const byteLength = length * constructor.BYTES_PER_ELEMENT; + const array = vm.runInNewContext( + 'new constructor(new ArrayBuffer(byteLength), 0, length)', + { constructor, byteLength, length } + ); + array[0] = 65; + array[1] = 97; + assert.strictEqual( + util.inspect(array, true), + `${constructor.name} [\n` + ' 65,\n' + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + @@ -186,19 +187,25 @@ ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( - util.inspect(array, false), - `${constructor.name} [ 65, 97 ]` - ); - }); + assert.strictEqual( + util.inspect(array, false), + `${constructor.name} [ 65, 97 ]` + ); +}); // Due to the hash seed randomization it's not deterministic the order that // the following ways this hash is displayed. // See http://codereview.chromium.org/9124004/ { - const out = util.inspect(Object.create({}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true); + const out = + util.inspect( + Object.create( + {}, + {visible: {value: 1, enumerable: true}, hidden: {value: 2}} + ), + true + ); if (out !== '{ [hidden]: 2, visible: 1 }' && out !== '{ visible: 1, [hidden]: 2 }') { common.fail(`unexpected value for out ${out}`); @@ -793,7 +800,7 @@ 'SetSubclass { 1, 2, 3 }'); assert.strictEqual(util.inspect(new MapSubclass([['foo', 42]])), 'MapSubclass { \'foo\' => 42 }'); - assert.strictEqual(util.inspect(new PromiseSubclass(function() {})), + assert.strictEqual(util.inspect(new PromiseSubclass(() => {})), 'PromiseSubclass { }'); } @@ -840,7 +847,7 @@ { const x = Array(101); assert(/^\[ ... 101 more items ]$/.test( - util.inspect(x, {maxArrayLength: 0}))); + util.inspect(x, {maxArrayLength: 0}))); } { @@ -856,7 +863,7 @@ { const x = new Uint8Array(101); assert(/\[ ... 101 more items ]$/.test( - util.inspect(x, {maxArrayLength: 0}))); + util.inspect(x, {maxArrayLength: 0}))); } { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util-inspect-simd.js nodejs-6.11.4~dfsg/test/parallel/test-util-inspect-simd.js --- nodejs-6.11.2~dfsg/test/parallel/test-util-inspect-simd.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util-inspect-simd.js 2017-10-03 17:11:32.000000000 +0000 @@ -7,56 +7,56 @@ const inspect = require('util').inspect; assert.strictEqual( - inspect(SIMD.Bool16x8()), - 'Bool16x8 [ false, false, false, false, false, false, false, false ]'); + inspect(SIMD.Bool16x8()), + 'Bool16x8 [ false, false, false, false, false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Bool32x4()), - 'Bool32x4 [ false, false, false, false ]'); + inspect(SIMD.Bool32x4()), + 'Bool32x4 [ false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Bool8x16()), - 'Bool8x16 [\n false,\n false,\n false,\n false,\n false,\n' + + inspect(SIMD.Bool8x16()), + 'Bool8x16 [\n false,\n false,\n false,\n false,\n false,\n' + ' false,\n false,\n false,\n false,\n false,\n false,\n' + ' false,\n false,\n false,\n false,\n false ]'); assert.strictEqual( - inspect(SIMD.Bool32x4()), - 'Bool32x4 [ false, false, false, false ]'); + inspect(SIMD.Bool32x4()), + 'Bool32x4 [ false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Float32x4()), - 'Float32x4 [ NaN, NaN, NaN, NaN ]'); + inspect(SIMD.Float32x4()), + 'Float32x4 [ NaN, NaN, NaN, NaN ]'); assert.strictEqual( - inspect(SIMD.Int16x8()), - 'Int16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Int16x8()), + 'Int16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); assert.strictEqual( - inspect(SIMD.Int32x4()), - 'Int32x4 [ 0, 0, 0, 0 ]'); + inspect(SIMD.Int32x4()), + 'Int32x4 [ 0, 0, 0, 0 ]'); assert.strictEqual( - inspect(SIMD.Int8x16()), - 'Int8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Int8x16()), + 'Int8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); // The SIMD types below are not available in v5. if (typeof SIMD.Uint16x8 === 'function') { assert.strictEqual( - inspect(SIMD.Uint16x8()), - 'Uint16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Uint16x8()), + 'Uint16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); } if (typeof SIMD.Uint32x4 === 'function') { assert.strictEqual( - inspect(SIMD.Uint32x4()), - 'Uint32x4 [ 0, 0, 0, 0 ]'); + inspect(SIMD.Uint32x4()), + 'Uint32x4 [ 0, 0, 0, 0 ]'); } if (typeof SIMD.Uint8x16 === 'function') { assert.strictEqual( - inspect(SIMD.Uint8x16()), - 'Uint8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Uint8x16()), + 'Uint8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); } // Tests from test-inspect.js that should not fail with --harmony_simd. diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util.js nodejs-6.11.4~dfsg/test/parallel/test-util.js --- nodejs-6.11.2~dfsg/test/parallel/test-util.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util.js 2017-10-03 17:11:32.000000000 +0000 @@ -12,7 +12,7 @@ assert.strictEqual(true, util.isArray(new Array('with', 'some', 'entries'))); assert.strictEqual(true, util.isArray(context('Array')())); assert.strictEqual(false, util.isArray({})); -assert.strictEqual(false, util.isArray({ push: function() {} })); +assert.strictEqual(false, util.isArray({ push: () => {} })); assert.strictEqual(false, util.isArray(/regexp/)); assert.strictEqual(false, util.isArray(new Error())); assert.strictEqual(false, util.isArray(Object.create(Array.prototype))); @@ -61,7 +61,7 @@ assert.strictEqual(false, util.isPrimitive(new Date())); assert.strictEqual(false, util.isPrimitive([])); assert.strictEqual(false, util.isPrimitive(/regexp/)); -assert.strictEqual(false, util.isPrimitive(function() {})); +assert.strictEqual(false, util.isPrimitive(() => {})); assert.strictEqual(false, util.isPrimitive(new Number(1))); assert.strictEqual(false, util.isPrimitive(new String('bla'))); assert.strictEqual(false, util.isPrimitive(new Boolean(true))); @@ -117,7 +117,7 @@ assert.strictEqual(util.isSymbol('string'), false); assert.strictEqual(util.isFunction(() => {}), true); -assert.strictEqual(util.isFunction(function() {}), true); +assert.strictEqual(util.isFunction(() => {}), true); assert.strictEqual(util.isFunction(), false); assert.strictEqual(util.isFunction('string'), false); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-util-sigint-watchdog.js nodejs-6.11.4~dfsg/test/parallel/test-util-sigint-watchdog.js --- nodejs-6.11.2~dfsg/test/parallel/test-util-sigint-watchdog.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-util-sigint-watchdog.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const binding = process.binding('util'); - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const binding = process.binding('util'); + [(next) => { // Test with no signal observed. binding.startSigintWatchdog(); @@ -17,7 +16,7 @@ next(); }, (next) => { - // Test with one call to the watchdog, one signal. + // Test with one call to the watchdog, one signal. binding.startSigintWatchdog(); process.kill(process.pid, 'SIGINT'); waitForPendingSignal(common.mustCall(() => { @@ -27,7 +26,7 @@ })); }, (next) => { - // Nested calls are okay. + // Nested calls are okay. binding.startSigintWatchdog(); binding.startSigintWatchdog(); process.kill(process.pid, 'SIGINT'); @@ -40,7 +39,7 @@ })); }, () => { - // Signal comes in after first call to stop. + // Signal comes in after first call to stop. binding.startSigintWatchdog(); binding.startSigintWatchdog(); const hadPendingSignals1 = binding.stopSigintWatchdog(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-cached-data.js nodejs-6.11.4~dfsg/test/parallel/test-vm-cached-data.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-cached-data.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-cached-data.js 2017-10-03 17:11:32.000000000 +0000 @@ -3,7 +3,6 @@ const assert = require('assert'); const vm = require('vm'); const spawnSync = require('child_process').spawnSync; -const Buffer = require('buffer').Buffer; function getSource(tag) { return `(function ${tag}() { return '${tag}'; })`; diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-context-async-script.js nodejs-6.11.4~dfsg/test/parallel/test-vm-context-async-script.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-context-async-script.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-context-async-script.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,14 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const vm = require('vm'); -const sandbox = { setTimeout: setTimeout }; +const sandbox = { setTimeout }; const ctx = vm.createContext(sandbox); vm.runInContext('setTimeout(function() { x = 3; }, 0);', ctx); -setTimeout(function() { +setTimeout(common.mustCall(() => { assert.strictEqual(sandbox.x, 3); assert.strictEqual(ctx.x, 3); -}, 1); +}), 1); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-context.js nodejs-6.11.4~dfsg/test/parallel/test-vm-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -6,29 +6,29 @@ const Script = vm.Script; let script = new Script('"passed";'); -console.error('run in a new empty context'); +// Run in a new empty context let context = vm.createContext(); let result = script.runInContext(context); assert.strictEqual('passed', result); -console.error('create a new pre-populated context'); -context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); +// Create a new pre-populated context +context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' }); assert.strictEqual('bar', context.foo); assert.strictEqual('lala', context.thing); -console.error('test updating context'); +// Test updating context script = new Script('foo = 3;'); result = script.runInContext(context); assert.strictEqual(3, context.foo); assert.strictEqual('lala', context.thing); // Issue GH-227: -assert.throws(function() { +assert.throws(() => { vm.runInNewContext('', null, 'some.js'); }, /^TypeError: sandbox must be an object$/); // Issue GH-1140: -console.error('test runInContext signature'); +// Test runInContext signature let gh1140Exception; try { vm.runInContext('throw new Error()', context, 'expected-filename.js'); @@ -56,8 +56,8 @@ }); // Issue GH-693: -console.error('test RegExp as argument to assert.throws'); -script = vm.createScript('var assert = require(\'assert\'); assert.throws(' + +// Test RegExp as argument to assert.throws +script = vm.createScript('const assert = require(\'assert\'); assert.throws(' + 'function() { throw "hello world"; }, /hello/);', 'some.js'); script.runInNewContext({ require: require }); @@ -71,14 +71,14 @@ // Error on the first line of a module should // have the correct line and column number -assert.throws(function() { +assert.throws(() => { vm.runInContext('throw new Error()', context, { filename: 'expected-filename.js', lineOffset: 32, columnOffset: 123 }); -}, function(err) { - return /expected-filename.js:33:130/.test(err.stack); +}, (err) => { + return /expected-filename\.js:33:130/.test(err.stack); }, 'Expected appearance of proper offset in Error stack'); // https://github.com/nodejs/node/issues/6158 diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-create-and-run-in-context.js nodejs-6.11.4~dfsg/test/parallel/test-vm-create-and-run-in-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-create-and-run-in-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-create-and-run-in-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,24 +5,24 @@ const vm = require('vm'); -console.error('run in a new empty context'); +// Run in a new empty context let context = vm.createContext(); let result = vm.runInContext('"passed";', context); assert.strictEqual('passed', result); -console.error('create a new pre-populated context'); -context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); +// Create a new pre-populated context +context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' }); assert.strictEqual('bar', context.foo); assert.strictEqual('lala', context.thing); -console.error('test updating context'); +// Test updating context result = vm.runInContext('var foo = 3;', context); assert.strictEqual(3, context.foo); assert.strictEqual('lala', context.thing); // https://github.com/nodejs/node/issues/5768 -console.error('run in contextified sandbox without referencing the context'); -const sandbox = {x: 1}; +// Run in contextified sandbox without referencing the context +const sandbox = { x: 1 }; vm.createContext(sandbox); global.gc(); vm.runInContext('x = 2', sandbox); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-create-context-arg.js nodejs-6.11.4~dfsg/test/parallel/test-vm-create-context-arg.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-create-context-arg.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-create-context-arg.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,7 +5,7 @@ assert.throws(function() { vm.createContext('string is not supported'); -}, TypeError); +}, /^TypeError: sandbox must be an object$/); assert.doesNotThrow(function() { vm.createContext({ a: 1 }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-function-declaration.js nodejs-6.11.4~dfsg/test/parallel/test-vm-function-declaration.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-function-declaration.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-function-declaration.js 2017-10-03 17:11:32.000000000 +0000 @@ -7,7 +7,7 @@ // Function declaration and expression should both be copied to the // sandboxed context. -let code = 'var a = function() {};\n'; +let code = 'var a = function () {};\n'; code += 'function b(){}\n'; // Grab the global b function as the completion value, to ensure that @@ -21,5 +21,3 @@ assert.strictEqual(typeof o.a, 'function', 'a should be function'); assert.strictEqual(typeof o.b, 'function', 'b should be function'); assert.strictEqual(res, o.b, 'result should be global b function'); - -console.log('ok'); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-new-script-new-context.js nodejs-6.11.4~dfsg/test/parallel/test-vm-new-script-new-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-new-script-new-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-new-script-new-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,69 +1,86 @@ 'use strict'; -const common = require('../common'); -const assert = require('assert'); -const Script = require('vm').Script; - -common.globalCheck = false; - -console.error('run a string'); -let script = new Script('\'passed\';'); -console.error('script created'); -const result1 = script.runInNewContext(); -const result2 = script.runInNewContext(); -assert.strictEqual('passed', result1); -assert.strictEqual('passed', result2); - -console.error('thrown error'); -script = new Script('throw new Error(\'test\');'); -assert.throws(function() { - script.runInNewContext(); -}, /^Error: test$/); - - -console.error('undefined reference'); -script = new Script('foo.bar = 5;'); -assert.throws(function() { - script.runInNewContext(); -}, /^ReferenceError: foo is not defined$/); +require('../common'); +const assert = require('assert'); -global.hello = 5; -script = new Script('hello = 2'); -script.runInNewContext(); -assert.strictEqual(5, global.hello); - - -console.error('pass values in and out'); -global.code = 'foo = 1;' + - 'bar = 2;' + - 'if (baz !== 3) throw new Error(\'test fail\');'; -global.foo = 2; -global.obj = { foo: 0, baz: 3 }; -script = new Script(global.code); -/* eslint-disable no-unused-vars */ -const baz = script.runInNewContext(global.obj); -/* eslint-enable no-unused-vars */ -assert.strictEqual(1, global.obj.foo); -assert.strictEqual(2, global.obj.bar); -assert.strictEqual(2, global.foo); - -console.error('call a function by reference'); -script = new Script('f()'); -function changeFoo() { global.foo = 100; } -script.runInNewContext({ f: changeFoo }); -assert.strictEqual(global.foo, 100); - -console.error('modify an object by reference'); -script = new Script('f.a = 2'); -const f = { a: 1 }; -script.runInNewContext({ f: f }); -assert.strictEqual(f.a, 2); +const Script = require('vm').Script; -assert.throws(function() { +{ + const script = new Script('\'passed\';'); + const result1 = script.runInNewContext(); + const result2 = script.runInNewContext(); + assert.strictEqual('passed', result1); + assert.strictEqual('passed', result2); +} + +{ + const script = new Script('throw new Error(\'test\');'); + assert.throws(() => { + script.runInNewContext(); + }, /^Error: test$/); +} + +{ + const script = new Script('foo.bar = 5;'); + assert.throws(() => { + script.runInNewContext(); + }, /^ReferenceError: foo is not defined$/); +} + +{ + global.hello = 5; + const script = new Script('hello = 2'); script.runInNewContext(); -}, /^ReferenceError: f is not defined$/); + assert.strictEqual(5, global.hello); -console.error('invalid this'); -assert.throws(function() { - script.runInNewContext.call('\'hello\';'); -}, /^TypeError: this\.runInContext is not a function$/); + // cleanup + delete global.hello; +} + +{ + global.code = 'foo = 1;' + + 'bar = 2;' + + 'if (baz !== 3) throw new Error(\'test fail\');'; + global.foo = 2; + global.obj = { foo: 0, baz: 3 }; + const script = new Script(global.code); + /* eslint-disable no-unused-vars */ + const baz = script.runInNewContext(global.obj); + /* eslint-enable no-unused-vars */ + assert.strictEqual(1, global.obj.foo); + assert.strictEqual(2, global.obj.bar); + assert.strictEqual(2, global.foo); + + //cleanup + delete global.code; + delete global.foo; + delete global.obj; +} + +{ + const script = new Script('f()'); + function changeFoo() { global.foo = 100; } + script.runInNewContext({ f: changeFoo }); + assert.strictEqual(global.foo, 100); + + // cleanup + delete global.foo; +} + +{ + const script = new Script('f.a = 2'); + const f = { a: 1 }; + script.runInNewContext({ f: f }); + assert.strictEqual(f.a, 2); + + assert.throws(() => { + script.runInNewContext(); + }, /^ReferenceError: f is not defined$/); +} + +{ + const script = new Script(''); + assert.throws(() => { + script.runInNewContext.call('\'hello\';'); + }, /^TypeError: this\.runInContext is not a function$/); +} diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-new-script-this-context.js nodejs-6.11.4~dfsg/test/parallel/test-vm-new-script-this-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-new-script-this-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-new-script-this-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,14 +5,14 @@ common.globalCheck = false; -console.error('run a string'); +// Run a string let script = new Script('\'passed\';'); const result = script.runInThisContext(script); assert.strictEqual('passed', result); -console.error('thrown error'); +// Thrown error script = new Script('throw new Error(\'test\');'); -assert.throws(function() { +assert.throws(() => { script.runInThisContext(script); }, /^Error: test$/); @@ -22,7 +22,7 @@ assert.strictEqual(2, global.hello); -console.error('pass values'); +// Pass values global.code = 'foo = 1;' + 'bar = 2;' + 'if (typeof baz !== "undefined") throw new Error("test fail");'; @@ -34,7 +34,7 @@ assert.strictEqual(2, global.bar); assert.strictEqual(1, global.foo); -console.error('call a function'); +// Call a function global.f = function() { global.foo = 100; }; script = new Script('f()'); script.runInThisContext(script); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-run-in-new-context.js nodejs-6.11.4~dfsg/test/parallel/test-vm-run-in-new-context.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-run-in-new-context.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-run-in-new-context.js 2017-10-03 17:11:32.000000000 +0000 @@ -10,12 +10,12 @@ common.globalCheck = false; -console.error('run a string'); +// Run a string const result = vm.runInNewContext('\'passed\';'); assert.strictEqual('passed', result); -console.error('thrown error'); -assert.throws(function() { +// Thrown error +assert.throws(() => { vm.runInNewContext('throw new Error(\'test\');'); }, /^Error: test$/); @@ -24,7 +24,7 @@ assert.strictEqual(5, global.hello); -console.error('pass values in and out'); +// Pass values in and out global.code = 'foo = 1;' + 'bar = 2;' + 'if (baz !== 3) throw new Error(\'test fail\');'; @@ -37,17 +37,17 @@ assert.strictEqual(2, global.obj.bar); assert.strictEqual(2, global.foo); -console.error('call a function by reference'); +// Call a function by reference function changeFoo() { global.foo = 100; } vm.runInNewContext('f()', { f: changeFoo }); assert.strictEqual(global.foo, 100); -console.error('modify an object by reference'); +// Modify an object by reference const f = { a: 1 }; vm.runInNewContext('f.a = 2', { f: f }); assert.strictEqual(f.a, 2); -console.error('use function in context without referencing context'); +// Use function in context without referencing context const fn = vm.runInNewContext('(function() { obj.p = {}; })', { obj: {} }); global.gc(); fn(); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-sigint-existing-handler.js nodejs-6.11.4~dfsg/test/parallel/test-vm-sigint-existing-handler.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-sigint-existing-handler.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-sigint-existing-handler.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,8 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) { + // No way to send CTRL_C_EVENT to processes from JS right now. + common.skip('platform not supported'); +} + const assert = require('assert'); const vm = require('vm'); - const spawn = require('child_process').spawn; const methods = [ @@ -10,12 +14,6 @@ 'runInContext' ]; -if (common.isWindows) { - // No way to send CTRL_C_EVENT to processes from JS right now. - common.skip('platform not supported'); - return; -} - if (process.argv[2] === 'child') { const method = process.argv[3]; assert.ok(method); @@ -34,8 +32,8 @@ const script = `process.send('${method}'); while(true) {}`; const args = method === 'runInContext' ? - [vm.createContext({ process })] : - []; + [vm.createContext({ process })] : + []; const options = { breakOnSigint: true }; assert.throws(() => { vm[method](script, ...args, options); }, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-sigint.js nodejs-6.11.4~dfsg/test/parallel/test-vm-sigint.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-sigint.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-sigint.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,8 +1,13 @@ 'use strict'; const common = require('../common'); + +if (common.isWindows) { + // No way to send CTRL_C_EVENT to processes from JS right now. + common.skip('platform not supported'); +} + const assert = require('assert'); const vm = require('vm'); - const spawn = require('child_process').spawn; const methods = [ @@ -10,20 +15,14 @@ 'runInContext' ]; -if (common.isWindows) { - // No way to send CTRL_C_EVENT to processes from JS right now. - common.skip('platform not supported'); - return; -} - if (process.argv[2] === 'child') { const method = process.argv[3]; assert.ok(method); const script = `process.send('${method}'); while(true) {}`; const args = method === 'runInContext' ? - [vm.createContext({ process })] : - []; + [vm.createContext({ process })] : + []; const options = { breakOnSigint: true }; assert.throws(() => { vm[method](script, ...args, options); }, diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-syntax-error-message.js nodejs-6.11.4~dfsg/test/parallel/test-vm-syntax-error-message.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-syntax-error-message.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-syntax-error-message.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const child_process = require('child_process'); @@ -11,16 +11,12 @@ 'catch (e) { console.log(e.message); }' ]); -p.stderr.on('data', function(data) { - assert(false, 'Unexpected stderr data: ' + data); -}); +p.stderr.on('data', common.mustNotCall()); let output = ''; -p.stdout.on('data', function(data) { - output += data; -}); +p.stdout.on('data', (data) => output += data); -process.on('exit', function() { +p.stdout.on('end', common.mustCall(() => { assert.strictEqual(output.replace(/[\r\n]+/g, ''), 'boo'); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-vm-syntax-error-stderr.js nodejs-6.11.4~dfsg/test/parallel/test-vm-syntax-error-stderr.js --- nodejs-6.11.2~dfsg/test/parallel/test-vm-syntax-error-stderr.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-vm-syntax-error-stderr.js 2017-10-03 17:11:32.000000000 +0000 @@ -12,18 +12,14 @@ wrong_script ]); -p.stdout.on('data', function(data) { - common.fail(`Unexpected stdout data: ${data}`); -}); +p.stdout.on('data', common.mustNotCall()); let output = ''; -p.stderr.on('data', function(data) { - output += data; -}); +p.stderr.on('data', (data) => output += data); -process.on('exit', function() { +p.stderr.on('end', common.mustCall(() => { assert(/BEGIN CERT/.test(output)); assert(/^\s+\^/m.test(output)); assert(/Invalid left-hand side expression in prefix operation/.test(output)); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-windows-abort-exitcode.js nodejs-6.11.4~dfsg/test/parallel/test-windows-abort-exitcode.js --- nodejs-6.11.2~dfsg/test/parallel/test-windows-abort-exitcode.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-windows-abort-exitcode.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('test is windows specific'); + const assert = require('assert'); +const spawn = require('child_process').spawn; // This test makes sure that an aborted node process // exits with code 3 on Windows. // Spawn a child, force an abort, and then check the // exit code in the parent. -const spawn = require('child_process').spawn; -if (!common.isWindows) { - common.skip('test is windows specific'); - return; -} if (process.argv[2] === 'child') { process.abort(); } else { diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-close-after-write.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-close-after-write.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-close-after-write.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-close-after-write.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,5 +5,5 @@ zlib.gzip('hello', common.mustCall(function(err, out) { const unzip = zlib.createGunzip(); unzip.write(out); - unzip.close(common.mustCall(function() {})); + unzip.close(common.mustCall()); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-convenience-methods.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-convenience-methods.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-convenience-methods.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-convenience-methods.js 2017-10-03 17:11:32.000000000 +0000 @@ -24,7 +24,7 @@ zlib[method[1]](result, opts, function(err, result) { assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} with options.`); + method[0]}/${method[1]} with options.`); hadRun++; }); }); @@ -33,7 +33,7 @@ zlib[method[1]](result, function(err, result) { assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} without options.`); + method[0]}/${method[1]} without options.`); hadRun++; }); }); @@ -42,14 +42,14 @@ result = zlib[`${method[1]}Sync`](result, opts); assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} with options.`); + method[0]}/${method[1]} with options.`); hadRun++; result = zlib[`${method[0]}Sync`](expect); result = zlib[`${method[1]}Sync`](result); assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} without options.`); + method[0]}/${method[1]} without options.`); hadRun++; }); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-failed-init.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-failed-init.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-failed-init.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-failed-init.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,10 +1,15 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); +if (process.config.variables.node_shared_zlib && + /^1\.2\.[0-8]$/.test(process.versions.zlib)) { + common.skip("older versions of shared zlib don't throw on create"); +} + // For raw deflate encoding, requests for 256-byte windows are rejected as // invalid by zlib. // (http://zlib.net/manual.html#Advanced) diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-from-gzip.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-from-gzip.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-from-gzip.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-from-gzip.js 2017-10-03 17:11:32.000000000 +0000 @@ -21,10 +21,10 @@ const out = fs.createWriteStream(outputFile); inp.pipe(gunzip).pipe(out); -out.on('close', function() { +out.on('close', common.mustCall(() => { const actual = fs.readFileSync(outputFile); assert.strictEqual(actual.length, expect.length, 'length should match'); for (let i = 0, l = actual.length; i < l; i++) { assert.strictEqual(actual[i], expect[i], `byte[${i}]`); } -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-from-string.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-from-string.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-from-string.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-from-string.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,7 +1,7 @@ 'use strict'; // test compressing and uncompressing a string with zlib -require('../common'); +const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); @@ -33,32 +33,32 @@ 'mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2' + 'sHnHNzRtagj5AQAA'; -zlib.deflate(inputString, function(err, buffer) { +zlib.deflate(inputString, common.mustCall((err, buffer) => { assert.strictEqual(buffer.toString('base64'), expectedBase64Deflate, 'deflate encoded string should match'); -}); +})); -zlib.gzip(inputString, function(err, buffer) { +zlib.gzip(inputString, common.mustCall((err, buffer) => { // Can't actually guarantee that we'll get exactly the same // deflated bytes when we compress a string, since the header // depends on stuff other than the input string itself. // However, decrypting it should definitely yield the same // result that we're expecting, and this should match what we get // from inflating the known valid deflate data. - zlib.gunzip(buffer, function(err, gunzipped) { + zlib.gunzip(buffer, common.mustCall((err, gunzipped) => { assert.strictEqual(gunzipped.toString(), inputString, 'Should get original string after gzip/gunzip'); - }); -}); + })); +})); let buffer = Buffer.from(expectedBase64Deflate, 'base64'); -zlib.unzip(buffer, function(err, buffer) { +zlib.unzip(buffer, common.mustCall((err, buffer) => { assert.strictEqual(buffer.toString(), inputString, 'decoded inflated string should match'); -}); +})); buffer = Buffer.from(expectedBase64Gzip, 'base64'); -zlib.unzip(buffer, function(err, buffer) { +zlib.unzip(buffer, common.mustCall((err, buffer) => { assert.strictEqual(buffer.toString(), inputString, 'decoded gunzipped string should match'); -}); +})); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-invalid-input.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-invalid-input.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-invalid-input.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-invalid-input.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,26 @@ 'use strict'; // test uncompressing invalid input -require('../common'); +const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); -const nonStringInputs = [1, true, {a: 1}, ['a']]; +const nonStringInputs = [ + 1, + true, + { a: 1 }, + ['a'] +]; -console.error('Doing the non-strings'); -nonStringInputs.forEach(function(input) { +// zlib.Unzip classes need to get valid data, or else they'll throw. +const unzips = [ + zlib.Unzip(), + zlib.Gunzip(), + zlib.Inflate(), + zlib.InflateRaw() +]; + +nonStringInputs.forEach(common.mustCall((input) => { // zlib.gunzip should not throw an error when called with bad input. assert.doesNotThrow(function() { zlib.gunzip(input, function(err, buffer) { @@ -16,30 +28,12 @@ assert.ok(err); }); }); -}); +}, nonStringInputs.length)); -console.error('Doing the unzips'); -// zlib.Unzip classes need to get valid data, or else they'll throw. -const unzips = [ zlib.Unzip(), - zlib.Gunzip(), - zlib.Inflate(), - zlib.InflateRaw() ]; -const hadError = []; -unzips.forEach(function(uz, i) { - console.error(`Error for ${uz.constructor.name}`); - uz.on('error', function(er) { - console.error('Error event', er); - hadError[i] = true; - }); - - uz.on('end', function(er) { - throw new Error(`end event should not be emitted ${uz.constructor.name}`); - }); +unzips.forEach(common.mustCall((uz, i) => { + uz.on('error', common.mustCall()); + uz.on('end', common.mustNotCall); // this will trigger error event uz.write('this is not valid compressed data.'); -}); - -process.on('exit', function() { - assert.deepStrictEqual(hadError, [true, true, true, true], 'expect 4 errors'); -}); +}, unzips.length)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib.js nodejs-6.11.4~dfsg/test/parallel/test-zlib.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib.js 2017-10-03 17:11:32.000000000 +0000 @@ -4,7 +4,6 @@ const zlib = require('zlib'); const path = require('path'); const fs = require('fs'); -const util = require('util'); const stream = require('stream'); let zlibPairs = [ @@ -48,105 +47,104 @@ } const tests = {}; -testFiles.forEach(function(file) { +testFiles.forEach(common.mustCall((file) => { tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file)); -}); +}, testFiles.length)); // stream that saves everything -function BufferStream() { - this.chunks = []; - this.length = 0; - this.writable = true; - this.readable = true; +class BufferStream extends stream.Stream { + constructor() { + super(); + this.chunks = []; + this.length = 0; + this.writable = true; + this.readable = true; + } + + write(c) { + this.chunks.push(c); + this.length += c.length; + return true; + } + + end(c) { + if (c) this.write(c); + // flatten + const buf = Buffer.allocUnsafe(this.length); + let i = 0; + this.chunks.forEach((c) => { + c.copy(buf, i); + i += c.length; + }); + this.emit('data', buf); + this.emit('end'); + return true; + } } -util.inherits(BufferStream, stream.Stream); - -BufferStream.prototype.write = function(c) { - this.chunks.push(c); - this.length += c.length; - return true; -}; - -BufferStream.prototype.end = function(c) { - if (c) this.write(c); - // flatten - const buf = Buffer.allocUnsafe(this.length); - let i = 0; - this.chunks.forEach(function(c) { - c.copy(buf, i); - i += c.length; - }); - this.emit('data', buf); - this.emit('end'); - return true; -}; - - -function SlowStream(trickle) { - this.trickle = trickle; - this.offset = 0; - this.readable = this.writable = true; +class SlowStream extends stream.Stream { + constructor(trickle) { + super(); + this.trickle = trickle; + this.offset = 0; + this.readable = this.writable = true; + } + + write() { + throw new Error('not implemented, just call ss.end(chunk)'); + } + + pause() { + this.paused = true; + this.emit('pause'); + } + + resume() { + const emit = () => { + if (this.paused) return; + if (this.offset >= this.length) { + this.ended = true; + return this.emit('end'); + } + const end = Math.min(this.offset + this.trickle, this.length); + const c = this.chunk.slice(this.offset, end); + this.offset += c.length; + this.emit('data', c); + process.nextTick(emit); + }; + + if (this.ended) return; + this.emit('resume'); + if (!this.chunk) return; + this.paused = false; + emit(); + } + + end(chunk) { + // walk over the chunk in blocks. + this.chunk = chunk; + this.length = chunk.length; + this.resume(); + return this.ended; + } } -util.inherits(SlowStream, stream.Stream); - -SlowStream.prototype.write = function() { - throw new Error('not implemented, just call ss.end(chunk)'); -}; - -SlowStream.prototype.pause = function() { - this.paused = true; - this.emit('pause'); -}; - -SlowStream.prototype.resume = function() { - const emit = () => { - if (this.paused) return; - if (this.offset >= this.length) { - this.ended = true; - return this.emit('end'); - } - const end = Math.min(this.offset + this.trickle, this.length); - const c = this.chunk.slice(this.offset, end); - this.offset += c.length; - this.emit('data', c); - process.nextTick(emit); - }; - - if (this.ended) return; - this.emit('resume'); - if (!this.chunk) return; - this.paused = false; - emit(); -}; - -SlowStream.prototype.end = function(chunk) { - // walk over the chunk in blocks. - this.chunk = chunk; - this.length = chunk.length; - this.resume(); - return this.ended; -}; - // for each of the files, make sure that compressing and // decompressing results in the same data, for every combination // of the options set above. -let failures = 0; -let total = 0; -let done = 0; -Object.keys(tests).forEach(function(file) { +const testKeys = Object.keys(tests); +testKeys.forEach(common.mustCall((file) => { const test = tests[file]; - chunkSize.forEach(function(chunkSize) { - trickle.forEach(function(trickle) { - windowBits.forEach(function(windowBits) { - level.forEach(function(level) { - memLevel.forEach(function(memLevel) { - strategy.forEach(function(strategy) { - zlibPairs.forEach(function(pair) { + chunkSize.forEach(common.mustCall((chunkSize) => { + trickle.forEach(common.mustCall((trickle) => { + windowBits.forEach(common.mustCall((windowBits) => { + level.forEach(common.mustCall((level) => { + memLevel.forEach(common.mustCall((memLevel) => { + strategy.forEach(common.mustCall((strategy) => { + zlibPairs.forEach(common.mustCall((pair) => { const Def = pair[0]; const Inf = pair[1]; const opts = { level: level, @@ -154,57 +152,32 @@ memLevel: memLevel, strategy: strategy }; - total++; - const def = new Def(opts); const inf = new Inf(opts); const ss = new SlowStream(trickle); const buf = new BufferStream(); // verify that the same exact buffer comes out the other end. - buf.on('data', function(c) { + buf.on('data', common.mustCall((c) => { const msg = `${file} ${chunkSize} ${ - JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`; - let ok = true; - const testNum = ++done; + JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`; let i; for (i = 0; i < Math.max(c.length, test.length); i++) { if (c[i] !== test[i]) { - ok = false; - failures++; + assert.fail(null, null, msg); break; } } - if (ok) { - console.log(`ok ${testNum} ${msg}`); - } else { - console.log(`not ok ${testNum} msg`); - console.log(' ...'); - console.log(` testfile: ${file}`); - console.log(` type: ${Def.name} -> ${Inf.name}`); - console.log(` position: ${i}`); - console.log(` options: ${JSON.stringify(opts)}`); - console.log(` expect: ${test[i]}`); - console.log(` actual: ${c[i]}`); - console.log(` chunkSize: ${chunkSize}`); - console.log(' ---'); - } - }); + })); // the magic happens here. ss.pipe(def).pipe(inf).pipe(buf); ss.end(test); - }); - }); - }); - }); - }); - }); - }); -}); - -process.on('exit', function(code) { - console.log(`1..${done}`); - assert.strictEqual(done, total, `${total - done} tests left unfinished`); - assert.strictEqual(failures, 0, 'some test failures'); -}); + }, zlibPairs.length)); + }, strategy.length)); + }, memLevel.length)); + }, level.length)); + }, windowBits.length)); + }, trickle.length)); + }, chunkSize.length)); +}, testKeys.length)); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-random-byte-pipes.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-random-byte-pipes.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-random-byte-pipes.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-random-byte-pipes.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,132 +1,124 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); +const assert = require('assert'); +const crypto = require('crypto'); const stream = require('stream'); -const Stream = stream.Stream; -const util = require('util'); const zlib = require('zlib'); +const Stream = stream.Stream; // emit random bytes, and keep a shasum -function RandomReadStream(opt) { - Stream.call(this); +class RandomReadStream extends Stream { + constructor(opt) { + super(); - this.readable = true; - this._paused = false; - this._processing = false; - - this._hasher = crypto.createHash('sha1'); - opt = opt || {}; - - // base block size. - opt.block = opt.block || 256 * 1024; - - // total number of bytes to emit - opt.total = opt.total || 256 * 1024 * 1024; - this._remaining = opt.total; - - // how variable to make the block sizes - opt.jitter = opt.jitter || 1024; + this.readable = true; + this._paused = false; + this._processing = false; - this._opt = opt; + this._hasher = crypto.createHash('sha1'); + opt = opt || {}; - this._process = this._process.bind(this); + // base block size. + opt.block = opt.block || 256 * 1024; - process.nextTick(this._process); -} + // total number of bytes to emit + opt.total = opt.total || 256 * 1024 * 1024; + this._remaining = opt.total; -util.inherits(RandomReadStream, Stream); + // how variable to make the block sizes + opt.jitter = opt.jitter || 1024; -RandomReadStream.prototype.pause = function() { - this._paused = true; - this.emit('pause'); -}; - -RandomReadStream.prototype.resume = function() { - // console.error("rrs resume"); - this._paused = false; - this.emit('resume'); - this._process(); -}; - -RandomReadStream.prototype._process = function() { - if (this._processing) return; - if (this._paused) return; + this._opt = opt; - this._processing = true; + this._process = this._process.bind(this); - if (!this._remaining) { - this._hash = this._hasher.digest('hex').toLowerCase().trim(); - this._processing = false; - - this.emit('end'); - return; + process.nextTick(this._process); } - // figure out how many bytes to output - // if finished, then just emit end. - let block = this._opt.block; - const jitter = this._opt.jitter; - if (jitter) { - block += Math.ceil(Math.random() * jitter - (jitter / 2)); + pause() { + this._paused = true; + this.emit('pause'); } - block = Math.min(block, this._remaining); - const buf = Buffer.allocUnsafe(block); - for (let i = 0; i < block; i++) { - buf[i] = Math.random() * 256; + + resume() { + // console.error("rrs resume"); + this._paused = false; + this.emit('resume'); + this._process(); } - this._hasher.update(buf); + _process() { + if (this._processing) return; + if (this._paused) return; + + this._processing = true; + + if (!this._remaining) { + this._hash = this._hasher.digest('hex').toLowerCase().trim(); + this._processing = false; + + this.emit('end'); + return; + } + + // figure out how many bytes to output + // if finished, then just emit end. + let block = this._opt.block; + const jitter = this._opt.jitter; + if (jitter) { + block += Math.ceil(Math.random() * jitter - (jitter / 2)); + } + block = Math.min(block, this._remaining); + const buf = Buffer.allocUnsafe(block); + for (let i = 0; i < block; i++) { + buf[i] = Math.random() * 256; + } - this._remaining -= block; + this._hasher.update(buf); - console.error('block=%d\nremain=%d\n', block, this._remaining); - this._processing = false; + this._remaining -= block; - this.emit('data', buf); - process.nextTick(this._process); -}; + this._processing = false; + this.emit('data', buf); + process.nextTick(this._process); + } +} // a filter that just verifies a shasum -function HashStream() { - Stream.call(this); +class HashStream extends Stream { + constructor() { + super(); + this.readable = this.writable = true; + this._hasher = crypto.createHash('sha1'); + } - this.readable = this.writable = true; - this._hasher = crypto.createHash('sha1'); -} + write(c) { + // Simulate the way that an fs.ReadStream returns false + // on *every* write, only to resume a moment later. + this._hasher.update(c); + process.nextTick(() => this.resume()); + return false; + } -util.inherits(HashStream, Stream); + resume() { + this.emit('resume'); + process.nextTick(() => this.emit('drain')); + } -HashStream.prototype.write = function(c) { - // Simulate the way that an fs.ReadStream returns false - // on *every* write like a jerk, only to resume a - // moment later. - this._hasher.update(c); - process.nextTick(this.resume.bind(this)); - return false; -}; - -HashStream.prototype.resume = function() { - this.emit('resume'); - process.nextTick(this.emit.bind(this, 'drain')); -}; - -HashStream.prototype.end = function(c) { - if (c) { - this.write(c); - } - this._hash = this._hasher.digest('hex').toLowerCase().trim(); - this.emit('data', this._hash); - this.emit('end'); -}; + end(c) { + if (c) { + this.write(c); + } + this._hash = this._hasher.digest('hex').toLowerCase().trim(); + this.emit('data', this._hash); + this.emit('end'); + } +} const inp = new RandomReadStream({ total: 1024, block: 256, jitter: 16 }); @@ -136,23 +128,6 @@ inp.pipe(gzip).pipe(gunz).pipe(out); -inp.on('data', function(c) { - console.error('inp data', c.length); -}); - -gzip.on('data', function(c) { - console.error('gzip data', c.length); -}); - -gunz.on('data', function(c) { - console.error('gunz data', c.length); -}); - -out.on('data', function(c) { - console.error('out data', c.length); -}); - -out.on('data', common.mustCall(function(c) { - console.error('hash=%s', c); +out.on('data', common.mustCall((c) => { assert.strictEqual(c, inp._hash, 'hashes should match'); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-sync-no-event.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-sync-no-event.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-sync-no-event.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-sync-no-event.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,20 +1,18 @@ 'use strict'; -require('../common'); +const common = require('../common'); const zlib = require('zlib'); const assert = require('assert'); -const shouldNotBeCalled = () => { throw new Error('unexpected event'); }; - const message = 'Come on, Fhqwhgads.'; +const buffer = Buffer.from(message); const zipper = new zlib.Gzip(); -zipper.on('close', shouldNotBeCalled); +zipper.on('close', common.mustNotCall); -const buffer = Buffer.from(message); const zipped = zipper._processChunk(buffer, zlib.Z_FINISH); const unzipper = new zlib.Gunzip(); -unzipper.on('close', shouldNotBeCalled); +unzipper.on('close', common.mustNotCall); const unzipped = unzipper._processChunk(zipped, zlib.Z_FINISH); assert.notStrictEqual(zipped.toString(), message); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-write-after-close.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-write-after-close.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-write-after-close.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-write-after-close.js 2017-10-03 17:11:32.000000000 +0000 @@ -5,6 +5,6 @@ zlib.gzip('hello', common.mustCall(function(err, out) { const unzip = zlib.createGunzip(); - unzip.close(common.mustCall(function() {})); + unzip.close(common.mustCall()); assert.throws(() => unzip.write(out), /^Error: zlib binding closed$/); })); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-write-after-flush.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-write-after-flush.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-write-after-flush.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-write-after-flush.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); @@ -11,23 +11,14 @@ let output = ''; const input = 'A line of data\n'; gunz.setEncoding('utf8'); -gunz.on('data', function(c) { - output += c; -}); - -process.on('exit', function() { +gunz.on('data', (c) => output += c); +gunz.on('end', common.mustCall(() => { assert.strictEqual(output, input); - - // Make sure that the flush flag was set back to normal assert.strictEqual(gzip._flushFlag, zlib.Z_NO_FLUSH); - - console.log('ok'); -}); +})); // make sure that flush/write doesn't trigger an assert failure -gzip.flush(); write(); -function write() { - gzip.write(input); - gzip.end(); - gunz.read(0); -} +gzip.flush(); +gzip.write(input); +gzip.end(); +gunz.read(0); diff -Nru nodejs-6.11.2~dfsg/test/parallel/test-zlib-zero-byte.js nodejs-6.11.4~dfsg/test/parallel/test-zlib-zero-byte.js --- nodejs-6.11.2~dfsg/test/parallel/test-zlib-zero-byte.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/parallel/test-zlib-zero-byte.js 2017-10-03 17:11:32.000000000 +0000 @@ -13,6 +13,6 @@ gz.on('end', common.mustCall(function() { assert.strictEqual(received, 20); })); -gz.on('finish', common.mustCall(function() {})); +gz.on('finish', common.mustCall()); gz.write(emptyBuffer); gz.end(); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-abort-fatal-error.js nodejs-6.11.4~dfsg/test/pummel/test-abort-fatal-error.js --- nodejs-6.11.2~dfsg/test/pummel/test-abort-fatal-error.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-abort-fatal-error.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isWindows) { +if (common.isWindows) common.skip('no RLIMIT_NOFILE on Windows'); - return; -} +const assert = require('assert'); const exec = require('child_process').exec; let cmdline = `ulimit -c 0; ${process.execPath}`; diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-crypto-dh.js nodejs-6.11.4~dfsg/test/pummel/test-crypto-dh.js --- nodejs-6.11.2~dfsg/test/pummel/test-crypto-dh.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-crypto-dh.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('node compiled without OpenSSL.'); + const assert = require('assert'); const crypto = require('crypto'); -if (!common.hasCrypto) { - common.skip('node compiled without OpenSSL.'); - return; -} - assert.throws( function() { crypto.getDiffieHellman('unknown-group'); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-crypto-timing-safe-equal-benchmarks.js nodejs-6.11.4~dfsg/test/pummel/test-crypto-timing-safe-equal-benchmarks.js --- nodejs-6.11.2~dfsg/test/pummel/test-crypto-timing-safe-equal-benchmarks.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-crypto-timing-safe-equal-benchmarks.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,17 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip('memory-intensive test'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); const BENCHMARK_FUNC_PATH = diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-dh-regr.js nodejs-6.11.4~dfsg/test/pummel/test-dh-regr.js --- nodejs-6.11.2~dfsg/test/pummel/test-dh-regr.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-dh-regr.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const p = crypto.createDiffieHellman(1024).getPrime(); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-dtrace-jsstack.js nodejs-6.11.4~dfsg/test/pummel/test-dtrace-jsstack.js --- nodejs-6.11.2~dfsg/test/pummel/test-dtrace-jsstack.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-dtrace-jsstack.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isSunOS) + common.skip('no DTRACE support'); + const assert = require('assert'); const os = require('os'); -if (!common.isSunOS) { - common.skip('no DTRACE support'); - return; -} - /* * Some functions to create a recognizable stack. */ @@ -39,7 +37,7 @@ * deepest function is the only caller of os.loadavg(). */ const dtrace = spawn('dtrace', [ '-qwn', `syscall::getloadavg:entry/pid == ${ - process.pid}/{ustack(100, 8192); exit(0); }` ]); + process.pid}/{ustack(100, 8192); exit(0); }` ]); let output = ''; @@ -65,14 +63,14 @@ for (let i = 0; i < lines.length; i++) { const line = lines[i]; - if (line.indexOf(sentinel) === -1 || frames.length === 0) + if (!line.includes(sentinel) || frames.length === 0) continue; const frame = line.substr(line.indexOf(sentinel) + sentinel.length); const top = frames.shift(); - assert.strictEqual(frame.indexOf(top), 0, - `unexpected frame where ${top} was expected`); + assert(frame.startsWith(top), + `unexpected frame where ${top} was expected`); } assert.strictEqual(frames.length, 0, diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-fs-watch-file.js nodejs-6.11.4~dfsg/test/pummel/test-fs-watch-file.js --- nodejs-6.11.2~dfsg/test/pummel/test-fs-watch-file.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-fs-watch-file.js 2017-10-03 17:11:32.000000000 +0000 @@ -37,21 +37,21 @@ fs.writeFileSync(filepathOne, 'hello'); assert.throws( - function() { - fs.watchFile(filepathOne); - }, - function(e) { - return e.message === '"watchFile()" requires a listener function'; - } + function() { + fs.watchFile(filepathOne); + }, + function(e) { + return e.message === '"watchFile()" requires a listener function'; + } ); assert.doesNotThrow( - function() { - fs.watchFile(filepathOne, function() { - fs.unwatchFile(filepathOne); - ++watchSeenOne; - }); - } + function() { + fs.watchFile(filepathOne, function() { + fs.unwatchFile(filepathOne); + ++watchSeenOne; + }); + } ); setTimeout(function() { @@ -64,27 +64,27 @@ fs.writeFileSync(filepathTwoAbs, 'howdy'); assert.throws( - function() { - fs.watchFile(filepathTwo); - }, - function(e) { - return e.message === '"watchFile()" requires a listener function'; - } + function() { + fs.watchFile(filepathTwo); + }, + function(e) { + return e.message === '"watchFile()" requires a listener function'; + } ); assert.doesNotThrow( - function() { - function a() { - fs.unwatchFile(filepathTwo, a); - ++watchSeenTwo; - } - function b() { - fs.unwatchFile(filepathTwo, b); - ++watchSeenTwo; - } - fs.watchFile(filepathTwo, a); - fs.watchFile(filepathTwo, b); - } + function() { + function a() { + fs.unwatchFile(filepathTwo, a); + ++watchSeenTwo; + } + function b() { + fs.unwatchFile(filepathTwo, b); + ++watchSeenTwo; + } + fs.watchFile(filepathTwo, a); + fs.watchFile(filepathTwo, b); + } ); setTimeout(function() { @@ -92,18 +92,15 @@ }, 1000); assert.doesNotThrow( - function() { - function a() { - assert.ok(0); // should not run - } - function b() { - fs.unwatchFile(filenameThree, b); - ++watchSeenThree; - } - fs.watchFile(filenameThree, a); - fs.watchFile(filenameThree, b); - fs.unwatchFile(filenameThree, a); - } + function() { + function b() { + fs.unwatchFile(filenameThree, b); + ++watchSeenThree; + } + fs.watchFile(filenameThree, common.mustNotCall()); + fs.watchFile(filenameThree, b); + fs.unwatchFile(filenameThree, common.mustNotCall()); + } ); setTimeout(function() { @@ -119,12 +116,12 @@ }, 500); assert.doesNotThrow( - function() { - function a() { - ++watchSeenFour; - assert.strictEqual(1, watchSeenFour); - fs.unwatchFile(`.${path.sep}${filenameFour}`, a); - } - fs.watchFile(filenameFour, a); + function() { + function a() { + ++watchSeenFour; + assert.strictEqual(1, watchSeenFour); + fs.unwatchFile(`.${path.sep}${filenameFour}`, a); } + fs.watchFile(filenameFour, a); + } ); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-hash-seed.js nodejs-6.11.4~dfsg/test/pummel/test-hash-seed.js --- nodejs-6.11.2~dfsg/test/pummel/test-hash-seed.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-hash-seed.js 2017-10-03 17:11:32.000000000 +0000 @@ -11,7 +11,7 @@ for (let i = 0; i < REPETITIONS; ++i) { const seed = cp.spawnSync(process.execPath, [targetScript], - { encoding: 'utf8' }).stdout.trim(); + { encoding: 'utf8' }).stdout.trim(); seeds.push(seed); } diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-http-client-reconnect-bug.js nodejs-6.11.4~dfsg/test/pummel/test-http-client-reconnect-bug.js --- nodejs-6.11.2~dfsg/test/pummel/test-http-client-reconnect-bug.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-http-client-reconnect-bug.js 2017-10-03 17:11:32.000000000 +0000 @@ -11,7 +11,7 @@ const client = http.createClient(common.PORT); client.on('error', common.mustCall(function(err) {})); - client.on('end', common.mustCall(function() {})); + client.on('end', common.mustCall()); const request = client.request('GET', '/', {'host': 'localhost'}); request.end(); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-https-ci-reneg-attack.js nodejs-6.11.4~dfsg/test/pummel/test-https-ci-reneg-attack.js --- nodejs-6.11.2~dfsg/test/pummel/test-https-ci-reneg-attack.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-https-ci-reneg-attack.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,22 +1,17 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const tls = require('tls'); const https = require('https'); - const fs = require('fs'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - // renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-https-large-response.js nodejs-6.11.4~dfsg/test/pummel/test-https-large-response.js --- nodejs-6.11.2~dfsg/test/pummel/test-https-large-response.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-https-large-response.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-https-no-reader.js nodejs-6.11.4~dfsg/test/pummel/test-https-no-reader.js --- nodejs-6.11.2~dfsg/test/pummel/test-https-no-reader.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-https-no-reader.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); -const Buffer = require('buffer').Buffer; +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-keep-alive.js nodejs-6.11.4~dfsg/test/pummel/test-keep-alive.js --- nodejs-6.11.2~dfsg/test/pummel/test-keep-alive.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-keep-alive.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,16 +2,14 @@ // This test requires the program 'wrk' const common = require('../common'); +if (common.isWindows) + common.skip('no `wrk` on windows'); + const assert = require('assert'); const spawn = require('child_process').spawn; const http = require('http'); const url = require('url'); -if (common.isWindows) { - common.skip('no `wrk` on windows'); - return; -} - const body = 'hello world\n'; const server = http.createServer(function(req, res) { res.writeHead(200, { @@ -58,10 +56,10 @@ return; } - let matches = /Requests\/sec:\s*(\d+)\./mi.exec(stdout); + let matches = /Requests\/sec:\s*(\d+)\./i.exec(stdout); const reqSec = parseInt(matches[1]); - matches = /Keep-Alive requests:\s*(\d+)/mi.exec(stdout); + matches = /Keep-Alive requests:\s*(\d+)/i.exec(stdout); let keepAliveRequests; if (matches) { keepAliveRequests = parseInt(matches[1]); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-net-connect-memleak.js nodejs-6.11.4~dfsg/test/pummel/test-net-connect-memleak.js --- nodejs-6.11.2~dfsg/test/pummel/test-net-connect-memleak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-net-connect-memleak.js 2017-10-03 17:11:32.000000000 +0000 @@ -10,7 +10,7 @@ 'function', 'Run this test with --expose-gc' ); -net.createServer(function() {}).listen(common.PORT); +net.createServer(() => {}).listen(common.PORT); let before = 0; { diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-process-cpuUsage.js nodejs-6.11.4~dfsg/test/pummel/test-process-cpuUsage.js --- nodejs-6.11.2~dfsg/test/pummel/test-process-cpuUsage.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-process-cpuUsage.js 2017-10-03 17:11:32.000000000 +0000 @@ -17,14 +17,14 @@ // Get a diff reading from when we started. const diff = process.cpuUsage(start); -const MICROSECONDS_PER_SECOND = 1000 * 1000; +const MICROSECONDS_PER_MILLISECOND = 1000; // Diff usages should be >= 0, <= ~RUN_FOR_MS millis. // Let's be generous with the slop factor, defined above, in case other things // are happening on this CPU. The <= check may be invalid if the node process // is making use of multiple CPUs, in which case, just remove it. assert(diff.user >= 0); -assert(diff.user <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_SECOND); +assert(diff.user <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_MILLISECOND); assert(diff.system >= 0); -assert(diff.system <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_SECOND); +assert(diff.system <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_MILLISECOND); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-814_2.js nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-814_2.js --- nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-814_2.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-814_2.js 2017-10-03 17:11:32.000000000 +0000 @@ -13,7 +13,7 @@ tailProc.stdout.on('data', tailCB); function tailCB(data) { - PASS = data.toString().indexOf('.') < 0; + PASS = !data.toString().includes('.'); if (PASS) { //console.error('i'); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-814.js nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-814.js --- nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-814.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-814.js 2017-10-03 17:11:32.000000000 +0000 @@ -29,7 +29,7 @@ tail.stdout.on('data', tailCB); function tailCB(data) { - PASS = data.toString().indexOf('.') < 0; + PASS = !data.toString().includes('.'); } diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-892.js nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-892.js --- nodejs-6.11.2~dfsg/test/pummel/test-regress-GH-892.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-regress-GH-892.js 2017-10-03 17:11:32.000000000 +0000 @@ -6,15 +6,12 @@ // TLS server causes the child process to exit cleanly before having sent // the entire buffer. const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const bytesExpected = 1024 * 1024 * 32; diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-stream2-basic.js nodejs-6.11.4~dfsg/test/pummel/test-stream2-basic.js --- nodejs-6.11.2~dfsg/test/pummel/test-stream2-basic.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-stream2-basic.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,458 +0,0 @@ -'use strict'; -require('../common'); -const R = require('_stream_readable'); -const assert = require('assert'); - -const util = require('util'); -const EE = require('events').EventEmitter; - -function TestReader(n) { - R.apply(this); - this._buffer = Buffer.alloc(n || 100, 'x'); - this._pos = 0; - this._bufs = 10; -} - -util.inherits(TestReader, R); - -TestReader.prototype._read = function(n) { - const max = this._buffer.length - this._pos; - n = Math.max(n, 0); - const toRead = Math.min(n, max); - if (toRead === 0) { - // simulate the read buffer filling up with some more bytes some time - // in the future. - setTimeout(function() { - this._pos = 0; - this._bufs -= 1; - if (this._bufs <= 0) { - // read them all! - if (!this.ended) - this.push(null); - } else { - // now we have more. - // kinda cheating by calling _read, but whatever, - // it's just fake anyway. - this._read(n); - } - }.bind(this), 10); - return; - } - - const ret = this._buffer.slice(this._pos, this._pos + toRead); - this._pos += toRead; - this.push(ret); -}; - -///// - -function TestWriter() { - EE.apply(this); - this.received = []; - this.flush = false; -} - -util.inherits(TestWriter, EE); - -TestWriter.prototype.write = function(c) { - this.received.push(c.toString()); - this.emit('write', c); - return true; -}; - -TestWriter.prototype.end = function(c) { - if (c) this.write(c); - this.emit('end', this.received); -}; - -//////// - -// tiny node-tap lookalike. -const tests = []; -let count = 0; - -function test(name, fn) { - count++; - tests.push([name, fn]); -} - -function run() { - const next = tests.shift(); - if (!next) - return console.error('ok'); - - const name = next[0]; - const fn = next[1]; - console.log('# %s', name); - fn({ - same: assert.deepStrictEqual, - ok: assert, - equal: assert.strictEqual, - end: function() { - count--; - run(); - } - }); -} - -// ensure all tests have run -process.on('exit', function() { - assert.strictEqual(count, 0); -}); - -process.nextTick(run); - - -test('a most basic test', function(t) { - const r = new TestReader(20); - - const reads = []; - const expect = [ 'x', - 'xx', - 'xxx', - 'xxxx', - 'xxxxx', - 'xxxxxxxxx', - 'xxxxxxxxxx', - 'xxxxxxxxxxxx', - 'xxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxxxxxxxxxx', - 'xxxxxxxxxxxxxxxxxxxxx' ]; - - r.on('end', function() { - t.same(reads, expect); - t.end(); - }); - - let readSize = 1; - function flow() { - let res; - while (null !== (res = r.read(readSize++))) { - reads.push(res.toString()); - } - r.once('readable', flow); - } - - flow(); -}); - -test('pipe', function(t) { - const r = new TestReader(5); - - const expect = [ 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx' ]; - - const w = new TestWriter(); - - w.on('end', function(received) { - t.same(received, expect); - t.end(); - }); - - r.pipe(w); -}); - - -[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { - test('unpipe', function(t) { - const r = new TestReader(5); - - // unpipe after 3 writes, then write to another stream instead. - let expect = [ 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx' ]; - expect = [ expect.slice(0, SPLIT), expect.slice(SPLIT) ]; - - const w = [ new TestWriter(), new TestWriter() ]; - - let writes = SPLIT; - w[0].on('write', function() { - if (--writes === 0) { - r.unpipe(); - t.equal(r._readableState.pipes, null); - w[0].end(); - r.pipe(w[1]); - t.equal(r._readableState.pipes, w[1]); - } - }); - - let ended = 0; - - let ended0 = false; - let ended1 = false; - w[0].on('end', function(results) { - t.equal(ended0, false); - ended0 = true; - ended++; - t.same(results, expect[0]); - }); - - w[1].on('end', function(results) { - t.equal(ended1, false); - ended1 = true; - ended++; - t.equal(ended, 2); - t.same(results, expect[1]); - t.end(); - }); - - r.pipe(w[0]); - }); -}); - - -// both writers should get the same exact data. -test('multipipe', function(t) { - const r = new TestReader(5); - const w = [ new TestWriter(), new TestWriter() ]; - - const expect = [ 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx' ]; - - let c = 2; - w[0].on('end', function(received) { - t.same(received, expect, 'first'); - if (--c === 0) t.end(); - }); - w[1].on('end', function(received) { - t.same(received, expect, 'second'); - if (--c === 0) t.end(); - }); - - r.pipe(w[0]); - r.pipe(w[1]); -}); - - -[1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function(SPLIT) { - test('multi-unpipe', function(t) { - const r = new TestReader(5); - - // unpipe after 3 writes, then write to another stream instead. - let expect = [ 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx', - 'xxxxx' ]; - expect = [ expect.slice(0, SPLIT), expect.slice(SPLIT) ]; - - const w = [ new TestWriter(), new TestWriter(), new TestWriter() ]; - - let writes = SPLIT; - w[0].on('write', function() { - if (--writes === 0) { - r.unpipe(); - w[0].end(); - r.pipe(w[1]); - } - }); - - let ended = 0; - - w[0].on('end', function(results) { - ended++; - t.same(results, expect[0]); - }); - - w[1].on('end', function(results) { - ended++; - t.equal(ended, 2); - t.same(results, expect[1]); - t.end(); - }); - - r.pipe(w[0]); - r.pipe(w[2]); - }); -}); - -test('back pressure respected', function(t) { - function noop() {} - - const r = new R({ objectMode: true }); - r._read = noop; - let counter = 0; - r.push(['one']); - r.push(['two']); - r.push(['three']); - r.push(['four']); - r.push(null); - - const w1 = new R(); - w1.write = function(chunk) { - console.error('w1.emit("close")'); - assert.strictEqual(chunk[0], 'one'); - w1.emit('close'); - process.nextTick(function() { - r.pipe(w2); - r.pipe(w3); - }); - }; - w1.end = noop; - - r.pipe(w1); - - const expected = ['two', 'two', 'three', 'three', 'four', 'four']; - - let w2 = new R(); - w2.write = function(chunk) { - console.error('w2 write', chunk, counter); - assert.strictEqual(chunk[0], expected.shift()); - assert.strictEqual(counter, 0); - - counter++; - - if (chunk[0] === 'four') { - return true; - } - - setTimeout(function() { - counter--; - console.error('w2 drain'); - w2.emit('drain'); - }, 10); - - return false; - }; - w2.end = noop; - - let w3 = new R(); - w3.write = function(chunk) { - console.error('w3 write', chunk, counter); - assert.strictEqual(chunk[0], expected.shift()); - assert.strictEqual(counter, 1); - - counter++; - - if (chunk[0] === 'four') { - return true; - } - - setTimeout(function() { - counter--; - console.error('w3 drain'); - w3.emit('drain'); - }, 50); - - return false; - }; - w3.end = function() { - assert.strictEqual(counter, 2); - assert.strictEqual(expected.length, 0); - t.end(); - }; -}); - -test('read(0) for ended streams', function(t) { - const r = new R(); - let written = false; - let ended = false; - r._read = function(n) {}; - - r.push(Buffer.from('foo')); - r.push(null); - - const v = r.read(0); - - assert.strictEqual(v, null); - - const w = new R(); - - w.write = function(buffer) { - written = true; - assert.strictEqual(ended, false); - assert.strictEqual(buffer.toString(), 'foo'); - }; - - w.end = function() { - ended = true; - assert.strictEqual(written, true); - t.end(); - }; - - r.pipe(w); -}); - -test('sync _read ending', function(t) { - const r = new R(); - let called = false; - r._read = function(n) { - r.push(null); - }; - - r.once('end', function() { - called = true; - }); - - r.read(); - - process.nextTick(function() { - assert.strictEqual(called, true); - t.end(); - }); -}); - -test('adding readable triggers data flow', function(t) { - const r = new R({ highWaterMark: 5 }); - let onReadable = false; - let readCalled = 0; - - r._read = function(n) { - if (readCalled++ === 2) - r.push(null); - else - r.push(Buffer.from('asdf')); - }; - - r.on('readable', function() { - onReadable = true; - r.read(); - }); - - r.on('end', function() { - t.equal(readCalled, 3); - t.ok(onReadable); - t.end(); - }); -}); - -test('chainable', function(t) { - const r = new R(); - r._read = function() {}; - const r2 = r.setEncoding('utf8').pause().resume().pause(); - t.equal(r, r2); - t.end(); -}); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-ci-reneg-attack.js nodejs-6.11.4~dfsg/test/pummel/test-tls-ci-reneg-attack.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-ci-reneg-attack.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-ci-reneg-attack.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,21 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const tls = require('tls'); - const fs = require('fs'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - // renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-connect-memleak.js nodejs-6.11.4~dfsg/test/pummel/test-tls-connect-memleak.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-connect-memleak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-connect-memleak.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,14 +2,11 @@ // Flags: --expose-gc const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); assert.strictEqual( diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-securepair-client.js nodejs-6.11.4~dfsg/test/pummel/test-tls-securepair-client.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-securepair-client.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-securepair-client.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,17 +1,12 @@ 'use strict'; -// const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const join = require('path').join; const net = require('net'); @@ -63,7 +58,7 @@ console.error(state); switch (state) { case 'WAIT-ACCEPT': - if (/ACCEPT/g.test(serverStdoutBuffer)) { + if (/ACCEPT/.test(serverStdoutBuffer)) { // Give s_server half a second to start up. setTimeout(startClient, 500); state = 'WAIT-HELLO'; @@ -71,7 +66,7 @@ break; case 'WAIT-HELLO': - if (/hello/g.test(serverStdoutBuffer)) { + if (/hello/.test(serverStdoutBuffer)) { // End the current SSL connection and exit. // See s_server(1ssl). diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-server-large-request.js nodejs-6.11.4~dfsg/test/pummel/test-tls-server-large-request.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-server-large-request.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-server-large-request.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const stream = require('stream'); const util = require('util'); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-session-timeout.js nodejs-6.11.4~dfsg/test/pummel/test-tls-session-timeout.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-session-timeout.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-session-timeout.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} doTest(); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-tls-throttle.js nodejs-6.11.4~dfsg/test/pummel/test-tls-throttle.js --- nodejs-6.11.2~dfsg/test/pummel/test-tls-throttle.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-tls-throttle.js 2017-10-03 17:11:32.000000000 +0000 @@ -3,12 +3,10 @@ // seconds. Makes sure that pause and resume work properly. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/pummel/test-vm-memleak.js nodejs-6.11.4~dfsg/test/pummel/test-vm-memleak.js --- nodejs-6.11.2~dfsg/test/pummel/test-vm-memleak.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/pummel/test-vm-memleak.js 2017-10-03 17:11:32.000000000 +0000 @@ -3,6 +3,7 @@ require('../common'); const assert = require('assert'); +const vm = require('vm'); const start = Date.now(); let maxMem = 0; @@ -14,7 +15,7 @@ const interval = setInterval(function() { try { - require('vm').runInNewContext('throw 1;'); + vm.runInNewContext('throw 1;'); } catch (e) { } @@ -31,7 +32,7 @@ function testContextLeak() { for (let i = 0; i < 1000; i++) - require('vm').createContext({}); + vm.createContext({}); } process.on('exit', function() { diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-buffer-creation-regression.js nodejs-6.11.4~dfsg/test/sequential/test-buffer-creation-regression.js --- nodejs-6.11.2~dfsg/test/sequential/test-buffer-creation-regression.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-buffer-creation-regression.js 2017-10-03 17:11:32.000000000 +0000 @@ -29,7 +29,8 @@ arrayBuffer = new ArrayBuffer(size); } catch (e) { if (e instanceof RangeError && acceptableOOMErrors.includes(e.message)) - return common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`); + common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`); + throw e; } diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-child-process-emfile.js nodejs-6.11.4~dfsg/test/sequential/test-child-process-emfile.js --- nodejs-6.11.2~dfsg/test/sequential/test-child-process-emfile.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-child-process-emfile.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('no RLIMIT_NOFILE on Windows'); + const assert = require('assert'); const child_process = require('child_process'); const fs = require('fs'); -if (common.isWindows) { - common.skip('no RLIMIT_NOFILE on Windows'); - return; -} - const ulimit = Number(child_process.execSync('ulimit -Hn')); if (ulimit > 64 || Number.isNaN(ulimit)) { // Sorry about this nonsense. It can be replaced if diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-child-process-execsync.js nodejs-6.11.4~dfsg/test/sequential/test-child-process-execsync.js --- nodejs-6.11.2~dfsg/test/sequential/test-child-process-execsync.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-child-process-execsync.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,8 +2,7 @@ const common = require('../common'); const assert = require('assert'); -const execSync = require('child_process').execSync; -const execFileSync = require('child_process').execFileSync; +const { execFileSync, execSync } = require('child_process'); const TIMER = 200; const SLEEP = 2000; diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-child-process-pass-fd.js nodejs-6.11.4~dfsg/test/sequential/test-child-process-pass-fd.js --- nodejs-6.11.2~dfsg/test/sequential/test-child-process-pass-fd.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-child-process-pass-fd.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) + common.skip('Too slow for armv6 and armv7 bots'); + const assert = require('assert'); const fork = require('child_process').fork; const net = require('net'); -if ((process.config.variables.arm_version === '6') || - (process.config.variables.arm_version === '7')) { - common.skip('Too slow for armv6 and armv7 bots'); - return; -} - const N = 80; if (process.argv[2] !== 'child') { @@ -45,7 +43,7 @@ // the only thing keeping this worker alive will be IPC. This is important, // because it means a worker with no parent will have no referenced handles, // thus no work to do, and will exit immediately, preventing process leaks. - process.on('message', function() {}); + process.on('message', common.mustCall()); const server = net.createServer((c) => { process.once('message', function(msg) { diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-crypto-timing-safe-equal.js nodejs-6.11.4~dfsg/test/sequential/test-crypto-timing-safe-equal.js --- nodejs-6.11.2~dfsg/test/sequential/test-crypto-timing-safe-equal.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-crypto-timing-safe-equal.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); assert.strictEqual( diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-dgram-bind-shared-ports.js nodejs-6.11.4~dfsg/test/sequential/test-dgram-bind-shared-ports.js --- nodejs-6.11.2~dfsg/test/sequential/test-dgram-bind-shared-ports.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-dgram-bind-shared-ports.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,56 +1,92 @@ 'use strict'; const common = require('../common'); + +// This test asserts the semantics of dgram::socket.bind({ exclusive }) +// when called from a cluster.Worker + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); - -function noop() { } +const BYE = 'bye'; +const WORKER2_NAME = 'wrker2'; if (cluster.isMaster) { const worker1 = cluster.fork(); if (common.isWindows) { - const checkErrType = (er) => { - assert.strictEqual(er.code, 'ENOTSUP'); + worker1.on('error', common.mustCall((err) => { + console.log(err); + assert.strictEqual(err.code, 'ENOTSUP'); worker1.kill(); - }; - - worker1.on('error', common.mustCall(checkErrType, 1)); + })); return; } - worker1.on('message', (msg) => { + worker1.on('message', common.mustCall((msg) => { + console.log(msg); assert.strictEqual(msg, 'success'); - const worker2 = cluster.fork(); - worker2.on('message', (msg) => { - assert.strictEqual(msg, 'socket2:EADDRINUSE'); - worker1.kill(); - worker2.kill(); - }); - }); + const worker2 = cluster.fork({ WORKER2_NAME }); + worker2.on('message', common.mustCall((msg) => { + console.log(msg); + assert.strictEqual(msg, 'socket3:EADDRINUSE'); + + // finish test + worker1.send(BYE); + worker2.send(BYE); + })); + worker2.on('exit', common.mustCall((code, signal) => { + assert.strictEqual(signal, null); + assert.strictEqual(code, 0); + })); + })); + worker1.on('exit', common.mustCall((code, signal) => { + assert.strictEqual(signal, null); + assert.strictEqual(code, 0); + })); + // end master code } else { - const socket1 = dgram.createSocket('udp4', noop); - const socket2 = dgram.createSocket('udp4', noop); - - socket1.on('error', (err) => { - // no errors expected - process.send(`socket1:${err.code}`); - }); - - socket2.on('error', (err) => { - // an error is expected on the second worker - process.send(`socket2:${err.code}`); - }); - - socket1.bind({ - address: 'localhost', - port: common.PORT, - exclusive: false - }, () => { - socket2.bind({ port: common.PORT + 1, exclusive: true }, () => { - // the first worker should succeed - process.send('success'); - }); - }); + // worker code + process.on('message', common.mustCallAtLeast((msg) => { + if (msg === BYE) process.exit(0); + }), 1); + + const isSecondWorker = process.env.WORKER2_NAME === WORKER2_NAME; + const socket1 = dgram.createSocket('udp4', common.mustNotCall()); + const socket2 = dgram.createSocket('udp4', common.mustNotCall()); + const socket3 = dgram.createSocket('udp4', common.mustNotCall()); + + socket1.on('error', (err) => assert.fail(undefined, undefined, err)); + socket2.on('error', (err) => assert.fail(undefined, undefined, err)); + + // First worker should bind, second should err + const socket3OnBind = + isSecondWorker ? + common.mustNotCall() : + common.mustCall(() => { + const port3 = socket3.address().port; + assert.strictEqual(typeof port3, 'number'); + process.send('success'); + }); + // an error is expected only in the second worker + const socket3OnError = + !isSecondWorker ? + common.mustNotCall() : + common.mustCall((err) => { + process.send(`socket3:${err.code}`); + }); + const address = common.localhostIPv4; + const opt1 = { address, port: 0, exclusive: false }; + const opt2 = { address, port: common.PORT, exclusive: false }; + const opt3 = { address, port: common.PORT + 1, exclusive: true }; + socket1.bind(opt1, common.mustCall(() => { + const port1 = socket1.address().port; + assert.strictEqual(typeof port1, 'number'); + socket2.bind(opt2, common.mustCall(() => { + const port2 = socket2.address().port; + assert.strictEqual(typeof port2, 'number'); + socket3.on('error', socket3OnError); + socket3.bind(opt3, socket3OnBind); + })); + })); } diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-domain-abort-on-uncaught.js nodejs-6.11.4~dfsg/test/sequential/test-domain-abort-on-uncaught.js --- nodejs-6.11.2~dfsg/test/sequential/test-domain-abort-on-uncaught.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-domain-abort-on-uncaught.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -'use strict'; - -// This test makes sure that when using --abort-on-uncaught-exception and -// when throwing an error from within a domain that has an error handler -// setup, the process _does not_ abort. - -const common = require('../common'); -const assert = require('assert'); -const domain = require('domain'); -const child_process = require('child_process'); - -let errorHandlerCalled = false; - -const tests = [ - function nextTick() { - const d = domain.create(); - - d.once('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - process.nextTick(function() { - throw new Error('exceptional!'); - }); - }); - }, - - function timer() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - setTimeout(function() { - throw new Error('exceptional!'); - }, 33); - }); - }, - - function immediate() { - const d = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - setImmediate(function() { - throw new Error('boom!'); - }); - }); - }, - - function timerPlusNextTick() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - setTimeout(function() { - process.nextTick(function() { - throw new Error('exceptional!'); - }); - }, 33); - }); - }, - - function firstRun() { - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - throw new Error('exceptional!'); - }); - }, - - function fsAsync() { - const d = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - const fs = require('fs'); - fs.exists('/non/existing/file', function onExists(exists) { - throw new Error('boom!'); - }); - }); - }, - - function netServer() { - const net = require('net'); - const d = domain.create(); - - d.on('error', function(err) { - errorHandlerCalled = true; - }); - - d.run(function() { - const server = net.createServer(function(conn) { - conn.pipe(conn); - }); - server.listen(0, common.localhostIPv4, function() { - const conn = net.connect(this.address().port, common.localhostIPv4); - conn.once('data', function() { - throw new Error('ok'); - }); - conn.end('ok'); - server.close(); - }); - }); - }, - - function firstRunOnlyTopLevelErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - throw new Error('boom!'); - }); - }); - }, - - function firstRunNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - throw new Error('boom!'); - }); - }); - }, - - function timeoutNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - setTimeout(function() { - console.log('foo'); - throw new Error('boom!'); - }, 33); - }); - }); - }, - - function setImmediateNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - setImmediate(function() { - throw new Error('boom!'); - }); - }); - }); - }, - - function nextTickNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - process.nextTick(function() { - throw new Error('boom!'); - }); - }); - }); - }, - - function fsAsyncNestedWithErrorHandler() { - const d = domain.create(); - const d2 = domain.create(); - - d2.on('error', function errorHandler() { - errorHandlerCalled = true; - }); - - d.run(function() { - d2.run(function() { - const fs = require('fs'); - fs.exists('/non/existing/file', function onExists(exists) { - throw new Error('boom!'); - }); - }); - }); - } -]; - -if (process.argv[2] === 'child') { - const testIndex = +process.argv[3]; - - tests[testIndex](); - - process.on('exit', function onExit() { - assert.strictEqual(errorHandlerCalled, true); - }); -} else { - - tests.forEach(function(test, testIndex) { - let testCmd = ''; - if (!common.isWindows) { - // Do not create core files, as it can take a lot of disk space on - // continuous testing and developers' machines - testCmd += 'ulimit -c 0 && '; - } - - testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception ` + - `"${process.argv[1]}" child ${testIndex}`; - - const child = child_process.exec(testCmd); - - child.on('exit', function onExit(code, signal) { - assert.strictEqual( - code, 0, `Test at index ${testIndex - } should have exited with exit code 0 but instead exited with code ${ - code} and signal ${signal}`); - }); - }); -} diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-fs-readfile-tostring-fail.js nodejs-6.11.4~dfsg/test/sequential/test-fs-readfile-tostring-fail.js --- nodejs-6.11.2~dfsg/test/sequential/test-fs-readfile-tostring-fail.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-fs-readfile-tostring-fail.js 2017-10-03 17:11:32.000000000 +0000 @@ -2,11 +2,8 @@ const common = require('../common'); -if (!common.enoughTestMem) { - const skipMessage = 'intensive toString tests due to memory confinements'; - common.skip(skipMessage); - return; -} +if (!common.enoughTestMem) + common.skip('intensive toString tests due to memory confinements'); const assert = require('assert'); const fs = require('fs'); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-fs-watch.js nodejs-6.11.4~dfsg/test/sequential/test-fs-watch.js --- nodejs-6.11.2~dfsg/test/sequential/test-fs-watch.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-fs-watch.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,3 +1,24 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + 'use strict'; const common = require('../common'); const assert = require('assert'); @@ -33,18 +54,18 @@ fs.writeFileSync(filepathOne, 'hello'); assert.doesNotThrow( - function() { - const watcher = fs.watch(filepathOne); - watcher.on('change', function(event, filename) { - assert.strictEqual(event, 'change'); - - if (expectFilePath) { - assert.strictEqual(filename, 'watch.txt'); - } - watcher.close(); - ++watchSeenOne; - }); - } + function() { + const watcher = fs.watch(filepathOne); + watcher.on('change', function(event, filename) { + assert.strictEqual(event, 'change'); + + if (expectFilePath) { + assert.strictEqual(filename, 'watch.txt'); + } + watcher.close(); + ++watchSeenOne; + }); + } ); setImmediate(function() { @@ -57,17 +78,17 @@ fs.writeFileSync(filepathTwoAbs, 'howdy'); assert.doesNotThrow( - function() { - const watcher = fs.watch(filepathTwo, function(event, filename) { - assert.strictEqual(event, 'change'); - - if (expectFilePath) { - assert.strictEqual(filename, 'hasOwnProperty'); - } - watcher.close(); - ++watchSeenTwo; - }); - } + function() { + const watcher = fs.watch(filepathTwo, function(event, filename) { + assert.strictEqual(event, 'change'); + + if (expectFilePath) { + assert.strictEqual(filename, 'hasOwnProperty'); + } + watcher.close(); + ++watchSeenTwo; + }); + } ); setImmediate(function() { @@ -79,19 +100,19 @@ const filepathThree = path.join(testsubdir, filenameThree); assert.doesNotThrow( - function() { - const watcher = fs.watch(testsubdir, function(event, filename) { - const renameEv = common.isSunOS || common.isAix ? 'change' : 'rename'; - assert.strictEqual(event, renameEv); - if (expectFilePath) { - assert.strictEqual(filename, 'newfile.txt'); - } else { - assert.strictEqual(filename, null); - } - watcher.close(); - ++watchSeenThree; - }); - } + function() { + const watcher = fs.watch(testsubdir, function(event, filename) { + const renameEv = common.isSunOS || common.isAix ? 'change' : 'rename'; + assert.strictEqual(event, renameEv); + if (expectFilePath) { + assert.strictEqual(filename, 'newfile.txt'); + } else { + assert.strictEqual(filename, null); + } + watcher.close(); + ++watchSeenThree; + }); + } ); setImmediate(function() { @@ -109,7 +130,7 @@ // https://github.com/joyent/node/issues/6690 let oldhandle; assert.throws(function() { - const w = fs.watch(__filename, function(event, filename) { }); + const w = fs.watch(__filename, common.mustNotCall()); oldhandle = w._handle; w._handle = { close: w._handle.close }; w.close(); @@ -117,7 +138,7 @@ oldhandle.close(); // clean up assert.throws(function() { - const w = fs.watchFile(__filename, {persistent: false}, function() {}); + const w = fs.watchFile(__filename, {persistent: false}, common.mustNotCall()); oldhandle = w._handle; w._handle = { stop: w._handle.stop }; w.stop(); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-https-set-timeout-server.js nodejs-6.11.4~dfsg/test/sequential/test-https-set-timeout-server.js --- nodejs-6.11.2~dfsg/test/sequential/test-https-set-timeout-server.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-https-set-timeout-server.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const https = require('https'); - -const tls = require('tls'); -const fs = require('fs'); - -const tests = []; - -const serverOptions = { - key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) -}; - -function test(fn) { - if (!tests.length) - process.nextTick(run); - tests.push(fn); -} - -function run() { - const fn = tests.shift(); - if (fn) { - console.log('# %s', fn.name); - fn(run); - } else { - console.log('ok'); - } -} - -test(function serverTimeout(cb) { - const server = https.createServer(serverOptions, function(req, res) { - // just do nothing, we should get a timeout event. - }); - server.listen(0, common.mustCall(function() { - const s = server.setTimeout(50, common.mustCall(function(socket) { - socket.destroy(); - server.close(); - cb(); - })); - assert.ok(s instanceof https.Server); - https.get({ - port: this.address().port, - rejectUnauthorized: false - }).on('error', function() {}); - })); -}); - -test(function serverRequestTimeout(cb) { - function handler(req, res) { - // just do nothing, we should get a timeout event. - req.setTimeout(50, common.mustCall(function() { - req.socket.destroy(); - server.close(); - cb(); - })); - } - - let server = https.createServer(serverOptions, common.mustCall(handler)); - server.listen(0, function() { - const req = https.request({ - port: this.address().port, - method: 'POST', - rejectUnauthorized: false - }); - req.on('error', function() {}); - req.write('Hello'); - // req is in progress - }); -}); - -test(function serverResponseTimeout(cb) { - function handler(req, res) { - // just do nothing, we should get a timeout event. - res.setTimeout(50, common.mustCall(function() { - res.socket.destroy(); - server.close(); - cb(); - })); - } - - let server = https.createServer(serverOptions, common.mustCall(handler)); - server.listen(0, function() { - https.get({ - port: this.address().port, - rejectUnauthorized: false - }).on('error', function() {}); - }); -}); - -test(function serverRequestNotTimeoutAfterEnd(cb) { - function handler(req, res) { - // just do nothing, we should get a timeout event. - req.setTimeout(50, common.mustNotCall()); - res.on('timeout', common.mustCall(function(socket) {})); - } - const server = https.createServer(serverOptions, common.mustCall(handler)); - server.on('timeout', function(socket) { - socket.destroy(); - server.close(); - cb(); - }); - server.listen(0, function() { - https.get({ - port: this.address().port, - rejectUnauthorized: false - }).on('error', function() {}); - }); -}); - -test(function serverResponseTimeoutWithPipeline(cb) { - let caughtTimeout = ''; - process.on('exit', function() { - assert.strictEqual(caughtTimeout, '/2'); - }); - const server = https.createServer(serverOptions, function(req, res) { - res.setTimeout(50, function() { - caughtTimeout += req.url; - }); - if (req.url === '/1') res.end(); - }); - server.on('timeout', function(socket) { - socket.destroy(); - server.close(); - cb(); - }); - server.listen(0, function() { - const options = { - port: this.address().port, - allowHalfOpen: true, - rejectUnauthorized: false - }; - const c = tls.connect(options, function() { - c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); - c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); - c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); - }); - }); -}); - -test(function idleTimeout(cb) { - const server = https.createServer(serverOptions, - common.mustCall(function(req, res) { - req.on('timeout', common.mustNotCall()); - res.on('timeout', common.mustNotCall()); - res.end(); - })); - server.setTimeout(50, common.mustCall(function(socket) { - socket.destroy(); - server.close(); - cb(); - })); - server.listen(0, function() { - const options = { - port: this.address().port, - allowHalfOpen: true, - rejectUnauthorized: false - }; - tls.connect(options, function() { - this.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); - // Keep-Alive - }); - }); -}); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-module-loading.js nodejs-6.11.4~dfsg/test/sequential/test-module-loading.js --- nodejs-6.11.2~dfsg/test/sequential/test-module-loading.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-module-loading.js 2017-10-03 17:11:32.000000000 +0000 @@ -110,7 +110,7 @@ assert.strictEqual('blah', e.message); } -assert.strictEqual(require('path').dirname(__filename), __dirname); +assert.strictEqual(path.dirname(__filename), __dirname); console.error('load custom file types with extensions'); require.extensions['.test'] = function(module, filename) { diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-net-GH-5504.js nodejs-6.11.4~dfsg/test/sequential/test-net-GH-5504.js --- nodejs-6.11.2~dfsg/test/sequential/test-net-GH-5504.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-net-GH-5504.js 2017-10-03 17:11:32.000000000 +0000 @@ -49,7 +49,7 @@ const node = process.execPath; const s = spawn(node, [__filename, 'server'], { - env: Object.assign(process.env, { + env: Object.assign({}, process.env, { NODE_DEBUG: 'net' }) }); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-net-server-address.js nodejs-6.11.4~dfsg/test/sequential/test-net-server-address.js --- nodejs-6.11.2~dfsg/test/sequential/test-net-server-address.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-net-server-address.js 2017-10-03 17:11:32.000000000 +0000 @@ -19,7 +19,7 @@ })); if (!common.hasIPv6) { - common.skip('ipv6 part of test, no IPv6 support'); + common.printSkipMessage('ipv6 part of test, no IPv6 support'); return; } diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-net-server-bind.js nodejs-6.11.4~dfsg/test/sequential/test-net-server-bind.js --- nodejs-6.11.2~dfsg/test/sequential/test-net-server-bind.js 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-net-server-bind.js 2017-10-03 17:11:32.000000000 +0000 @@ -0,0 +1,64 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); + + +// With only a callback, server should get a port assigned by the OS +{ + const server = net.createServer(common.mustNotCall()); + + server.listen(common.mustCall(function() { + assert.ok(server.address().port > 100); + server.close(); + })); +} + +// No callback to listen(), assume we can bind in 100 ms +{ + const server = net.createServer(common.mustNotCall()); + + server.listen(common.PORT); + + setTimeout(function() { + const address = server.address(); + assert.strictEqual(address.port, common.PORT); + + if (address.family === 'IPv6') + assert.strictEqual(server._connectionKey, `6::::${address.port}`); + else + assert.strictEqual(server._connectionKey, `4:0.0.0.0:${address.port}`); + + server.close(); + }, 100); +} + +// Callback to listen() +{ + const server = net.createServer(common.mustNotCall()); + + server.listen(common.PORT + 1, common.mustCall(function() { + assert.strictEqual(server.address().port, common.PORT + 1); + server.close(); + })); +} + +// Backlog argument +{ + const server = net.createServer(common.mustNotCall()); + + server.listen(common.PORT + 2, '0.0.0.0', 127, common.mustCall(function() { + assert.strictEqual(server.address().port, common.PORT + 2); + server.close(); + })); +} + +// Backlog argument without host argument +{ + const server = net.createServer(common.mustNotCall()); + + server.listen(common.PORT + 3, 127, common.mustCall(function() { + assert.strictEqual(server.address().port, common.PORT + 3); + server.close(); + })); +} diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-regress-GH-4027.js nodejs-6.11.4~dfsg/test/sequential/test-regress-GH-4027.js --- nodejs-6.11.2~dfsg/test/sequential/test-regress-GH-4027.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-regress-GH-4027.js 2017-10-03 17:11:32.000000000 +0000 @@ -8,10 +8,11 @@ const filename = path.join(common.tmpDir, 'watched'); fs.writeFileSync(filename, 'quis custodiet ipsos custodes'); -setTimeout(fs.unlinkSync, 100, filename); fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) { assert.strictEqual(prev.nlink, 1); assert.strictEqual(curr.nlink, 0); fs.unwatchFile(filename); })); + +setTimeout(fs.unlinkSync, common.platformTimeout(300), filename); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-regress-GH-877.js nodejs-6.11.4~dfsg/test/sequential/test-regress-GH-877.js --- nodejs-6.11.2~dfsg/test/sequential/test-regress-GH-877.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-regress-GH-877.js 2017-10-03 17:11:32.000000000 +0000 @@ -35,11 +35,11 @@ console.log( `Socket: ${agent.sockets[addrString].length}/${ - agent.maxSockets} queued: ${ - agent.requests[addrString] ? agent.requests[addrString].length : 0}`); + agent.maxSockets} queued: ${ + agent.requests[addrString] ? agent.requests[addrString].length : 0}`); const agentRequests = agent.requests[addrString] ? - agent.requests[addrString].length : 0; + agent.requests[addrString].length : 0; if (maxQueued < agentRequests) { maxQueued = agentRequests; diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-timers-blocking-callback.js nodejs-6.11.4~dfsg/test/sequential/test-timers-blocking-callback.js --- nodejs-6.11.2~dfsg/test/sequential/test-timers-blocking-callback.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-timers-blocking-callback.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,8 +1,9 @@ 'use strict'; /* - * This is a regression test for https://github.com/joyent/node/issues/15447 - * and https://github.com/joyent/node/issues/9333. + * This is a regression test for + * https://github.com/nodejs/node-v0.x-archive/issues/15447 and + * and https://github.com/nodejs/node-v0.x-archive/issues/9333. * * When a timer is added in another timer's callback, its underlying timer * handle was started with a timeout that was actually incorrect. @@ -28,9 +29,15 @@ const TIMEOUT = 100; -let nbBlockingCallbackCalls = 0; -let latestDelay = 0; -let timeCallbackScheduled = 0; +let nbBlockingCallbackCalls; +let latestDelay; +let timeCallbackScheduled; + +// These tests are timing dependent so they may fail even when the bug is +// not present (if the host is sufficiently busy that the timers are delayed +// significantly). However, they fail 100% of the time when the bug *is* +// present, so to increase reliability, allow for a small number of retries. +let retries = 2; function initTest() { nbBlockingCallbackCalls = 0; @@ -38,7 +45,7 @@ timeCallbackScheduled = 0; } -function blockingCallback(callback) { +function blockingCallback(retry, callback) { ++nbBlockingCallbackCalls; if (nbBlockingCallbackCalls > 1) { @@ -47,8 +54,15 @@ // to fire, they shouldn't generally be more than 100% late in this case. // But they are guaranteed to be at least 100ms late given the bug in // https://github.com/nodejs/node-v0.x-archive/issues/15447 and - // https://github.com/nodejs/node-v0.x-archive/issues/9333.. - assert(latestDelay < TIMEOUT * 2); + // https://github.com/nodejs/node-v0.x-archive/issues/9333. + if (latestDelay >= TIMEOUT * 2) { + if (retries > 0) { + retries--; + return retry(callback); + } + assert.fail(null, null, + `timeout delayed by more than 100% (${latestDelay}ms)`); + } if (callback) return callback(); } else { @@ -56,25 +70,45 @@ common.busyLoop(TIMEOUT); timeCallbackScheduled = Timer.now(); - setTimeout(blockingCallback.bind(null, callback), TIMEOUT); + setTimeout(blockingCallback.bind(null, retry, callback), TIMEOUT); } } -const testAddingTimerToEmptyTimersList = common.mustCall(function(callback) { +function testAddingTimerToEmptyTimersList(callback) { initTest(); // Call setTimeout just once to make sure the timers list is // empty when blockingCallback is called. - setTimeout(blockingCallback.bind(null, callback), TIMEOUT); -}); + setTimeout( + blockingCallback.bind(null, testAddingTimerToEmptyTimersList, callback), + TIMEOUT + ); +} + +function testAddingTimerToNonEmptyTimersList() { + // If both timers fail and attempt a retry, only actually do anything for one + // of them. + let retryOK = true; + const retry = () => { + if (retryOK) + testAddingTimerToNonEmptyTimersList(); + retryOK = false; + }; -const testAddingTimerToNonEmptyTimersList = common.mustCall(function() { initTest(); // Call setTimeout twice with the same timeout to make // sure the timers list is not empty when blockingCallback is called. - setTimeout(blockingCallback, TIMEOUT); - setTimeout(blockingCallback, TIMEOUT); -}); + setTimeout( + blockingCallback.bind(null, retry), + TIMEOUT + ); + setTimeout( + blockingCallback.bind(null, retry), + TIMEOUT + ); +} // Run the test for the empty timers list case, and then for the non-empty -// timers list one -testAddingTimerToEmptyTimersList(testAddingTimerToNonEmptyTimersList); +// timers list one. +testAddingTimerToEmptyTimersList( + common.mustCall(testAddingTimerToNonEmptyTimersList) +); diff -Nru nodejs-6.11.2~dfsg/test/sequential/test-util-debug.js nodejs-6.11.4~dfsg/test/sequential/test-util-debug.js --- nodejs-6.11.2~dfsg/test/sequential/test-util-debug.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/sequential/test-util-debug.js 2017-10-03 17:11:32.000000000 +0000 @@ -26,7 +26,7 @@ const spawn = require('child_process').spawn; const child = spawn(process.execPath, [__filename, 'child'], { - env: Object.assign(process.env, { NODE_DEBUG: environ }) + env: Object.assign({}, process.env, { NODE_DEBUG: environ }) }); expectErr = expectErr.split('%PID%').join(child.pid); diff -Nru nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-builtin.js nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-builtin.js --- nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-builtin.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-builtin.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,19 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || common.isLinuxPPCBE || - common.isFreeBSD) { + common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); - return; -} - -if (!common.enoughTestCpu) { - common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); diff -Nru nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-cpp-core.js nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-cpp-core.js --- nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-cpp-core.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-cpp-core.js 2017-10-03 17:11:32.000000000 +0000 @@ -1,19 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || common.isLinuxPPCBE || - common.isFreeBSD) { + common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); - return; -} - -if (!common.enoughTestCpu) { - common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); diff -Nru nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-unknown.js nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-unknown.js --- nodejs-6.11.2~dfsg/test/tick-processor/test-tick-processor-unknown.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/tick-processor/test-tick-processor-unknown.js 2017-10-03 17:11:32.000000000 +0000 @@ -6,15 +6,11 @@ // the full 64 bits and the result is that it does not process the // addresses correctly and runs out of memory // Disabling until we get a fix upstreamed into V8 -if (common.isAix) { +if (common.isAix) common.skip('AIX address range too big for scripts.'); - return; -} -if (!common.enoughTestCpu) { +if (!common.enoughTestCpu) common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); diff -Nru nodejs-6.11.2~dfsg/test/timers/test-timers-reliability.js nodejs-6.11.4~dfsg/test/timers/test-timers-reliability.js --- nodejs-6.11.2~dfsg/test/timers/test-timers-reliability.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/test/timers/test-timers-reliability.js 2017-10-03 17:11:32.000000000 +0000 @@ -33,7 +33,7 @@ const monoTimer = new Timer(); monoTimer[Timer.kOnTimeout] = function() { - /* + /* * Make sure that setTimeout's and setInterval's callbacks have * already fired, otherwise it means that they are vulnerable to * time drifting or inconsistent time changes. diff -Nru nodejs-6.11.2~dfsg/tools/doc/addon-verify.js nodejs-6.11.4~dfsg/tools/doc/addon-verify.js --- nodejs-6.11.2~dfsg/tools/doc/addon-verify.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/doc/addon-verify.js 2017-10-03 17:11:32.000000000 +0000 @@ -11,29 +11,29 @@ const contents = fs.readFileSync(doc).toString(); const tokens = marked.lexer(contents); -let files = null; let id = 0; -// Just to make sure that all examples will be processed -tokens.push({ type: 'heading' }); - -for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; +let currentHeader; +const addons = {}; +tokens.forEach((token) => { if (token.type === 'heading' && token.text) { - const blockName = token.text; - if (files && Object.keys(files).length !== 0) { - verifyFiles(files, - blockName, - console.log.bind(null, 'wrote'), - function(err) { if (err) throw err; }); - } - files = {}; - } else if (token.type === 'code') { + currentHeader = token.text; + addons[currentHeader] = { + files: {} + }; + } + if (token.type === 'code') { var match = token.text.match(/^\/\/\s+(.*\.(?:cc|h|js))[\r\n]/); - if (match === null) - continue; - files[match[1]] = token.text; + if (match !== null) { + addons[currentHeader].files[match[1]] = token.text; + } } +}); +for (var header in addons) { + verifyFiles(addons[header].files, + header, + console.log.bind(null, 'wrote'), + function(err) { if (err) throw err; }); } function once(fn) { @@ -66,7 +66,10 @@ if (name === 'test.js') { files[name] = `'use strict'; const common = require('../../common'); -${files[name].replace('Release', "' + common.buildType + '")} +${files[name].replace( + "'./build/Release/addon'", + // eslint-disable-next-line no-template-curly-in-string + '`./build/${common.buildType}/addon`')} `; } return { diff -Nru nodejs-6.11.2~dfsg/tools/doc/html.js nodejs-6.11.4~dfsg/tools/doc/html.js --- nodejs-6.11.2~dfsg/tools/doc/html.js 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/doc/html.js 2017-10-03 17:11:32.000000000 +0000 @@ -10,6 +10,7 @@ module.exports = toHTML; const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/; +const DOC_CREATED_REG_EXP = //; // customized heading without id attribute var renderer = new marked.Renderer(); @@ -31,6 +32,7 @@ )); var gtocLoading = null; var gtocData = null; +var docCreated = null; /** * opts: input, filename, template, nodeVersion. @@ -39,6 +41,8 @@ var template = opts.template; var nodeVersion = opts.nodeVersion || process.version; + docCreated = opts.input.match(DOC_CREATED_REG_EXP); + if (gtocData) { return onGtocLoaded(); } @@ -136,6 +140,8 @@ ); } + template = template.replace(/__ALTDOCS__/, altDocs(filename)); + // content has to be the last thing we do with // the lexed tokens, because it's destructive. const content = marked.parser(lexed); @@ -167,6 +173,56 @@ return linkJsTypeDocs(linkManPages(text)); } +function altDocs(filename) { + if (!docCreated) { + console.error(`Failed to add alternative version links to ${filename}`); + return ''; + } + + function lte(v) { + const ns = v.num.split('.'); + if (docCreated[1] > +ns[0]) + return false; + if (docCreated[1] < +ns[0]) + return true; + return docCreated[2] <= +ns[1]; + } + + const versions = [ + { num: '8.x' }, + { num: '7.x' }, + { num: '6.x', lts: true }, + { num: '5.x' }, + { num: '4.x', lts: true }, + { num: '0.12.x' }, + { num: '0.10.x' } + ]; + + const host = 'https://nodejs.org'; + const href = (v) => `${host}/docs/latest-v${v.num}/api/${filename}.html`; + + function li(v, i) { + let html = `
                                          • ${v.num}`; + + if (v.lts) + html += ' LTS'; + + return html + '
                                          • '; + } + + const lis = versions.filter(lte).map(li).join('\n'); + + if (!lis.length) + return ''; + + return ` +
                                          • + View another version +
                                              ${lis}
                                            +
                                          • + `; +} + // handle general body-text replacements // for example, link man page references to the actual page function parseText(lexed) { @@ -349,7 +405,7 @@ text = text.replace( STABILITY_TEXT_REG_EXP, - `
                                            $1 $2$3
                                            ` + `` ); return text; } diff -Nru nodejs-6.11.2~dfsg/tools/doc/package.json nodejs-6.11.4~dfsg/tools/doc/package.json --- nodejs-6.11.2~dfsg/tools/doc/package.json 2017-08-01 05:39:15.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/doc/package.json 2017-10-03 17:11:33.000000000 +0000 @@ -4,7 +4,7 @@ "description": "Internal tool for generating Node.js API docs", "version": "0.0.0", "engines": { - "node": ">=0.6.10" + "node": ">=6" }, "dependencies": { "marked": "^0.3.5", diff -Nru nodejs-6.11.2~dfsg/tools/gyp_node.py nodejs-6.11.4~dfsg/tools/gyp_node.py --- nodejs-6.11.2~dfsg/tools/gyp_node.py 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/gyp_node.py 2017-10-03 17:11:38.000000000 +0000 @@ -13,14 +13,6 @@ output_dir = os.path.join(os.path.abspath(node_root), 'out') def run_gyp(args): - rc = gyp.main(args) - if rc != 0: - print 'Error running GYP' - sys.exit(rc) - -if __name__ == '__main__': - args = sys.argv[1:] - # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. @@ -58,5 +50,11 @@ args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_gold_flags=0') - gyp_args = list(args) - run_gyp(gyp_args) + rc = gyp.main(args) + if rc != 0: + print 'Error running GYP' + sys.exit(rc) + + +if __name__ == '__main__': + run_gyp(sys.argv[1:]) diff -Nru nodejs-6.11.2~dfsg/tools/icu/iculslocs.cc nodejs-6.11.4~dfsg/tools/icu/iculslocs.cc --- nodejs-6.11.2~dfsg/tools/icu/iculslocs.cc 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/icu/iculslocs.cc 2017-10-03 17:11:38.000000000 +0000 @@ -55,6 +55,7 @@ #include #include #include +#include const char* PROG = "iculslocs"; const char* NAME = U_ICUDATA_NAME; // assume ICU data diff -Nru nodejs-6.11.2~dfsg/tools/jslint.js nodejs-6.11.4~dfsg/tools/jslint.js --- nodejs-6.11.2~dfsg/tools/jslint.js 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/jslint.js 2017-10-03 17:11:38.000000000 +0000 @@ -120,7 +120,7 @@ if (showProgress) { // Start the progress display update timer when the first worker is ready - cluster.once('online', function(worker) { + cluster.once('online', function() { startTime = process.hrtime(); setInterval(printProgress, 1000).unref(); printProgress(); diff -Nru nodejs-6.11.2~dfsg/tools/msvs/find_python.cmd nodejs-6.11.4~dfsg/tools/msvs/find_python.cmd --- nodejs-6.11.2~dfsg/tools/msvs/find_python.cmd 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/msvs/find_python.cmd 2017-10-03 17:11:38.000000000 +0000 @@ -0,0 +1,51 @@ +@IF NOT DEFINED DEBUG_HELPER @ECHO OFF +SETLOCAL +:: If python.exe is in %Path%, just validate +FOR /F "delims=" %%a IN ('where python 2^> NUL') DO ( + SET need_path=0 + SET p=%%~dpa + IF NOT ERRORLEVEL 1 GOTO :validate +) + +:: Query the 3 locations mentioned in PEP 514 for a python2 InstallPath +FOR %%K IN ( "HKCU\Software", "HKLM\SOFTWARE", "HKLM\Software\Wow6432Node") DO ( + SET need_path=1 + CALL :find-main-branch %%K + :: If validate returns 0 just jump to the end + IF NOT ERRORLEVEL 1 GOTO :validate +) +EXIT /B 1 + +:: Helper subroutine to handle quotes in %1 +:find-main-branch +SET main_key="%~1\Python\PythonCore" +REG QUERY %main_key% /s | findstr "2." | findstr InstallPath > NUL 2> NUL +IF NOT ERRORLEVEL 1 CALL :find-key %main_key% +EXIT /B + +:: Query registry sub-tree for InstallPath +:find-key +FOR /F "delims=" %%a IN ('REG QUERY %1 /s ^| findstr "2." ^| findstr InstallPath') DO IF NOT ERRORLEVEL 1 CALL :find-path %%a +EXIT /B + +:: Parse the value of %1 as the path for python.exe +:find-path +FOR /F "tokens=3*" %%a IN ('REG QUERY %1 /ve') DO ( + SET pt=%%a + IF NOT ERRORLEVEL 1 SET p=%pt% + EXIT /B 0 +) +EXIT /B 1 + +:: Check if %p% holds a path to a real python2 executable +:validate +IF NOT EXIST "%p%python.exe" EXIT /B 1 +:: Check if %p% is python2 +"%p%python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL +IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL% +:: We can wrap it up +ENDLOCAL & SET pt=%p%& SET need_path_ext=%need_path% +SET VCBUILD_PYTHON_LOCATION=%pt%python.exe +IF %need_path_ext%==1 SET Path=%Path%;%pt% +SET need_path_ext= +EXIT /B %ERRORLEVEL% \ No newline at end of file diff -Nru nodejs-6.11.2~dfsg/tools/package-lock.json nodejs-6.11.4~dfsg/tools/package-lock.json --- nodejs-6.11.2~dfsg/tools/package-lock.json 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/package-lock.json 2017-10-03 17:11:38.000000000 +0000 @@ -0,0 +1,792 @@ +{ + "lockfileVersion": 1, + "dependencies": { + "acorn": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.0.3.tgz", + "integrity": "sha1-xGDfCEkUY/AozLguqzcwvwEIez0=" + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" + } + } + }, + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=" + }, + "ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=" + }, + "ansi-escapes": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz", + "integrity": "sha1-W65SvkJIeN2Xg+iRDj/Cki6DyBs=" + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=" + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=" + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "babel-code-frame": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", + "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=" + }, + "bail": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.1.tgz", + "integrity": "sha1-kSV53os5Gq3zxf30zSoPwiXfO8I=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=" + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=" + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=" + }, + "ccount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.1.tgz", + "integrity": "sha1-ZlaHlFFowhjsd/9hpBVa4AInqWw=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=" + }, + "character-entities": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.0.tgz", + "integrity": "sha1-poPiz3Xb6LFxljUxNk5Y4YobFV8=" + }, + "character-entities-html4": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.0.tgz", + "integrity": "sha1-GrCFUdPOH6HfCNAPucod77FHoGw=" + }, + "character-entities-legacy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz", + "integrity": "sha1-sYqtmPa3vMZGweTIH58ZVjdqVho=" + }, + "character-reference-invalid": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz", + "integrity": "sha1-3smtHfufjQa0/NqircPE/ZevHmg=" + }, + "circular-json": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.1.tgz", + "integrity": "sha1-vos2rvzN6LPKeqLWr8B6NyQsDS0=" + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=" + }, + "cli-width": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", + "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "collapse-white-space": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.2.tgz", + "integrity": "sha1-nEY/ucbRkNLcriGjVqAbyunu720=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=" + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=" + }, + "doctrine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "eslint": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.1.0.tgz", + "integrity": "sha1-u7VaKCIO4Itp2pVU1FprLr/X2RM=" + }, + "eslint-plugin-markdown": { + "version": "1.0.0-beta.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-1.0.0-beta.4.tgz", + "integrity": "sha1-gqGZcTmeSxti99SsZCRofCwH7no=" + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=" + }, + "espree": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.4.3.tgz", + "integrity": "sha1-KRC1zNSc6JPC//+qtP2LOjG4I3Q=" + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=" + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=" + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "external-editor": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.4.tgz", + "integrity": "sha1-HtkZnanL/i7y96MbL96LDRI2iXI=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=" + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=" + }, + "flat-cache": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", + "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", + "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=" + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==" + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=" + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=" + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=" + }, + "iconv-lite": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", + "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==" + }, + "ignore": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.3.tgz", + "integrity": "sha1-QyNS5XrM2HqzEQ6C0/6g5HgSFW0=" + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "inquirer": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.1.1.tgz", + "integrity": "sha512-H50sHQwgvvaTBd3HpKMVtL/u6LoHDvYym51gd7bGQe/+9HkCE+J0/3N5FJLfd6O6oz44hHewC2Pc2LodzWVafQ==" + }, + "is-alphabetical": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.0.tgz", + "integrity": "sha1-4lRMEwWCVfIUTLdXBmzTNCocjEY=" + }, + "is-alphanumerical": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz", + "integrity": "sha1-4GSS5xnBvxXewjnk8a9fZ7TW578=" + }, + "is-decimal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.0.tgz", + "integrity": "sha1-lAV5tupjxigICmnmK9qIyEcLT+A=" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "is-hexadecimal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz", + "integrity": "sha1-XEWXcdKvmi45Ungf1U/LG8/kETw=" + }, + "is-my-json-valid": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", + "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=" + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=" + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=" + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=" + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" + }, + "is-resolvable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "js-tokens": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", + "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=" + }, + "js-yaml": { + "version": "3.8.4", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.8.4.tgz", + "integrity": "sha1-UgtFZPhlc7qWZir4Woyvp7S1pvY=" + }, + "jschardet": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.4.2.tgz", + "integrity": "sha1-KqEH8UKvQSHRRWWdRPUIMJYeaZo=" + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=" + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=" + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + }, + "longest-streak": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-1.0.0.tgz", + "integrity": "sha1-0GWXxNTDG1LMsfXY+P5xSOr9aWU=" + }, + "markdown-table": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-0.4.0.tgz", + "integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE=" + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==" + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=" + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=" + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "parse-entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.1.tgz", + "integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=" + }, + "parse5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz", + "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=" + }, + "pluralize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-4.0.0.tgz", + "integrity": "sha1-WbcIwcAZCi9pLxx2GMRGsFL9F2I=" + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=" + }, + "readable-stream": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.2.tgz", + "integrity": "sha1-WgTfBeT1f+Pw3Gj90R3FyXx+b00=" + }, + "remark": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/remark/-/remark-5.1.0.tgz", + "integrity": "sha1-y0Y709vLS5l5STXu4c9x16jjBow=" + }, + "remark-parse": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-1.1.0.tgz", + "integrity": "sha1-w8oQ+ajaBGFcKPCapOMEUQUm7CE=" + }, + "remark-stringify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-1.1.0.tgz", + "integrity": "sha1-pxBeJbnuK/mkm3XSxCPxGwauIJI=" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=" + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=" + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=" + }, + "rimraf": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=" + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=" + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=" + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=" + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=" + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==" + }, + "string-width": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.0.0.tgz", + "integrity": "sha1-Y1xUNsxypuDDh87KJ41OLuxSaH4=" + }, + "stringify-entities": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.1.tgz", + "integrity": "sha1-sVDsLXKsTBtfMktR+2soyc3/BYw=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=" + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "table": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.1.tgz", + "integrity": "sha1-qBFsEz+sLGH0pCCrbN9cTWHw5DU=" + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "trim-trailing-lines": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz", + "integrity": "sha1-eu+7eAjfnWafbaLkOMrIxGradoQ=" + }, + "trough": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.0.tgz", + "integrity": "sha1-a97f5/KqSabzxDIldodVWVfzQv0=" + }, + "tryit": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "unherit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.0.tgz", + "integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=" + }, + "unified": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/unified/-/unified-4.2.1.tgz", + "integrity": "sha1-dv9Dqo2kMPbn5KVchOusKtLPzS4=" + }, + "unist-util-remove-position": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz", + "integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=" + }, + "unist-util-visit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", + "integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "vfile": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-1.4.0.tgz", + "integrity": "sha1-wP1vpIT43r23cfaMMe112I2pf+c=" + }, + "vfile-location": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.1.tgz", + "integrity": "sha1-C/iBb3MrD4vZAqVv2kxiyOk13FI=" + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=" + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +} diff -Nru nodejs-6.11.2~dfsg/tools/release.sh nodejs-6.11.4~dfsg/tools/release.sh --- nodejs-6.11.2~dfsg/tools/release.sh 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/release.sh 2017-10-03 17:11:38.000000000 +0000 @@ -13,7 +13,28 @@ promotablecmd=dist-promotable promotecmd=dist-promote signcmd=dist-sign +customsshkey="" # let ssh and scp use default key +signversion="" +while getopts ":i:s:" option; do + case "${option}" in + i) + customsshkey="-i ${OPTARG}" + ;; + s) + signversion="${OPTARG}" + ;; + \?) + echo "Invalid option -$OPTARG." + exit 1 + ;; + :) + echo "Option -$OPTARG takes a parameter." + exit 1 + ;; + esac +done +shift $((OPTIND-1)) ################################################################################ ## Select a GPG key to use @@ -81,7 +102,7 @@ exit 1 fi - shapath=$(ssh ${webuser}@${webhost} $signcmd nodejs $version) + shapath=$(ssh ${customsshkey} ${webuser}@${webhost} $signcmd nodejs $version) if ! [[ ${shapath} =~ ^/.+/SHASUMS256.txt$ ]]; then echo 'Error: No SHASUMS file returned by sign!' @@ -96,7 +117,7 @@ mkdir -p $tmpdir - scp ${webuser}@${webhost}:${shapath} ${tmpdir}/${shafile} + scp ${customsshkey} ${webuser}@${webhost}:${shapath} ${tmpdir}/${shafile} gpg --default-key $gpgkey --clearsign --digest-algo SHA256 ${tmpdir}/${shafile} gpg --default-key $gpgkey --detach-sign --digest-algo SHA256 ${tmpdir}/${shafile} @@ -119,7 +140,7 @@ fi if [ "X${yorn}" == "Xy" ]; then - scp ${tmpdir}/${shafile} ${tmpdir}/${shafile}.asc ${tmpdir}/${shafile}.sig ${webuser}@${webhost}:${shadir}/ + scp ${customsshkey} ${tmpdir}/${shafile} ${tmpdir}/${shafile}.asc ${tmpdir}/${shafile}.sig ${webuser}@${webhost}:${shadir}/ break fi done @@ -128,17 +149,11 @@ } -if [ "X${1}" == "X-s" ]; then - if [ "X${2}" == "X" ]; then - echo "Please supply a version string to sign" - exit 1 - fi - - sign $2 - exit 0 +if [ -n "${signversion}" ]; then + sign ${signversion} + exit 0 fi - # else: do a normal release & promote ################################################################################ @@ -146,7 +161,7 @@ echo -e "\n# Checking for releases ..." -promotable=$(ssh ${webuser}@${webhost} $promotablecmd nodejs) +promotable=$(ssh ${customsshkey} ${webuser}@${webhost} $promotablecmd nodejs) if [ "X${promotable}" == "X" ]; then echo "No releases to promote!" @@ -179,7 +194,7 @@ echo -e "\n# Promoting ${version}..." - ssh ${webuser}@${webhost} $promotecmd nodejs $version + ssh ${customsshkey} ${webuser}@${webhost} $promotecmd nodejs $version sign $version diff -Nru nodejs-6.11.2~dfsg/tools/update-eslint.sh nodejs-6.11.4~dfsg/tools/update-eslint.sh --- nodejs-6.11.2~dfsg/tools/update-eslint.sh 1970-01-01 00:00:00.000000000 +0000 +++ nodejs-6.11.4~dfsg/tools/update-eslint.sh 2017-10-03 17:11:38.000000000 +0000 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Shell script to update ESLint in the source tree to the latest release. + +# Depends on npm and node being in $PATH. + +# This script must be be in the tools directory when it runs because it uses +# $BASH_SOURCE[0] to determine directories to work in. + +cd "$( dirname "${BASH_SOURCE[0]}" )" +rm -rf eslint +mkdir eslint-tmp +cd eslint-tmp +npm init --yes + +npm install --global-style --no-binlinks --production eslint@latest +cd node_modules/eslint + +# eslint-plugin-markdown is pinned at 1.0.0-beta.4 until there is a release +# that fixes https://github.com/eslint/eslint-plugin-markdown/issues/69. +npm install --no-bin-links --production eslint-plugin-markdown@1.0.0-beta.4 +cd ../.. + +# Install dmn if it is not in path. +type -P dmn || npm install -g dmn + +# Use dmn to remove some unneeded files. +dmn -f clean + +cd .. +mv eslint-tmp/node_modules/eslint eslint +rm -rf eslint-tmp/ diff -Nru nodejs-6.11.2~dfsg/vcbuild.bat nodejs-6.11.4~dfsg/vcbuild.bat --- nodejs-6.11.2~dfsg/vcbuild.bat 2017-08-01 05:39:17.000000000 +0000 +++ nodejs-6.11.4~dfsg/vcbuild.bat 2017-10-03 17:11:38.000000000 +0000 @@ -27,6 +27,7 @@ set upload= set licensertf= set jslint= +set cpplint= set buildnodeweak= set noetw= set noetw_msi_arg= @@ -57,7 +58,7 @@ if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok -if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set jslint=1&set build_addons=1&goto arg-ok +if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set cpplint=1&set jslint=1&set build_addons=1&goto arg-ok if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok @@ -67,10 +68,13 @@ if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok -if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set buildnodeweak=1&set jslint=1&goto arg-ok +if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set buildnodeweak=1&set cpplint=1&set jslint=1&goto arg-ok if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok if /i "%1"=="jslint" set jslint=1&goto arg-ok if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok +if /i "%1"=="cpplint" set cpplint=1&goto arg-ok +if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok +if /i "%1"=="lint-ci" set cpplint=1&set jslint_ci=1&goto arg-ok if /i "%1"=="package" set package=1&goto arg-ok if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok if /i "%1"=="build-release" set build_release=1&goto arg-ok @@ -174,8 +178,7 @@ if defined noprojgen goto msbuild @rem Generate the VS project. -echo configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% -python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% +call :run-python configure %configure_flags% --dest-cpu=%target_arch% --tag=%TAG% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed echo Project files generated. @@ -324,26 +327,70 @@ "%node_exe%" tools\doc\addon-verify.js if %errorlevel% neq 0 exit /b %errorlevel% :: building addons -SetLocal EnableDelayedExpansion +setlocal EnableDelayedExpansion for /d %%F in (test\addons\*) do ( "%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^ --directory="%%F" ^ --nodedir="%cd%" if !errorlevel! neq 0 exit /b !errorlevel! ) -EndLocal +endlocal goto run-tests :run-tests -if "%test_args%"=="" goto jslint +if "%test_args%"=="" goto cpplint if "%config%"=="Debug" set test_args=--mode=debug %test_args% if "%config%"=="Release" set test_args=--mode=release %test_args% echo running 'cctest %cctest_args%' "%config%\cctest" %cctest_args% -echo running 'python tools\test.py %test_args%' -python tools\test.py %test_args% +call :run-python tools\test.py %test_args% +goto cpplint + +:cpplint +if not defined cpplint goto jslint +call :run-cpplint src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h +call :run-python tools/check-imports.py goto jslint +:run-cpplint +if "%*"=="" goto exit +echo running cpplint '%*' +set cppfilelist= +setlocal enabledelayedexpansion +for /f "tokens=*" %%G in ('dir /b /s /a %*') do ( + set relpath=%%G + set relpath=!relpath:*%~dp0=! + call :add-to-list !relpath! +) +( endlocal + set cppfilelist=%localcppfilelist% +) +call :run-python tools/cpplint.py %cppfilelist% +goto exit + +:add-to-list +echo %1 | findstr /c:"src\node_root_certs.h" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /c:"src\queue.h" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /c:"src\tree.h" +if %errorlevel% equ 0 goto exit + +@rem skip subfolders under /src +echo %1 | findstr /r /c:"src\\.*\\.*" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.cc" +if %errorlevel% equ 0 goto exit + +set "localcppfilelist=%localcppfilelist% %1" +goto exit + :jslint if defined jslint_ci goto jslint-ci if not defined jslint goto exit @@ -367,7 +414,7 @@ goto exit :help -echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosign] [x86/x64] [vc2015] [download-all] [enable-vtune] +echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosign] [x86/x64] [vc2015] [download-all] [enable-vtune] [lint/lint-ci] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build @@ -377,6 +424,14 @@ echo vcbuild.bat enable-vtune : builds nodejs with Intel VTune profiling support to profile JavaScript goto exit +:run-python +call tools\msvs\find_python.cmd +if errorlevel 1 echo Could not find python2 & goto :exit +set cmd1="%VCBUILD_PYTHON_LOCATION%" %* +echo %cmd1% +%cmd1% +exit /b %ERRORLEVEL% + :exit goto :EOF @@ -388,8 +443,9 @@ set NODE_VERSION= set TAG= set FULLVERSION= - -for /F "usebackq tokens=*" %%i in (`python "%~dp0tools\getnodeversion.py"`) do set NODE_VERSION=%%i +:: Call as subroutine for validation of python +call :run-python tools\getnodeversion.py > nul +for /F "tokens=*" %%i in ('"%VCBUILD_PYTHON_LOCATION%" tools\getnodeversion.py') do set NODE_VERSION=%%i if not defined NODE_VERSION ( echo Cannot determine current version of Node.js exit /b 1 @@ -398,7 +454,7 @@ if not defined DISTTYPE set DISTTYPE=release if "%DISTTYPE%"=="release" ( set FULLVERSION=%NODE_VERSION% - goto exit + goto distexit ) if "%DISTTYPE%"=="custom" ( if not defined CUSTOMTAG ( @@ -426,6 +482,6 @@ ) set FULLVERSION=%NODE_VERSION%-%TAG% -:exit +:distexit if not defined DISTTYPEDIR set DISTTYPEDIR=%DISTTYPE% goto :EOF