Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge dbe645f as of 2018-02-26
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
chakrabot committed Feb 26, 2018
2 parents fece3dd + dbe645f commit 89ea517
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 53 deletions.
28 changes: 27 additions & 1 deletion COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [Deprecations](#deprecations)
- [Involving the TSC](#involving-the-tsc)
* [Landing Pull Requests](#landing-pull-requests)
- [Using `git-node`](#using-git-node)
- [Technical HOWTO](#technical-howto)
- [Troubleshooting](#troubleshooting)
- [I Just Made a Mistake](#i-just-made-a-mistake)
Expand Down Expand Up @@ -455,6 +456,26 @@ Additionally:
- All commits should be self-contained (meaning every commit should pass all
tests). This makes it much easier when bisecting to find a breaking change.

### Using `git-node`

In most cases, using [the `git-node` command][git-node] of [`node-core-utils`][]
should be enough to help you land a Pull Request. If you discover a problem when
using this tool, please file an issue
[to the issue tracker][node-core-utils-issues].

Quick example:

```text
$ npm install -g node-core-utils
$ git node land $PRID
```

If it's the first time you ever use `node-core-utils`, you will be prompted
to type the password of your GitHub account in the console so the tool can
create the GitHub access token for you. If you do not want to do that, follow
[the guide of `node-core-utils`][node-core-utils-credentials]
to set up your credentials manually.

### Technical HOWTO

Clear any `am`/`rebase` that may already be underway:
Expand Down Expand Up @@ -571,7 +592,8 @@ commit logs, ensure that they are properly formatted, and add

<a name="metadata"></a>
* Modify the original commit message to include additional metadata regarding
the change process. ([`node-core-utils`][] fetches the metadata for you.)
the change process. (The [`git node metadata`][git-node-metadata] command
can generate the metadata for you.)

* Required: A `PR-URL:` line that references the *full* GitHub URL of the
original pull request being merged so it's easy to trace a commit back to
Expand Down Expand Up @@ -750,6 +772,10 @@ LTS working group and the Release team.
[Stability Index]: doc/api/documentation.md#stability-index
[Enhancement Proposal]: https://github.com/nodejs/node-eps
[`--pending-deprecation`]: doc/api/cli.md#--pending-deprecation
[git-node]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md
[git-node-metadata]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-metadata
[git-username]: https://help.github.com/articles/setting-your-username-in-git/
[`node-core-utils`]: https://github.com/nodejs/node-core-utils
[TSC]: https://github.com/nodejs/TSC
[node-core-utils-issues]: https://github.com/nodejs/node-core-utils/issues
[node-core-utils-credentials]: https://github.com/nodejs/node-core-utils#setting-up-credentials
6 changes: 0 additions & 6 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,6 @@ deprecated: v9.6.0
-->
> Stability: 0 - Deprecated: Use [`asyncResource.runInAsyncScope()`][] instead.
* Returns: {undefined}

Call all `before` callbacks to notify that a new asynchronous execution context
is being entered. If nested calls to `emitBefore()` are made, the stack of
`asyncId`s will be tracked and properly unwound.
Expand All @@ -704,8 +702,6 @@ deprecated: v9.6.0
-->
> Stability: 0 - Deprecated: Use [`asyncResource.runInAsyncScope()`][] instead.
* Returns: {undefined}

Call all `after` callbacks. If nested calls to `emitBefore()` were made, then
make sure the stack is unwound properly. Otherwise an error will be thrown.

Expand All @@ -721,8 +717,6 @@ alternative.

#### `asyncResource.emitDestroy()`

* Returns: {undefined}

Call all `destroy` hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This **must** be manually called. If
the resource is left to be collected by the GC then the `destroy` hooks will
Expand Down
1 change: 0 additions & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ changes:

* `path` {string|Buffer|URL}
* `mode` {integer} **Default:** `fs.constants.F_OK`
* Returns: {undefined}

Synchronously tests a user's permissions for the file or directory specified by
`path`. The `mode` argument is an optional integer that specifies the
Expand Down
9 changes: 0 additions & 9 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ added: v8.4.0
* `code` {number} The HTTP/2 error code to send in the final `GOAWAY` frame.
If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`,
otherwise defaults to `NO_ERROR`.
* Returns: {undefined}

Immediately terminates the `Http2Session` and the associated `net.Socket` or
`tls.TLSSocket`.
Expand Down Expand Up @@ -470,7 +469,6 @@ added: v8.4.0

* `msecs` {number}
* `callback` {Function}
* Returns: {undefined}

Used to set a callback function that is called when there is no activity on
the `Http2Session` after `msecs` milliseconds. The given `callback` is
Expand Down Expand Up @@ -530,7 +528,6 @@ added: v8.4.0
-->

* `settings` {HTTP2 Settings Object}
* Returns {undefined}

Updates the current local settings for this `Http2Session` and sends a new
`SETTINGS` frame to the connected HTTP/2 peer.
Expand Down Expand Up @@ -882,7 +879,6 @@ added: v8.4.0
`http2.constants.NGHTTP2_NO_ERROR` (`0x00`)
* `callback` {Function} An optional function registered to listen for the
`'close'` event.
* Returns: {undefined}

Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the
connected HTTP/2 peer.
Expand Down Expand Up @@ -933,7 +929,6 @@ added: v8.4.0
and `256` (inclusive).
* `silent` {boolean} When `true`, changes the priority locally without
sending a `PRIORITY` frame to the connected peer.
* Returns: {undefined}

Updates the priority for this `Http2Stream` instance.

Expand Down Expand Up @@ -994,7 +989,6 @@ added: v8.4.0

* `msecs` {number}
* `callback` {Function}
* Returns: {undefined}

```js
const http2 = require('http2');
Expand Down Expand Up @@ -1117,7 +1111,6 @@ added: v8.4.0
-->

* `headers` {HTTP2 Headers Object}
* Returns: {undefined}

Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer.

Expand Down Expand Up @@ -1161,7 +1154,6 @@ added: v8.4.0
* `pushStream` {ServerHttp2Stream} The returned pushStream object.
* `headers` {HTTP2 Headers Object} Headers object the pushStream was
initiated with.
* Returns: {undefined}

Initiates a push stream. The callback is invoked with the new `Http2Stream`
instance created for the push stream passed as the second argument, or an
Expand Down Expand Up @@ -1196,7 +1188,6 @@ added: v8.4.0
include payload data.
* `getTrailers` {Function} Callback function invoked to collect trailer
headers.
* Returns: {undefined}

```js
const http2 = require('http2');
Expand Down
3 changes: 2 additions & 1 deletion doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Equivalent to [`process.platform`][].

The value `'android'` may also be returned if the Node.js is built on the
Android operating system. However, Android support in Node.js is considered
to be experimental at this time.
[to be experimental][Android building] at this time.

## os.release()
<!-- YAML
Expand Down Expand Up @@ -1220,4 +1220,5 @@ information.

[`process.arch`]: process.html#process_process_arch
[`process.platform`]: process.html#process_process_platform
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os
[uname(3)]: https://linux.die.net/man/3/uname
14 changes: 12 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,17 @@ process.
```js
console.log(`Current directory: ${process.cwd()}`);
```
## process.debugPort
<!-- YAML
added: v0.7.2
-->
* {number}

The port used by Node.js's debugger when enabled.

```js
process.debugPort = 5858;
```
## process.disconnect()
<!-- YAML
added: v0.7.2
Expand Down Expand Up @@ -1440,7 +1450,7 @@ console.log(`This platform is ${process.platform}`);

The value `'android'` may also be returned if the Node.js is built on the
Android operating system. However, Android support in Node.js
[is experimental][Supported platforms].
[is experimental][Android building].

## process.ppid
<!-- YAML
Expand Down Expand Up @@ -1997,6 +2007,7 @@ cases:
[`require.resolve()`]: modules.html#modules_require_resolve_request_options
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
[`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os
[Child Process]: child_process.html
[Cluster]: cluster.html
[debugger]: debugger.html
Expand All @@ -2008,6 +2019,5 @@ cases:
[Readable]: stream.html#stream_readable_streams
[Signal Events]: #process_signal_events
[Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions
[Supported platforms]: https://github.com/nodejs/node/blob/master/BUILDING.md#supported-platforms-1
[TTY]: tty.html#tty_tty
[Writable]: stream.html#stream_writable_streams
5 changes: 5 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,10 @@ class SourceWrapper extends Readable {
The `readable.push()` method is intended be called only by Readable
Implementers, and only from within the `readable._read()` method.

For streams not operating in object mode, if the `chunk` parameter of
`readable.push()` is `undefined`, it will be treated as empty string or
buffer. See [`readable.push('')`][] for more information.

#### Errors While Reading

It is recommended that errors occurring during the processing of the
Expand Down Expand Up @@ -2323,6 +2327,7 @@ contain multi-byte characters.
[`stream.uncork()`]: #stream_writable_uncork
[`stream.unpipe()`]: #stream_readable_unpipe_destination
[`stream.wrap()`]: #stream_readable_wrap_stream
[`readable.push('')`]: #stream_readable_push
[`writable.cork()`]: #stream_writable_cork
[`writable.uncork()`]: #stream_writable_uncork
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options
Expand Down
11 changes: 4 additions & 7 deletions doc/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ onboarding session.

## One week before the onboarding session

* Confirm that the new Collaborator is using two-factor authentication on their
GitHub account. Unless two-factor authentication is enabled, do not give an
account elevated privileges such as the ability to land code in the main
repository or to start continuous integration (CI) jobs.
* If the new Collaborator is not yet a member of the nodejs GitHub organization,
confirm that they are using two-factor authentication. It will not be possible
to add them to the organization if they are not using two-factor
authentication.
* Announce the accepted nomination in a TSC meeting and in the TSC
mailing list.

## Fifteen minutes before the onboarding session

* Prior to the onboarding session, add the new Collaborator to
[the Collaborators team](https://github.com/orgs/nodejs/teams/collaborators).
Note that this is the step that gives the account elevated privileges, so do
not perform this step (or any subsequent steps) unless two-factor
authentication is enabled on the new Collaborator's GitHub account.

## Onboarding session

Expand Down
55 changes: 41 additions & 14 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,23 @@ function onStreamClose(code) {

if (state.fd !== undefined)
tryClose(state.fd);
stream.push(null);
stream[kMaybeDestroy](null, code);

// Defer destroy we actually emit end.
if (stream._readableState.endEmitted || code !== NGHTTP2_NO_ERROR) {
// If errored or ended, we can destroy immediately.
stream[kMaybeDestroy](null, code);
} else {
// Wait for end to destroy.
stream.on('end', stream[kMaybeDestroy]);
// Push a null so the stream can end whenever the client consumes
// it completely.
stream.push(null);

// Same as net.
if (stream.readableLength === 0) {
stream.read(0);
}
}
}

// Receives a chunk of data for a given stream and forwards it on
Expand All @@ -326,11 +341,19 @@ function onStreamRead(nread, buf) {
}
return;
}

// Last chunk was received. End the readable side.
debug(`Http2Stream ${stream[kID]} [Http2Session ` +
`${sessionName(stream[kSession][kType])}]: ending readable.`);
stream.push(null);
stream[kMaybeDestroy]();

// defer this until we actually emit end
if (stream._readableState.endEmitted) {
stream[kMaybeDestroy]();
} else {
stream.on('end', stream[kMaybeDestroy]);
stream.push(null);
stream.read(0);
}
}

// Called when the remote peer settings have been updated.
Expand Down Expand Up @@ -1833,21 +1856,25 @@ class Http2Stream extends Duplex {
session[kMaybeDestroy]();
process.nextTick(emit, this, 'close', code);
callback(err);
}

}
// The Http2Stream can be destroyed if it has closed and if the readable
// side has received the final chunk.
[kMaybeDestroy](error, code = NGHTTP2_NO_ERROR) {
if (error == null) {
if (code === NGHTTP2_NO_ERROR &&
(!this._readableState.ended ||
!this._writableState.ended ||
this._writableState.pendingcb > 0 ||
!this.closed)) {
return;
}
if (error || code !== NGHTTP2_NO_ERROR) {
this.destroy(error);
return;
}

// TODO(mcollina): remove usage of _*State properties
if (this._readableState.ended &&
this._writableState.ended &&
this._writableState.pendingcb === 0 &&
this.closed) {
this.destroy();
// This should return, but eslint complains.
// return
}
this.destroy(error);
}
}

Expand Down
5 changes: 3 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ inspect.colors = Object.assign(Object.create(null), {
});

// Don't use 'blue' not visible on cmd.exe
const windows = process.platform === 'win32';
inspect.styles = Object.assign(Object.create(null), {
'special': 'cyan',
'number': 'yellow',
'bigint': 'yellow',
'number': windows ? 'yellow' : 'blue',
'bigint': windows ? 'yellow' : 'blue',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
Expand Down
Loading

0 comments on commit 89ea517

Please sign in to comment.