summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-02-15fs, src, lib: fix `blksize` & `blocks` on WindowsRichard Lau
libuv returns values for `blksize` and `blocks` on stat calls so do not coerce them into `undefined` on Windows. PR-URL: https://github.com/nodejs/node/pull/26056 Fixes: https://github.com/nodejs/node/issues/25913 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-14lib: merge 'undefined' into one 'break' branchMaleDong
We don't need to split this alone, but just merge it into the 'break' switch branch together. PR-URL: https://github.com/nodejs/node/pull/26039 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-14cluster: migrate round_robin_handle to internal assertRich Trott
Use smaller internal assert module for round_robin_handle.js. PR-URL: https://github.com/nodejs/node/pull/26047 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-14assert: add internal assert.fail()Rich Trott
PR-URL: https://github.com/nodejs/node/pull/26047 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13http: improve performance for incoming headersWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/26041 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2019-02-13lib: simplify 'umask'MaleDong
Just check: if 'mask' is not undefined, just call 'validateMode' and then return the unmask value, we don't need split them into two returns. PR-URL: https://github.com/nodejs/node/pull/26035 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13lib: fix the typo errorMaleDong
Fix a typo error ('the' before 'any'). PR-URL: https://github.com/nodejs/node/pull/26032 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13tls: renegotiate should take care of its own stateSam Roberts
In the initial version of this test there were two zero-length writes to force tls state to cycle. The second is not necessary, at least not now, but the first was. The renegotiate() API should ensure that packet exchange takes place, not its users, so move the zero-length write into tls. See: https://github.com/nodejs/node/pull/14239 See: https://github.com/nodejs/node/commit/b1909d3a70f9 PR-URL: https://github.com/nodejs/node/pull/25997 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-13process: refactor lib/internal/bootstrap/node.jsJoyee Cheung
- Use `deprecate` from `internal/util` instead of from `util` - Split `setupGlobalVariables()` into `setupGlobalProxy()` and `setupBuffer()`, and move out manipulation of the process object. PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13process: use primordials in bootstrap/node.jsJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13lib: save a copy of Symbol in primordialsJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13process: document the bootstrap process in node.jsJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-13lib: move per_context.js under lib/internal/bootstrapJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-12domain: avoid circular memory referencesAnna Henningsen
Avoid circular references that the JS engine cannot see through because it involves an `async id` ⇒ `domain` link. Using weak references is not a great solution, because it increases the domain module’s dependency on internals and the added calls into C++ may affect performance, but it seems like the least bad one. PR-URL: https://github.com/nodejs/node/pull/25993 Fixes: https://github.com/nodejs/node/issues/23862 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-02-12process: normalize process.execPath in CreateProcessObject()Joyee Cheung
Directly normalize `process.execPath` using `uv_fs_realpath` on OpenBSD before serializing it into the process object, instead of using `require('fs')` to normalize and override the path in `bootstrap/node.js`. PR-URL: https://github.com/nodejs/node/pull/26002 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-12worker: keep stdio after exitAnna Henningsen
This addresses review comments from https://github.com/nodejs/node/pull/25871. Refs: https://github.com/nodejs/node/pull/25871 PR-URL: https://github.com/nodejs/node/pull/26017 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-11repl: add repl.setupHistory for programmatic replLance Ball
Adds a `repl.setupHistory()` instance method so that programmatic REPLs can also write history to a file. This change also refactors all of the history file management to `lib/internal/repl/history.js`, cleaning up and simplifying `lib/internal/repl.js`. PR-URL: https://github.com/nodejs/node/pull/25895 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-02-11http2: improve compat performanceMatteo Collina
This bunch of commits help me improve the performance of a http2 server by 8-10%. The benchmarks reports several 1-2% improvements in various areas. PR-URL: https://github.com/nodejs/node/pull/25567 Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-11http: reduce multiple output arrays into oneWeijia Wang
Now we are using `output`, `outputEncodings` and `outputCallbacks` to hold pending data. Reducing them into one array `outputData` can slightly improve performance and reduce some redundant codes. PR-URL: https://github.com/nodejs/node/pull/26004 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-10util: protect against monkeypatched Object prototype for inspect()Rich Trott
Prevent affects of monkeypatching (for example) Object.keys() when calling util.inspect(). PR-URL: https://github.com/nodejs/node/pull/25953 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-10process: normalize process.argv before user code executionJoyee Cheung
And make sure that `process.argv` from the preloaded modules is the same as the one in the main module. Refs: https://github.com/nodejs/node/issues/25967 PR-URL: https://github.com/nodejs/node/pull/26000 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-10process: group main thread execution preparation codeJoyee Cheung
This patch groups the preparation of main thread execution into `prepareMainThreadExecution()` and removes the cluster IPC setup in worker thread bootstrap since clusters do not use worker threads for its implementation and it's unlikely to change. PR-URL: https://github.com/nodejs/node/pull/26000 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-10fs: harden validation of start option in createWriteStreamZYSzys
PR-URL: https://github.com/nodejs/node/pull/25579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-02-09report: rename setDiagnosticReportOptions()cjihrig
setDiagnosticReportOptions() is a method on process.report, making the "DiagnosticReport" part redundant. Rename the function to setOptions(). PR-URL: https://github.com/nodejs/node/pull/25990 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-09report: refactor report option validationcjihrig
PR-URL: https://github.com/nodejs/node/pull/25990 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-09fs: remove redundant callback checkZYSzys
PR-URL: https://github.com/nodejs/node/pull/25160 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-02-09fs: remove useless internalFSZYSzys
PR-URL: https://github.com/nodejs/node/pull/25161 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-09worker: no throw on property access/postMessage after terminationChristopher Jeffrey
PR-URL: https://github.com/nodejs/node/pull/25871 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-09crypto: include 'Buffer' in error output of Hash.update methodAmit Zur
Fixes: https://github.com/nodejs/node/issues/25487 PR-URL: https://github.com/nodejs/node/pull/25533 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-02-09http2: makes response.writeHead return the responseMark S. Everitt
Fixes: https://github.com/nodejs/node/issues/25935 PR-URL: https://github.com/nodejs/node/pull/25974 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-02-09http: makes response.writeHead return the responseMark S. Everitt
Fixes: https://github.com/nodejs/node/issues/25935 PR-URL: https://github.com/nodejs/node/pull/25974 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-02-08worker: use correct ctor for error serializationAnna Henningsen
When serializing errors, use the error constructor that is closest to the object itself in the prototype chain. The previous practice of walking downwards meant that `Error` would usually be the first constructor that is used, even when a more specific one would be available/appropriate, because it is the base class of the other common error types. PR-URL: https://github.com/nodejs/node/pull/25951 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-08perf_hooks: implement histogram based apiJames M Snell
Add a sampling-based event loop delay monitor. ```js const { monitorEventLoopDelay } = require('perf_hooks'); const h = monitorEventLoopDelay(); h.enable(); h.disable(); console.log(h.percentiles); console.log(h.min); console.log(h.max); console.log(h.mean); console.log(h.stddev); console.log(h.percentile(50)); ``` PR-URL: https://github.com/nodejs/node/pull/25378 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-08deps: update acorn to 6.0.7Michaël Zasso
acorn and acorn-walk are now published as two different packages. Put them both in subdirectories of `deps/acorn`. Adapt the REPL's recoverable error detection to use the new API for extending acorn parsers. PR-URL: https://github.com/nodejs/node/pull/25844 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-02-08lib: remove dollar symbol for private functionMaleDong
Just remove '$' because this isn't a programming language like Python. PR-URL: https://github.com/nodejs/node/pull/25590 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-08lib: replace 'assert' with 'internal/assert' for many built-insRich Trott
Replace large 'assert' module with tiny 'internal/assert' module for many built-in uses. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-08assert: create internal/assert micro-moduleRich Trott
For use in built-in modules that could benefit from `assert()` without having to load the entire module (unless an AssertionError actually occurs): lib/internal/assert.js. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-08assert: refactor internal assert.jsRich Trott
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-08lib: use `internal/options` to query `--abort-on-uncaught-exception`Joyee Cheung
Instead of using `internalBinding('config').shouldAbortOnUncaughtException`. Also removes that property from the binding. PR-URL: https://github.com/nodejs/node/pull/25862 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-08process: move deprecation warning initialization into pre_execution.jsJoyee Cheung
Since this is only necessary when user code execution is expected. PR-URL: https://github.com/nodejs/node/pull/25825 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-08lib: move signal event handling into bootstrap/node.jsJoyee Cheung
Moves the `process.on()` and `promise.emit()` calls happened during bootstrap for signal events into `bootstrap/node.js` so it's easier to tell the side effects. Drive-by changes: - Moves the signal event re-arming to a point later during the bootstrap - as early as it were it's unlikely that there could be any existing signal events to re-arm for node-report. - Use a Map instead of an Object for signal wraps since it is used as a deletable dictionary anyway. PR-URL: https://github.com/nodejs/node/pull/25859 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-06perf_hooks: only enable GC tracking when it's requestedJoyee Cheung
Previously a GC prologue callback and a GC epilogue callback are always unconditionally enabled during bootstrap when the `performance` binding is loaded, even when the user does not use the performance timeline API to enable GC tracking. This patch makes the callback addition conditional and only enables them when the user explicitly requests `observer.observe(['gc'])` to avoid the overhead. PR-URL: https://github.com/nodejs/node/pull/25853 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06http: remove redundant call to socket.setTimeout()Luigi Pinca
`Socket.prototype.setTimeout()` clears the previous timer before setting a new one. Refs: https://github.com/nodejs/node/pull/25748#discussion_r253393234 PR-URL: https://github.com/nodejs/node/pull/25928 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06tls: null not valid as a renegotiate callbackSam Roberts
Allow undefined as a callback, but do not allow null. PR-URL: https://github.com/nodejs/node/pull/25929 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06worker: remove undocumented .onclose propertyRich Trott
Remove setting of a 'close' event handler on MessagePort through the use of an `.onclose` property. We don't use this convention anywhere else in our codebase for 'close' events, this feature is undocumented, and we don't test it. PR-URL: https://github.com/nodejs/node/pull/25904 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
2019-02-06lib: fix a few minor issues flagged by lgtmRobin Neatherway
* Confusing (but correct) regex using `A-z` character range by accident * Add the status argument to afterShutdown PR-URL: https://github.com/nodejs/node/pull/25873 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2019-02-06child_process: close pipe ends that are re-pipedGireesh Punathil
when t0 and t1 are spawned with t0's outputstream [1, 2] is piped into t1's input, a new pipe is created which uses a copy of the t0's fd. This leaves the original copy in Node parent, unattended. Net result is that when t0 produces data, it gets bifurcated into both the copies Detect the passed handle to be of 'wrap' type and close after the native spawn invocation by which time piping would have been over. Fixes: https://github.com/nodejs/node/issues/9413 Fixes: https://github.com/nodejs/node/issues/18016 PR-URL: https://github.com/nodejs/node/pull/21209 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-06repl: remove obsolete buffer clearingRuben Bridgewater
It is checked if an command buffer exists or not. This code branch can only be reached if none exist, so there's no need to clear that buffer again. PR-URL: https://github.com/nodejs/node/pull/25731 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-06repl: fix eval return valueRuben Bridgewater
In case no error has occurred during the evaluation of some code, `undefined` has been returned in some cases as error argument instead of `null`. This is fixed by this patch. PR-URL: https://github.com/nodejs/node/pull/25731 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-06repl: simplify and improve completionRuben Bridgewater
The completion lists used a hand crafted list of global entries that was redundant due to also using the actual global properties for tab completion. Those entries ended up in an separated completion group which did not seem useful. PR-URL: https://github.com/nodejs/node/pull/25731 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>