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 9396b77 as of 2018-03-26
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Mike Kaufman <mkaufman@microsoft.com>
  • Loading branch information
chakrabot committed Mar 30, 2018
2 parents 857281b + 9396b77 commit 398f339
Show file tree
Hide file tree
Showing 54 changed files with 268 additions and 213 deletions.
9 changes: 9 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ To read the documentation:
$ man doc/node.1
```

If you prefer to read the documentation in a browser,
run the following after `make doc` is finished:

```console
$ make docopen
```

This will open a browser with the documentation.

To test if Node.js was built correctly:

```console
Expand Down
4 changes: 0 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ stdout in excess of that limit without the output being captured, the child
process will block waiting for the pipe buffer to accept more data. This is
identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`
option if the output will not be consumed.
It is possible to stream data through these pipes in a non-blocking way. Note,
however, that some programs use line-buffered I/O internally. While that does
not affect Node.js, it can mean that data sent to the child process may not be
immediately consumed.

The [`child_process.spawn()`][] method spawns the child process asynchronously,
without blocking the Node.js event loop. The [`child_process.spawnSync()`][]
Expand Down
60 changes: 30 additions & 30 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP2
# HTTP/2

<!--introduced_in=v8.4.0-->

Expand Down Expand Up @@ -229,7 +229,7 @@ added: v8.4.0

The `'stream'` event is emitted when a new `Http2Stream` is created. When
invoked, the handler function will receive a reference to the `Http2Stream`
object, a [HTTP2 Headers Object][], and numeric flags associated with the
object, a [HTTP/2 Headers Object][], and numeric flags associated with the
creation of the stream.

```js
Expand Down Expand Up @@ -381,7 +381,7 @@ Transmits a `GOAWAY` frame to the connected peer *without* shutting down the
added: v8.4.0
-->

* Value: {HTTP2 Settings Object}
* Value: {HTTP/2 Settings Object}

A prototype-less object describing the current local settings of this
`Http2Session`. The local settings are local to *this* `Http2Session` instance.
Expand Down Expand Up @@ -460,7 +460,7 @@ instance's underlying [`net.Socket`].
added: v8.4.0
-->

* Value: {HTTP2 Settings Object}
* Value: {HTTP/2 Settings Object}

A prototype-less object describing the current remote settings of this
`Http2Session`. The remote settings are set by the *connected* HTTP/2 peer.
Expand Down Expand Up @@ -530,7 +530,7 @@ An object describing the current status of this `Http2Session`.
added: v8.4.0
-->

* `settings` {HTTP2 Settings Object}
* `settings` {HTTP/2 Settings Object}

Updates the current local settings for this `Http2Session` and sends a new
`SETTINGS` frame to the connected HTTP/2 peer.
Expand Down Expand Up @@ -669,7 +669,7 @@ client.on('altsvc', (alt, origin, streamId) => {
added: v8.4.0
-->

* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}
* `options` {Object}
* `endStream` {boolean} `true` if the `Http2Stream` *writable* side should
be closed initially, such as when sending a `GET` request that should not
Expand Down Expand Up @@ -855,7 +855,7 @@ added: v8.4.0

The `'trailers'` event is emitted when a block of headers associated with
trailing header fields is received. The listener callback is passed the
[HTTP2 Headers Object][] and flags associated with the headers.
[HTTP/2 Headers Object][] and flags associated with the headers.

```js
stream.on('trailers', (headers, flags) => {
Expand Down Expand Up @@ -952,7 +952,7 @@ calling `http2stream.close()`, or `http2stream.destroy()`. Will be
added: v9.5.0
-->

* Value: {HTTP2 Headers Object}
* Value: {HTTP/2 Headers Object}

An object containing the outbound headers sent for this `Http2Stream`.

Expand All @@ -961,7 +961,7 @@ An object containing the outbound headers sent for this `Http2Stream`.
added: v9.5.0
-->

* Value: {HTTP2 Headers Object[]}
* Value: {HTTP/2 Headers Object[]}

An array of objects containing the outbound informational (additional) headers
sent for this `Http2Stream`.
Expand All @@ -971,7 +971,7 @@ sent for this `Http2Stream`.
added: v9.5.0
-->

* Value: {HTTP2 Headers Object}
* Value: {HTTP/2 Headers Object}

An object containing the outbound trailers sent for this this `HttpStream`.

Expand Down Expand Up @@ -1053,7 +1053,7 @@ added: v8.4.0

The `'headers'` event is emitted when an additional block of headers is received
for a stream, such as when a block of `1xx` informational headers is received.
The listener callback is passed the [HTTP2 Headers Object][] and flags
The listener callback is passed the [HTTP/2 Headers Object][] and flags
associated with the headers.

```js
Expand All @@ -1068,7 +1068,7 @@ added: v8.4.0
-->

The `'push'` event is emitted when response headers for a Server Push stream
are received. The listener callback is passed the [HTTP2 Headers Object][] and
are received. The listener callback is passed the [HTTP/2 Headers Object][] and
flags associated with the headers.

```js
Expand All @@ -1085,7 +1085,7 @@ added: v8.4.0
The `'response'` event is emitted when a response `HEADERS` frame has been
received for this stream from the connected HTTP/2 server. The listener is
invoked with two arguments: an Object containing the received
[HTTP2 Headers Object][], and flags associated with the headers.
[HTTP/2 Headers Object][], and flags associated with the headers.

```js
const http2 = require('http2');
Expand Down Expand Up @@ -1113,7 +1113,7 @@ provide additional methods such as `http2stream.pushStream()` and
added: v8.4.0
-->

* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}

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

