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

Commit 65a249e

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 3d53848 as of 2018-02-12 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: chakrabot <[email protected]>
2 parents 6e93807 + 3d53848 commit 65a249e

36 files changed

+372
-594
lines changed

Diff for: doc/api/async_hooks.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ and document their own resource objects. For example, such a resource object
301301
could contain the SQL query being executed.
302302

303303
In the case of Promises, the `resource` object will have `promise` property
304-
that refers to the Promise that is being initialized, and a `parentId` property
305-
set to the `asyncId` of a parent Promise, if there is one, and `undefined`
304+
that refers to the Promise that is being initialized, and a `isChainedPromise`
305+
property, set to `true` if the promise has a parent promise, and `false`
306306
otherwise. For example, in the case of `b = a.then(handler)`, `a` is considered
307-
a parent Promise of `b`.
307+
a parent Promise of `b`. Here, `b` is considered a chained promise.
308308

309309
In some cases the resource object is reused for performance reasons, it is
310310
thus not safe to use it as a key in a `WeakMap` or add properties to it.

Diff for: doc/api/deprecations.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,10 @@ instead.
378378
<a id="DEP0041"></a>
379379
### DEP0041: NODE\_REPL\_HISTORY\_FILE environment variable
380380

381-
Type: Documentation-only
381+
Type: End-of-life
382382

383-
The `NODE_REPL_HISTORY_FILE` environment variable has been deprecated.
383+
The `NODE_REPL_HISTORY_FILE` environment variable was removed. Please use
384+
`NODE_REPL_HISTORY` instead.
384385

385386
<a id="DEP0042"></a>
386387
### DEP0042: tls.CryptoStream

Diff for: doc/api/fs.md

-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ example `fs.readdirSync('c:\\')` can potentially return a different result than
164164
<!-- YAML
165165
added: v7.6.0
166166
-->
167-
168-
> Stability: 1 - Experimental
169-
170167
For most `fs` module functions, the `path` or `filename` argument may be passed
171168
as a WHATWG [`URL`][] object. Only [`URL`][] objects using the `file:` protocol
172169
are supported.

Diff for: doc/api/repl.md

-16
Original file line numberDiff line numberDiff line change
@@ -506,22 +506,6 @@ by saving inputs to a `.node_repl_history` file located in the user's home
506506
directory. This can be disabled by setting the environment variable
507507
`NODE_REPL_HISTORY=""`.
508508

509-
#### NODE_REPL_HISTORY_FILE
510-
<!-- YAML
511-
added: v2.0.0
512-
deprecated: v3.0.0
513-
-->
514-
515-
> Stability: 0 - Deprecated: Use `NODE_REPL_HISTORY` instead.
516-
517-
Previously in Node.js/io.js v2.x, REPL history was controlled by using a
518-
`NODE_REPL_HISTORY_FILE` environment variable, and the history was saved in JSON
519-
format. This variable has now been deprecated, and the old JSON REPL history
520-
file will be automatically converted to a simplified plain text format. This new
521-
file will be saved to either the user's home directory, or a directory defined
522-
by the `NODE_REPL_HISTORY` variable, as documented in the
523-
[Environment Variable Options](#repl_environment_variable_options).
524-
525509
### Using the Node.js REPL with advanced line-editors
526510

527511
For advanced line-editors, start Node.js with the environment variable

Diff for: lib/async_hooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function showEmitBeforeAfterWarning() {
145145
process.emitWarning(
146146
'asyncResource.emitBefore and emitAfter are deprecated. Please use ' +
147147
'asyncResource.runInAsyncScope instead',
148-
'DeprecationWarning', 'DEP00XX');
148+
'DeprecationWarning', 'DEP0098');
149149
emitBeforeAfterWarning = false;
150150
}
151151
}

