aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-05-10lib: defer pausing stdin to the next tickAnna Henningsen
This is done to match the stream implementation, which also only actually stops reading in the next tick after the `'pause'` event is emitted. PR-URL: https://github.com/nodejs/node/pull/19377 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-10process: create stdin with `manualStart: true`Anna Henningsen
Otherwise Node.js will try to read data from the handle. This causes issues when Node.js is already reading from the same handle, but a different associated stream (e.g. a possible IPC channel). PR-URL: https://github.com/nodejs/node/pull/19377 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-10assert: make sure throws is able to handle primitivesRuben Bridgewater
This fixes some possible issues with `assert.throws` and `assert.rejects` in combination with an validation object. It will now properly handle primitive values being thrown as error. It also makes sure the `generatedMessage` property is properly set if `assert.throws` or `assert.rejects` is used in combination with an validation object and improves the error performance in such cases by only creating the error once. In addition it will fix detecting regular expressions from a different context such as n-api that are passed through as validator for `assert.throws` or `assert.rejects`. Until now those were not tested. PR-URL: https://github.com/nodejs/node/pull/20482 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-05-10errors: move functions to error codeRuben Bridgewater
This makes sure the functions are actually directly beneath the specification of an error code. That way it is not necessary to jump around when looking at the functionality. PR-URL: https://github.com/nodejs/node/pull/20486 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-10assert: move AssertionError into own fileRuben Bridgewater
This moves the `assert` parts from `internal/errors` into an own file. `internal/errors` got bigger and bigger and it was difficult to keep a good overview of what was going on. While doing so it also removes the `internalAssert` function and just lazy loads `assert`. PR-URL: https://github.com/nodejs/node/pull/20486 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-10assert: accept regular expressions to validateRuben Bridgewater
This makes sure regular expressions on validation objects validate against strings when used with `assert.throws` and `assert.rejects`. PR-URL: https://github.com/nodejs/node/pull/20485 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-05-10lib: return directly from packageMainCacheDaniel Bevenius
This commit updates readPackage to return directly when calling packageMainCache instead of storing the result in a local var and returning later. PR-URL: https://github.com/nodejs/node/pull/20591 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-05-09vm: move emitExperimentalWarningDaniel Bevenius
This commit moves emitExperimentalWarning into the second object destructoring of require internal/util. PR-URL: https://github.com/nodejs/node/pull/20593 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-09net: remove typo in setTimeout commentDaniel Bevenius
This commit removes `lear` from the code comment in setTimeout. I'm not 100% sure this is a typo but I've struggled to think what it could mean. Hopefully someone else might be able to shed some light on this. PR-URL: https://github.com/nodejs/node/pull/20576 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-08fs: fchmod->fchown in promises/lchownСковорода Никита Андреевич
This was a clear error. chown should do chown, not chmod. PR-URL: https://github.com/nodejs/node/pull/20407 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jamie Davis <davisjam@vt.edu> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-05-08fs: remove broken code in promises/writeСковорода Никита Андреевич
That code expects the last argument to be a callback. When it's not a callback, it shifts arguments, defaulting encoding to 'utf-8', which is clearly broken. Old signature: (fd, string[, position[, encoding]], callback) New signature: (fd, string[, position[, encoding]]) PR-URL: https://github.com/nodejs/node/pull/20407 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jamie Davis <davisjam@vt.edu> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-05-08console: make console.table() use colored inspectTSUYUSATO Kitsune
This makes `console.table()` inspect objects with color if available like `console.log()`. PR-URL: https://github.com/nodejs/node/pull/20510 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-07fs: move fs/promises to fs.promisescjihrig
PR-URL: https://github.com/nodejs/node/pull/20504 Refs: https://github.com/nodejs/TSC/issues/389 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
2018-05-07constants: freeze the constants objectBryan English
Constants ought to be constant. The primary goal of this commit is to make constants exposed in require('constants') immutable, as they were prior to node@7.0.0, and as the constants exposed on fs.constants, crypto.constants, etc. are. Since this is implemented by using Object.freeze, it also has the side effect of making the entire exports of require('constants') immutable, so no new constants can be defined on the object in userland. PR-URL: https://github.com/nodejs/node/pull/19813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-05-07errors: remove ERR_INVALID_ARRAY_LENGTHRuben Bridgewater
This error code is obsolete, since the error message from ERR_OUT_OF_RANGE is more precise. It was only used a single time, so I went ahead and replced this. PR-URL: https://github.com/nodejs/node/pull/20484 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-07url: fix WHATWG host formatting errorYichao 'Peak' Ji
The current url.format implementation will return an invalid URL string without the host if there is a port and unicode: true. This unexpected behavior is caused by domainToUnicode, which expects a hostname instead of a host string according to node_url.cc. Adds both a fix and a test for the issue. PR-URL: https://github.com/nodejs/node/pull/20493 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2018-05-07Revert "stream: prevent 'end' to be emitted after 'error'"Brian White
This reverts commit 08577906569a4c2de70ad2a861e2f8456cd8fcdd. PR-URL: https://github.com/nodejs/node/pull/20449 Fixes: https://github.com/nodejs/node/issues/20334 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-06errors: remove dead codeRuben Bridgewater
This was never falsy, since an array length can only be an integer. PR-URL: https://github.com/nodejs/node/pull/20483 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
2018-05-06tls: remove sharedCreds in Server constructorDaniel Bevenius
This commit removes the var sharedCreds which is just reassigned to this._sharedCreds in the following line. PR-URL: https://github.com/nodejs/node/pull/20491 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-06tls: cleanup onhandshakestart callbackAnatoli Papirovski
Re-arrange and cleanup the flow of the onhandshakestart to be more clear and less repetitive. Exit early in the case of a first ever handshake for a given connection. PR-URL: https://github.com/nodejs/node/pull/20466 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-06lib: expose FixedQueue internally and fix nextTick bugAnatoli Papirovski
A bug was introduced together with the FixedQueue implementation for process.nextTick which meant that the queue wouldn't necessarily fully clear on each run through. Fix it and abstract the data structure into an internal module that can later be used elsewhere. PR-URL: https://github.com/nodejs/node/pull/20468 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-05-05https: defines maxHeadersCount in the constructorDaiki Arai
In Refs, http.Server's maxHeadersCount field was defined in the constructor to make hidden class stable and so on. Also in https.Server, we can use maxHeadersCount the same as http via connectionListener. So, defines it in the constructor and documentation. Refs: https://github.com/nodejs/node/pull/9116 PR-URL: https://github.com/nodejs/node/pull/20359 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-05repl: add spaces to load/save messagescjihrig
PR-URL: https://github.com/nodejs/node/pull/20536 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-03console: console.time() should not reset a timer when it existsGus Caplan
PR-URL: https://github.com/nodejs/node/pull/20442 Fixes: https://github.com/nodejs/node/issues/20440 Refs: https://console.spec.whatwg.org/#time Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-03lib: named anonymous functionsCarrie Coxwell
PR-URL: https://github.com/nodejs/node/pull/20408 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Matheus Marchini <matheus@sthima.com>
2018-05-03util: named anonymous functionsCarrie Coxwell
PR-URL: https://github.com/nodejs/node/pull/20408 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Matheus Marchini <matheus@sthima.com>
2018-05-03util: improve spliceOne perfAnatoli Papirovski
Do less variable allocations and reassignments inside spliceOne since it's relied on by some performance sensitive code. PR-URL: https://github.com/nodejs/node/pull/20453 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-03events: optimize condition for optimal scenarioAnatoli Papirovski
Instead of always checking whether we've already warned about a possible EventEmitter memory leak, first run the rest of the code as accessing random properties on an Array is expensive. In addition, remove an unnecessary truthy check. PR-URL: https://github.com/nodejs/node/pull/20452 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-02child_process: name anonymous functionsDenis Fäcke
Refs: https://github.com/nodejs/node/issues/8913 PR-URL: https://github.com/nodejs/node/pull/20399 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-05-02timers: named anonymous functionsKyle Martin
PR-URL: https://github.com/nodejs/node/pull/20397 Refs: https://github.com/nodejs/node/issues/8913 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-02http2: reduce require calls in http2/coreDaniel Bevenius
This commit removes unnecesary requires of http and internal/util in http2/core.js PR-URL: https://github.com/nodejs/node/pull/20422 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-30errors: minor (SystemError) refactoringRuben Bridgewater
This removes the former default values and the spread arguments usage. That was unnecessary and now it does only what is necessary. The `message` function got renamed to `getMessage` to outline that it is actually a function and a helper function was inlined into the SystemError constructor as it was only used there. PR-URL: https://github.com/nodejs/node/pull/20337 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-30dns: report out of memory properlyRuben Bridgewater
This addresses a part of a TODO by properly reporting an out of memory error to the user instead of reporting `ENOTFOUND`. PR-URL: https://github.com/nodejs/node/pull/20317 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-29stream: fix error handling with async iterationJulien Fontanet
Fix an issue when an error was emitted by the stream before `iterator.next()` is called. PR-URL: https://github.com/nodejs/node/pull/20329 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-04-29test: fix a TODO and remove obsolete TODOsRuben Bridgewater
This removes outdated TODOs and adds a test for invalid input in `fs.copyFile` and solves a TODO by doing so. PR-URL: https://github.com/nodejs/node/pull/20319 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-29http2: fix ping callbackRuben Bridgewater
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: https://github.com/nodejs/node/pull/20311 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-29assert: make skipping indicator blueRuben Bridgewater
If lines gets skipped, they are marked with three dots. This makes sure they are better visualized to distinguish them from everything else. PR-URL: https://github.com/nodejs/node/pull/20315 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-04-29assert: minor error message improvementsRuben Bridgewater
Adjust indentations and fix a typo. PR-URL: https://github.com/nodejs/node/pull/20315 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-04-29http,https,tls: switch to WHATWG URL parserHackzzila
This switches the url parser from `url.parse()` to the WHATWG URL parser while keeping `url.parse()` as fallback. Also add tests for invalid url deprecations and correct hostname checks. PR-URL: https://github.com/nodejs/node/pull/20270 Fixes: https://github.com/nodejs/node/issues/19468 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-04-29child_process: fix leak when passing http socketsSantiago Gimeno
After passing an HTTP socket, release its associated resources. PR-URL: https://github.com/nodejs/node/pull/20305 Fixes: https://github.com/nodejs/node/issues/15651 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-29buffer: do not always use defaultsRuben Bridgewater
The Buffer#(read|write)U?Int(B|L)E functions should not use a default value. This is very likely a bug and it was never documented that way. Besides that this also improves the tests by adding more tests and by refactoring them to less code lines. PR-URL: https://github.com/nodejs/node/pull/20054 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2018-04-29timers: reschedule interval even if it threwAnatoli Papirovski
To match browser behaviour, intervals should continue being scheduled even if the user callback threw during execution. PR-URL: https://github.com/nodejs/node/pull/20002 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-28http2: fix responses to long payload reqsAnatoli Papirovski
When a request with a long payload is received, http2 does not allow a response that does not process all the incoming payload. Add a conditional Http2Stream.close call that runs only if the user hasn't attempted to read the stream. PR-URL: https://github.com/nodejs/node/pull/20084 Fixes: https://github.com/nodejs/node/issues/20060 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-04-28fs: point isFd to isUint32Daniel Bevenius
This commit updates the isFd function to call isUint32 instead of doing the same thing. PR-URL: https://github.com/nodejs/node/pull/20330 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-28stream: only check options once in Duplex ctorDaniel Bevenius
This commit updates the Duplex constructor adding an if statement checking if options is undefined, and removes the check from the following three if statements. PR-URL: https://github.com/nodejs/node/pull/20353 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-04-28util: fix isInsideNodeModules inside errorAnatoli Papirovski
When isInsideNodeModules gets called while already processing another stack trace, V8 will not call prepareStackTrace again. This used to cause Node.js to just crash — fix it by checking for expected return type of the stack (Array). PR-URL: https://github.com/nodejs/node/pull/20266 Fixes: https://github.com/nodejs/node/issues/20258 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-04-27console: fix console.table() display edge caseRich Trott
If the properties are not specified in `console.table()`, then we should make a best effort to determine them rather than put all values into a "Values" column. PR-URL: https://github.com/nodejs/node/pull/20323 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-27http: refactor outgoing headers processingAnatoli Papirovski
Use a shared function, for..in instead of Object.keys, do less work in `setHeader` and instead defer some of it until later, and other minor changes to improve clarity, as well as a slight boost in performance. PR-URL: https://github.com/nodejs/node/pull/20250 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-27tls: specify options.name in validateKeyCertDaniel Bevenius
This commit addresses a TODO added by Ruben Bridgewater in commit c6b6c92185316e13738e6fa931fdd5303e381e46 ("lib: always show ERR_INVALID_ARG_TYPE received part") which was to prefix the name of the invalid argument with 'options.'. This commit also switches the order of the parameters to validateKeyCert to be consistent with other validators. PR-URL: https://github.com/nodejs/node/pull/20284 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-04-26process: migrate methods to throw errors with codeMichaël Zasso
Migrate some methods from node.cc to JS in order to properly throw errors with codes. PR-URL: https://github.com/nodejs/node/pull/19973 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>