Expand Down Expand Up @@ -1143,7 +1143,7 @@ accepts push streams, `false` otherwise. Settings are the same for every
added: v8.4.0
-->

* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}
* `options` {Object}
* `exclusive` {boolean} When `true` and `parent` identifies a parent Stream,
the created stream is made the sole direct dependency of the parent, with
Expand All @@ -1155,7 +1155,7 @@ added: v8.4.0
initiated.
* `err` {Error}
* `pushStream` {ServerHttp2Stream} The returned pushStream object.
* `headers` {HTTP2 Headers Object} Headers object the pushStream was
* `headers` {HTTP/2 Headers Object} Headers object the pushStream was
initiated with.

Initiates a push stream. The callback is invoked with the new `Http2Stream`
Expand Down Expand Up @@ -1185,7 +1185,7 @@ a `weight` value to `http2stream.priority` with the `silent` option set to
added: v8.4.0
-->

* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}
* `options` {Object}
* `endStream` {boolean} Set to `true` to indicate that the response will not
include payload data.
Expand Down Expand Up @@ -1234,7 +1234,7 @@ changes:
-->

* `fd` {number} A readable file descriptor.
* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}
* `options` {Object}
* `statCheck` {Function}
* `getTrailers` {Function} Callback function invoked to collect trailer
Expand Down Expand Up @@ -1329,7 +1329,7 @@ changes:
-->

* `path` {string|Buffer|URL}
* `headers` {HTTP2 Headers Object}
* `headers` {HTTP/2 Headers Object}
* `options` {Object}
* `statCheck` {Function}
* `onError` {Function} Callback function invoked in the case of an
Expand Down Expand Up @@ -1708,7 +1708,7 @@ changes:
* `selectPadding` {Function} When `options.paddingStrategy` is equal to
`http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function
used to determine the padding. See [Using options.selectPadding][].
* `settings` {HTTP2 Settings Object} The initial settings to send to the
* `settings` {HTTP/2 Settings Object} The initial settings to send to the
remote peer upon connection.
* `Http1IncomingMessage` {http.IncomingMessage} Specifies the IncomingMessage
class to used for HTTP/1 fallback. Useful for extending the original
Expand Down Expand Up @@ -1817,7 +1817,7 @@ changes:
* `selectPadding` {Function} When `options.paddingStrategy` is equal to
`http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function
used to determine the padding. See [Using options.selectPadding][].
* `settings` {HTTP2 Settings Object} The initial settings to send to the
* `settings` {HTTP/2 Settings Object} The initial settings to send to the
remote peer upon connection.
* ...: Any [`tls.createServer()`][] options can be provided. For
servers, the identity options (`pfx` or `key`/`cert`) are usually required.
Expand Down Expand Up @@ -1913,7 +1913,7 @@ changes:
* `selectPadding` {Function} When `options.paddingStrategy` is equal to
`http2.constants.PADDING_STRATEGY_CALLBACK`, provides the callback function
used to determine the padding. See [Using options.selectPadding][].
* `settings` {HTTP2 Settings Object} The initial settings to send to the
* `settings` {HTTP/2 Settings Object} The initial settings to send to the
remote peer upon connection.
* `createConnection` {Function} An optional callback that receives the `URL`
instance passed to `connect` and the `options` object, and returns any
Expand Down Expand Up @@ -1966,7 +1966,7 @@ a given number of milliseconds set using `http2server.setTimeout()`.
added: v8.4.0
-->

* Returns: {HTTP2 Settings Object}
* Returns: {HTTP/2 Settings Object}

Returns an object containing the default settings for an `Http2Session`
instance. This method returns a new object instance every time it is called
Expand All @@ -1977,7 +1977,7 @@ so instances returned may be safely modified for use.
added: v8.4.0
-->

* `settings` {HTTP2 Settings Object}
* `settings` {HTTP/2 Settings Object}
* Returns: {Buffer}

Returns a `Buffer` instance containing serialized representation of the given
Expand All @@ -1999,9 +1999,9 @@ added: v8.4.0
-->

* `buf` {Buffer|Uint8Array} The packed settings.
* Returns: {HTTP2 Settings Object}
* Returns: {HTTP/2 Settings Object}

Returns a [HTTP2 Settings Object][] containing the deserialized settings from
Returns a [HTTP/2 Settings Object][] containing the deserialized settings from
the given `Buffer` as generated by `http2.getPackedSettings()`.

### Headers Object
Expand Down Expand Up @@ -2262,7 +2262,7 @@ In order to create a mixed [HTTPS][] and HTTP/2 server, refer to the
[ALPN negotiation][] section.
Upgrading from non-tls HTTP/1 servers is not supported.