Diff for: lib/internal/errors.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ function createErrDiff(actual, expected, operator) {
164164
var skipped = false;
165165
const util = lazyUtil();
166166
const actualLines = util
167-
.inspect(actual, { compact: false }).split('\n');
167+
.inspect(actual, { compact: false, customInspect: false }).split('\n');
168168
const expectedLines = util
169-
.inspect(expected, { compact: false }).split('\n');
169+
.inspect(expected, { compact: false, customInspect: false }).split('\n');
170170
const msg = `Input A expected to ${operator} input B:\n` +
171171
`${green}+ expected${white} ${red}- actual${white}`;
172172
const skippedMsg = ' ... Lines skipped';
@@ -184,6 +184,8 @@ function createErrDiff(actual, expected, operator) {
184184
}
185185
actualLines.pop();
186186
expectedLines.pop();
187+
if (actualLines.length === 0 || expectedLines.length === 0)
188+
break;
187189
a = actualLines[actualLines.length - 1];
188190
b = expectedLines[expectedLines.length - 1];
189191
}
@@ -308,8 +310,10 @@ class AssertionError extends Error {
308310
} else if (errorDiff === 1) {
309311
// In case the objects are equal but the operator requires unequal, show
310312
// the first object and say A equals B
311-
const res = util
312-
.inspect(actual, { compact: false }).split('\n');
313+
const res = util.inspect(
314+
actual,
315+
{ compact: false, customInspect: false }
316+
).split('\n');
313317

314318
if (res.length > 20) {
315319
res[19] = '...';

Diff for: lib/internal/http2/core.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1415,18 +1415,6 @@ function afterDoStreamWrite(status, handle, req) {
14151415
req.handle = undefined;
14161416
}
14171417

1418-
function onHandleFinish() {
1419-
const handle = this[kHandle];
1420-
if (this[kID] === undefined) {
1421-
this.once('ready', onHandleFinish);
1422-
} else if (handle !== undefined) {
1423-
const req = new ShutdownWrap();
1424-
req.oncomplete = () => {};
1425-
req.handle = handle;
1426-
handle.shutdown(req);
1427-
}
1428-
}
1429-
14301418
function streamOnResume() {
14311419
if (!this.destroyed && !this.pending)
14321420
this[kHandle].readStart();
@@ -1447,6 +1435,13 @@ function abort(stream) {
14471435
}
14481436
}
14491437

1438+
function afterShutdown() {
1439+
this.callback();
1440+
const stream = this.handle[kOwner];
1441+
if (stream)
1442+
stream[kMaybeDestroy]();
1443+
}
1444+
14501445
// An Http2Stream is a Duplex stream that is backed by a
14511446
// node::http2::Http2Stream handle implementing StreamBase.
14521447
class Http2Stream extends Duplex {
@@ -1471,7 +1466,6 @@ class Http2Stream extends Duplex {
14711466
writeQueueSize: 0
14721467
};
14731468

1474-
this.once('finish', onHandleFinish);
14751469
this.on('resume', streamOnResume);
14761470
this.on('pause', streamOnPause);
14771471
}
@@ -1678,6 +1672,23 @@ class Http2Stream extends Duplex {
16781672
trackWriteState(this, req.bytes);
16791673
}
16801674

1675+
_final(cb) {
1676+
const handle = this[kHandle];
1677+
if (this[kID] === undefined) {
1678+
this.once('ready', () => this._final(cb));
1679+
} else if (handle !== undefined) {
1680+
debug(`Http2Stream ${this[kID]} [Http2Session ` +
1681+
`${sessionName(this[kSession][kType])}]: _final shutting down`);
1682+
const req = new ShutdownWrap();
1683+
req.oncomplete = afterShutdown;
1684+
req.callback = cb;
1685+
req.handle = handle;
1686+
handle.shutdown(req);
1687+
} else {
1688+
cb();
1689+
}
1690+
}
1691+
16811692
_read(nread) {
16821693
if (this.destroyed) {
16831694
this.push(null);

Diff for: lib/internal/repl.js

+9-53
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const os = require('os');
88
const util = require('util');
99
const debug = util.debuglog('repl');
1010
module.exports = Object.create(REPL);
11-
module.exports.createInternalRepl = createInternalRepl;
11+
module.exports.createInternalRepl = createRepl;
1212

1313
// XXX(chrisdickinson): The 15ms debounce value is somewhat arbitrary.
1414
// The debounce is to guard against code pasted into the REPL.
@@ -19,7 +19,7 @@ function _writeToOutput(repl, message) {
1919
repl._refreshLine();
2020
}
2121

22-
function createInternalRepl(env, opts, cb) {
22+
function createRepl(env, opts, cb) {
2323
if (typeof opts === 'function') {
2424
cb = opts;
2525
opts = null;
@@ -34,7 +34,7 @@ function createInternalRepl(env, opts, cb) {
3434
if (parseInt(env.NODE_NO_READLINE)) {
3535
opts.terminal = false;
3636
}
37-
// the "dumb" special terminal, as defined by terminfo, doesn't support
37+
// The "dumb" special terminal, as defined by terminfo, doesn't support
3838
// ANSI color control codes.
3939
// see http://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials
4040
if (parseInt(env.NODE_DISABLE_COLORS) || env.TERM === 'dumb') {
@@ -61,17 +61,15 @@ function createInternalRepl(env, opts, cb) {
6161

6262
const repl = REPL.start(opts);
6363
if (opts.terminal) {
64-
return setupHistory(repl, env.NODE_REPL_HISTORY,
65-
env.NODE_REPL_HISTORY_FILE, cb);
64+
return setupHistory(repl, env.NODE_REPL_HISTORY, cb);
6665
}
6766

6867
repl._historyPrev = _replHistoryMessage;
6968
cb(null, repl);
7069
}
7170

72-
function setupHistory(repl, historyPath, oldHistoryPath, ready) {
73-
// Empty string disables persistent history.
74-
71+
function setupHistory(repl, historyPath, ready) {
72+
// Empty string disables persistent history
7573
if (typeof historyPath === 'string')
7674
historyPath = historyPath.trim();
7775

@@ -131,50 +129,8 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
131129

132130
if (data) {
133131
repl.history = data.split(/[\n\r]+/, repl.historySize);
134-
} else if (oldHistoryPath === historyPath) {
135-
// If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to
136-
// ~/.node_repl_history, warn the user about it and proceed.
137-
_writeToOutput(
138-
repl,
139-
'\nThe old repl history file has the same name and location as ' +
140-
`the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`);
141-
142-
} else if (oldHistoryPath) {
143-
let threw = false;
144-
try {
145-
// Pre-v3.0, repl history was stored as JSON.
146-
// Try and convert it to line separated history.
147-
const oldReplJSONHistory = fs.readFileSync(oldHistoryPath, 'utf8');
148-
149-
// Only attempt to use the history if there was any.
150-
if (oldReplJSONHistory) repl.history = JSON.parse(oldReplJSONHistory);
151-
152-
if (Array.isArray(repl.history)) {
153-
repl.history = repl.history.slice(0, repl.historySize);
154-
} else {
155-
threw = true;
156-
_writeToOutput(
157-
repl,
158-
'\nError: The old history file data has to be an Array.\n' +
159-
'REPL session history will not be persisted.\n');
160-
}
161-
} catch (err) {
162-
// Cannot open or parse history file.
163-
// Don't crash, just don't persist history.
164-
threw = true;
165-
const type = err instanceof SyntaxError ? 'parse' : 'open';
166-
_writeToOutput(repl, `\nError: Could not ${type} old history file.\n` +
167-
'REPL session history will not be persisted.\n');
168-
}
169-
if (!threw) {
170-
// Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format.
171-
_writeToOutput(
172-
repl,
173-
'\nConverted old JSON repl history to line-separated history.\n' +
174-
`The new repl history file can be found at ${historyPath}.\n`);
175-
} else {
176-
repl.history = [];
177-
}
132+
} else {
133+
repl.history = [];
178134
}
179135

180136
fs.open(historyPath, 'r+', onhandle);
@@ -188,7 +144,7 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
188144
repl._historyHandle = hnd;
189145
repl.on('line', online);
190146

191-
// reading the file data out erases it
147+
// Reading the file data out erases it
192148
repl.once('flushHistory', function() {
193149
repl.resume();
194150
ready(null, repl);

0 commit comments

Comments
 (0)