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

Commit 89ea517

Browse files
committed
meta: merge node/master into node-chakracore/master
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>
2 parents fece3dd + dbe645f commit 89ea517

File tree

14 files changed

+210
-53
lines changed

14 files changed

+210
-53
lines changed

COLLABORATOR_GUIDE.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [Deprecations](#deprecations)
2222
- [Involving the TSC](#involving-the-tsc)
2323
* [Landing Pull Requests](#landing-pull-requests)
24+
- [Using `git-node`](#using-git-node)
2425
- [Technical HOWTO](#technical-howto)
2526
- [Troubleshooting](#troubleshooting)
2627
- [I Just Made a Mistake](#i-just-made-a-mistake)
@@ -455,6 +456,26 @@ Additionally:
455456
- All commits should be self-contained (meaning every commit should pass all
456457
tests). This makes it much easier when bisecting to find a breaking change.
457458

459+
### Using `git-node`
460+
461+
In most cases, using [the `git-node` command][git-node] of [`node-core-utils`][]
462+
should be enough to help you land a Pull Request. If you discover a problem when
463+
using this tool, please file an issue
464+
[to the issue tracker][node-core-utils-issues].
465+
466+
Quick example:
467+
468+
```text
469+
$ npm install -g node-core-utils
470+
$ git node land $PRID
471+
```
472+
473+
If it's the first time you ever use `node-core-utils`, you will be prompted
474+
to type the password of your GitHub account in the console so the tool can
475+
create the GitHub access token for you. If you do not want to do that, follow
476+
[the guide of `node-core-utils`][node-core-utils-credentials]
477+
to set up your credentials manually.
478+
458479
### Technical HOWTO
459480

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

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

576598
* Required: A `PR-URL:` line that references the *full* GitHub URL of the
577599
original pull request being merged so it's easy to trace a commit back to
@@ -750,6 +772,10 @@ LTS working group and the Release team.
750772
[Stability Index]: doc/api/documentation.md#stability-index
751773
[Enhancement Proposal]: https://github.com/nodejs/node-eps
752774
[`--pending-deprecation`]: doc/api/cli.md#--pending-deprecation
775+
[git-node]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md
776+
[git-node-metadata]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-metadata
753777
[git-username]: https://help.github.com/articles/setting-your-username-in-git/
754778
[`node-core-utils`]: https://github.com/nodejs/node-core-utils
755779
[TSC]: https://github.com/nodejs/TSC
780+
[node-core-utils-issues]: https://github.com/nodejs/node-core-utils/issues
781+
[node-core-utils-credentials]: https://github.com/nodejs/node-core-utils#setting-up-credentials

doc/api/async_hooks.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,6 @@ deprecated: v9.6.0
686686
-->
687687
> Stability: 0 - Deprecated: Use [`asyncResource.runInAsyncScope()`][] instead.
688688
689-
* Returns: {undefined}
690-
691689
Call all `before` callbacks to notify that a new asynchronous execution context
692690
is being entered. If nested calls to `emitBefore()` are made, the stack of
693691
`asyncId`s will be tracked and properly unwound.
@@ -704,8 +702,6 @@ deprecated: v9.6.0
704702
-->
705703
> Stability: 0 - Deprecated: Use [`asyncResource.runInAsyncScope()`][] instead.
706704
707-
* Returns: {undefined}
708-
709705
Call all `after` callbacks. If nested calls to `emitBefore()` were made, then
710706
make sure the stack is unwound properly. Otherwise an error will be thrown.
711707

@@ -721,8 +717,6 @@ alternative.
721717

722718
#### `asyncResource.emitDestroy()`
723719

724-
* Returns: {undefined}
725-
726720
Call all `destroy` hooks. This should only ever be called once. An error will
727721
be thrown if it is called more than once. This **must** be manually called. If
728722
the resource is left to be collected by the GC then the `destroy` hooks will

doc/api/fs.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ changes:
788788

789789
* `path` {string|Buffer|URL}
790790
* `mode` {integer} **Default:** `fs.constants.F_OK`
791-
* Returns: {undefined}
792791

793792
Synchronously tests a user's permissions for the file or directory specified by
794793
`path`. The `mode` argument is an optional integer that specifies the

doc/api/http2.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ added: v8.4.0
327327
* `code` {number} The HTTP/2 error code to send in the final `GOAWAY` frame.
328328
If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`,
329329
otherwise defaults to `NO_ERROR`.
330-
* Returns: {undefined}
331330

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

471470
* `msecs` {number}
472471
* `callback` {Function}
473-
* Returns: {undefined}
474472

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

532530
* `settings` {HTTP2 Settings Object}
533-
* Returns {undefined}
534531

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

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

938933
Updates the priority for this `Http2Stream` instance.
939934

@@ -994,7 +989,6 @@ added: v8.4.0
994989

995990
* `msecs` {number}
996991
* `callback` {Function}
997-
* Returns: {undefined}
998992

999993
```js
1000994
const http2 = require('http2');
@@ -1117,7 +1111,6 @@ added: v8.4.0
11171111
-->
11181112

11191113
* `headers` {HTTP2 Headers Object}
1120-
* Returns: {undefined}
11211114

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

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

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

12011192
```js
12021193
const http2 = require('http2');

doc/api/os.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ Equivalent to [`process.platform`][].
322322

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

327327
## os.release()
328328
<!-- YAML
@@ -1220,4 +1220,5 @@ information.
12201220

12211221
[`process.arch`]: process.html#process_process_arch
12221222
[`process.platform`]: process.html#process_process_platform
1223+
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os
12231224
[uname(3)]: https://linux.die.net/man/3/uname

doc/api/process.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,17 @@ process.
621621
```js
622622
console.log(`Current directory: ${process.cwd()}`);
623623
```
624+
## process.debugPort
625+
<!-- YAML
626+
added: v0.7.2
627+
-->
628+
* {number}
624629

630+
The port used by Node.js's debugger when enabled.
631+
632+
```js
633+
process.debugPort = 5858;
634+
```
625635
## process.disconnect()
626636
<!-- YAML
627637
added: v0.7.2
@@ -1440,7 +1450,7 @@ console.log(`This platform is ${process.platform}`);
14401450

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

14451455
## process.ppid
14461456
<!-- YAML
@@ -1997,6 +2007,7 @@ cases:
19972007
[`require.resolve()`]: modules.html#modules_require_resolve_request_options
19982008
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
19992009
[`v8.setFlagsFromString()`]: v8.html#v8_v8_setflagsfromstring_flags
2010+
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os
20002011
[Child Process]: child_process.html
20012012
[Cluster]: cluster.html
20022013
[debugger]: debugger.html
@@ -2008,6 +2019,5 @@ cases:
20082019
[Readable]: stream.html#stream_readable_streams
20092020
[Signal Events]: #process_signal_events
20102021
[Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions
2011-
[Supported platforms]: https://github.com/nodejs/node/blob/master/BUILDING.md#supported-platforms-1
20122022
[TTY]: tty.html#tty_tty
20132023
[Writable]: stream.html#stream_writable_streams

doc/api/stream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,10 @@ class SourceWrapper extends Readable {
18081808
The `readable.push()` method is intended be called only by Readable
18091809
Implementers, and only from within the `readable._read()` method.
18101810

1811+
For streams not operating in object mode, if the `chunk` parameter of
1812+
`readable.push()` is `undefined`, it will be treated as empty string or
1813+
buffer. See [`readable.push('')`][] for more information.
1814+
18111815
#### Errors While Reading
18121816

18131817
It is recommended that errors occurring during the processing of the
@@ -2323,6 +2327,7 @@ contain multi-byte characters.
23232327
[`stream.uncork()`]: #stream_writable_uncork
23242328
[`stream.unpipe()`]: #stream_readable_unpipe_destination
23252329
[`stream.wrap()`]: #stream_readable_wrap_stream
2330+
[`readable.push('')`]: #stream_readable_push
23262331
[`writable.cork()`]: #stream_writable_cork
23272332
[`writable.uncork()`]: #stream_writable_uncork
23282333
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options

doc/onboarding.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ onboarding session.
55

66
## One week before the onboarding session
77

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

1515
## Fifteen minutes before the onboarding session
1616

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

2320
## Onboarding session
2421

lib/internal/http2/core.js

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,23 @@ function onStreamClose(code) {
307307

308308
if (state.fd !== undefined)
309309
tryClose(state.fd);
310-
stream.push(null);
311-
stream[kMaybeDestroy](null, code);
310+
311+
// Defer destroy we actually emit end.
312+
if (stream._readableState.endEmitted || code !== NGHTTP2_NO_ERROR) {
313+
// If errored or ended, we can destroy immediately.
314+
stream[kMaybeDestroy](null, code);
315+
} else {
316+
// Wait for end to destroy.
317+
stream.on('end', stream[kMaybeDestroy]);
318+
// Push a null so the stream can end whenever the client consumes
319+
// it completely.
320+
stream.push(null);
321+
322+
// Same as net.
323+
if (stream.readableLength === 0) {
324+
stream.read(0);
325+
}
326+
}
312327
}
313328

314329
// Receives a chunk of data for a given stream and forwards it on
@@ -326,11 +341,19 @@ function onStreamRead(nread, buf) {
326341
}
327342
return;
328343
}
344+
329345
// Last chunk was received. End the readable side.
330346
debug(`Http2Stream ${stream[kID]} [Http2Session ` +
331347
`${sessionName(stream[kSession][kType])}]: ending readable.`);
332-
stream.push(null);
333-
stream[kMaybeDestroy]();
348+
349+
// defer this until we actually emit end
350+
if (stream._readableState.endEmitted) {
351+
stream[kMaybeDestroy]();
352+
} else {
353+
stream.on('end', stream[kMaybeDestroy]);
354+
stream.push(null);
355+
stream.read(0);
356+
}
334357
}
335358

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

1860+
}
18381861
// The Http2Stream can be destroyed if it has closed and if the readable
18391862
// side has received the final chunk.
18401863
[kMaybeDestroy](error, code = NGHTTP2_NO_ERROR) {
1841-
if (error == null) {
1842-
if (code === NGHTTP2_NO_ERROR &&
1843-
(!this._readableState.ended ||
1844-
!this._writableState.ended ||
1845-
this._writableState.pendingcb > 0 ||
1846-
!this.closed)) {
1847-
return;
1848-
}
1864+
if (error || code !== NGHTTP2_NO_ERROR) {
1865+
this.destroy(error);
1866+
return;
1867+
}
1868+
1869+
// TODO(mcollina): remove usage of _*State properties
1870+
if (this._readableState.ended &&
1871+
this._writableState.ended &&
1872+
this._writableState.pendingcb === 0 &&
1873+
this.closed) {
1874+
this.destroy();
1875+
// This should return, but eslint complains.
1876+
// return
18491877
}
1850-
this.destroy(error);
18511878
}
18521879
}
18531880

lib/util.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ inspect.colors = Object.assign(Object.create(null), {
339339
});
340340

341341
// Don't use 'blue' not visible on cmd.exe
342+
const windows = process.platform === 'win32';
342343
inspect.styles = Object.assign(Object.create(null), {
343344
'special': 'cyan',
344-
'number': 'yellow',
345-
'bigint': 'yellow',
345+
'number': windows ? 'yellow' : 'blue',
346+
'bigint': windows ? 'yellow' : 'blue',
346347
'boolean': 'yellow',
347348
'undefined': 'grey',
348349
'null': 'bold',

0 commit comments

Comments
 (0)