The HTTP2 compatibility API is composed of [`Http2ServerRequest`]() and
The HTTP/2 compatibility API is composed of [`Http2ServerRequest`]() and
[`Http2ServerResponse`](). They aim at API compatibility with HTTP/1, but
they do not hide the differences between the protocols. As an example,
the status message for HTTP codes is ignored.
Expand Down Expand Up @@ -2370,7 +2370,7 @@ Example:
console.log(request.headers);
```

See [HTTP2 Headers Object][].
See [HTTP/2 Headers Object][].

In HTTP/2, the request path, hostname, protocol, and method are represented as
special headers prefixed with the `:` character (e.g. `':path'`). These special
Expand Down Expand Up @@ -3097,8 +3097,8 @@ following additional properties:
[HTTP/1]: http.html
[HTTP/2]: https://tools.ietf.org/html/rfc7540
[HTTP/2 Unencrypted]: https://http2.github.io/faq/#does-http2-require-encryption
[HTTP2 Headers Object]: #http2_headers_object
[HTTP2 Settings Object]: #http2_settings_object
[HTTP/2 Headers Object]: #http2_headers_object
[HTTP/2 Settings Object]: #http2_settings_object
[HTTPS]: https.html
[Http2Session and Sockets]: #http2_http2session_and_sockets
[Performance Observer]: perf_hooks.html
Expand Down
17 changes: 5 additions & 12 deletions lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@

'use strict';

const { ERR_CONSOLE_WRITABLE_STREAM } = require('internal/errors').codes;
const {
isStackOverflowError,
codes: { ERR_CONSOLE_WRITABLE_STREAM },
} = require('internal/errors');
const util = require('util');
const kCounts = Symbol('counts');
const trace_mgr = require('trace_mgr'); //ENABLE_TTD

// Track amount of indentation required via `console.group()`.
const kGroupIndent = Symbol('groupIndent');

let MAX_STACK_MESSAGE;

function Console(stdout, stderr, ignoreErrors = true) {
if (!(this instanceof Console)) {
return new Console(stdout, stderr, ignoreErrors);
Expand Down Expand Up @@ -114,17 +115,9 @@ function write(ignoreErrors, stream, string, errorhandler, groupIndent) {

stream.write(string, errorhandler);
} catch (e) {
if (MAX_STACK_MESSAGE === undefined) {
try {
// eslint-disable-next-line no-unused-vars
function a() { a(); }
} catch (err) {
MAX_STACK_MESSAGE = err.message;
}
}
// console is a debugging utility, so it swallowing errors is not desirable
// even in edge cases such as low stack space.
if (e.message === MAX_STACK_MESSAGE && e.name === 'RangeError')
if (isStackOverflowError(e))
throw e;
// Sorry, there's no proper way to pass along the error here.
} finally {
Expand Down
22 changes: 22 additions & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,33 @@ function dnsException(err, syscall, hostname) {
return ex;
}

let MAX_STACK_MESSAGE;
/**
* Returns true if `err` is a `RangeError` with an engine-specific message.
* "Maximum call stack size exceeded" in V8.
*
* @param {Error} err
* @returns {boolean}
*/
function isStackOverflowError(err) {
if (MAX_STACK_MESSAGE === undefined) {
try {
function overflowStack() { overflowStack(); }
overflowStack();
} catch (err) {
MAX_STACK_MESSAGE = err.message;
}
}

return err.name === 'RangeError' && err.message === MAX_STACK_MESSAGE;
}

module.exports = exports = {
dnsException,
errnoException,
exceptionWithHostPort,
uvException,
isStackOverflowError,
message,
AssertionError,
SystemError,
Expand Down
6 changes: 3 additions & 3 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ void Url(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(OneByteString(env->isolate(), url.c_str()));
}

void InitInspectorBindings(Local<Object> target, Local<Value> unused,
Local<Context> context, void* priv) {
void Initialize(Local<Object> target, Local<Value> unused,
Local<Context> context, void* priv) {
Environment* env = Environment::GetCurrent(context);
{
auto obj = Object::New(env->isolate());
Expand Down Expand Up @@ -341,4 +341,4 @@ void InitInspectorBindings(Local<Object> target, Local<Value> unused,
} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector,
node::inspector::InitInspectorBindings);
node::inspector::Initialize);
4 changes: 2 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5066,7 +5066,7 @@ void RegisterBuiltinModules() {
} // namespace node

#if !HAVE_INSPECTOR
void InitEmptyBindings() {}
void Initialize() {}

NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, InitEmptyBindings)
NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, Initialize)
#endif // !HAVE_INSPECTOR
4 changes: 2 additions & 2 deletions src/node_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using v8::Value;
value, ReadOnly).FromJust(); \
} while (0)

static void InitConfig(Local<Object> target,
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
Expand Down Expand Up @@ -138,4 +138,4 @@ static void InitConfig(Local<Object> target,

} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::InitConfig)
NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::Initialize)
Loading

0 comments on commit 398f339

Please sign in to comment.