Blake Embrey
39d9afe279
repl: refactor LineParser implementation
...
Move the core logic from `LineParser` should fail handling into the
recoverable error check for the REPL default eval.
PR-URL: https://github.com/nodejs/node/pull/6171
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-03-14 15:04:50 -07:00
Timothy Gu
d77a7588cf
url: spec-compliant URLSearchParams serializer
...
PR-URL: https://github.com/nodejs/node/pull/11626
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2017-03-14 13:14:20 -07:00
Daijiro Wachi
879d6663ea
net: remove an unused internal module assertPort
...
A module `assertPort` in `lib/internal/net.js` is not used anymore.
Refs: https://github.com/nodejs/node/pull/11667
PR-URL: https://github.com/nodejs/node/pull/11812
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-03-14 18:51:36 +01:00
Juwan Yoo
c6cbbf9263
net: allow missing callback for Socket.connect
...
Arguments of Socket.prototype.connect should be also normalized,
causing error when called without callback.
Changed Socket.prototype.connect's code same as net.connect and added
test.
Fixes: https://github.com/nodejs/node/issues/11761
PR-URL: https://github.com/nodejs/node/pull/11762
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-03-13 20:12:44 +08:00
Joyee Cheung
efec14a7d1
assert: enforce type check in deepStrictEqual
...
Add checks for the built-in type tags to catch objects
with faked prototypes.
See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
for a partial list of built-in tags.
Fixes: https://github.com/nodejs/node/issues/10258
PR-URL: https://github.com/nodejs/node/pull/10282
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-12 17:07:13 +01:00
Richard Lau
055482c21e
module: fix loading from global folders on Windows
...
Code was calculating $PREFIX/lib/node relative to process.execPath, but
on Windows process.execPath is $PREFIX\node.exe whereas everywhere else
process.execPath is $PREFIX/bin/node (where $PREFIX is the root of the
installed Node.js).
PR-URL: https://github.com/nodejs/node/pull/9283
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: João Reis <reis@janeasystems.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-11 22:08:19 +00:00
Lukas Möller
443691a5ae
crypto: fix default encoding of LazyTransform
...
PullRequest #5522 and #5500 described the change
of the default encoding into UTF8 in crypto functions.
This however was only changed for the non-streaming API.
The streaming API still used binary as the default encoding.
This commit will change the default streaming API encoding to UTF8
to make both APIs behave the same.
It will also add tests to validate the behavior.
Refs: https://github.com/nodejs/node/pull/5522
Refs: https://github.com/nodejs/node/pull/5500
PR-URL: https://github.com/nodejs/node/pull/8611
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-11 22:43:35 +01:00
Brian White
c67207731f
lib: simplify Module._resolveLookupPaths
...
This commit consists of two changes:
* Avoids returning request/id *just* for the debug() output
* Returns `null` instead of an empty array for the list of paths
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:59 -05:00
Brian White
e32425bfcd
module: avoid JSON.stringify() for cache key
...
By avoiding JSON.stringify() and simply joining the strings with a
delimiter that does not appear in paths, we can improve cached
require() performance by at least 50%.
Additionally, this commit removes the last source of permanent
function deoptimization (const) for _findPath().
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:53 -05:00
Brian White
28dc848e70
lib: improve method of function calling
...
Using a more "direct" method of function calling yields better
performance.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:46 -05:00
Brian White
403b89e72b
module: avoid hasOwnProperty()
...
hasOwnProperty() is known to be slow, do a direct lookup on a "clean"
object instead.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:41 -05:00
Brian White
298a40e04e
module: use "clean" objects
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:38 -05:00
Brian White
a851b868c0
lib: remove sources of permanent deopts
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:35 -05:00
Brian White
1c3df96570
fs: replace regexp with function
...
Replacing the path separator-finding regexp with a custom function
results in a measurable improvement in performance.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:31 -05:00
Brian White
34c9fc2e4e
fs: avoid multiple conversions to string
...
nullCheck() implicitly converts the argument to string when checking
the value, so this commit avoids any unnecessary additional (Buffer)
conversions to string.
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:24 -05:00
Brian White
21b2440176
fs: avoid recompilation of closure
...
PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-10 23:48:20 -05:00
Timothy Gu
99b27ce99a
url: prioritize toString when stringifying
...
The ES addition operator calls the ToPrimitive() abstract operation
without hint String, leading a subsequent OrdinaryToPrimitive() to call
valueOf() first on an object rather than the desired toString().
Instead, use template literals which directly call ToString() abstract
operation, per Web IDL spec.
PR-URL: https://github.com/nodejs/node/pull/11737
Fixes: b610a4db1c "url: enforce valid UTF-8 in WHATWG parser"
Refs: https://github.com/nodejs/node/commit/b610a4db1c2919f88711962f5797f25ecb1cd36b#commitcomment-21200056
Refs: https://tc39.github.io/ecma262/#sec-addition-operator-plus-runtime-semantics-evaluation
Refs: https://tc39.github.io/ecma262/#sec-template-literals-runtime-semantics-evaluation
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-10 20:02:24 -08:00
Timothy Gu
455e6f1dd8
util: throw toJSON errors when formatting %j
...
Previously all errors resulting from JSON.stringify were treated as a
proof for circularity of the object structure. That is not the case if
the `toJSON` method of the object throws an error. Explicitly check for
the exact error message when determining the object structure's
cyclicity.
PR-URL: https://github.com/nodejs/node/pull/11708
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-10 18:22:57 -08:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Alexey Orlenko
ec2f098156
util: change sparse arrays inspection format
...
Missing elements in sparse arrays used to be serialized to empty
placeholders delimited with commas by util.inspect() and in some cases
the result was a syntactically correct representation of a JavaScript
array with shorter length than the original one. This commit implements
@TimothyGu's suggestion to change the way util.inspect() formats sparse
arrays to something similar to how Firefox shows them.
Fixes: https://github.com/nodejs/node/issues/11570
PR-URL: https://github.com/nodejs/node/pull/11576
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-10 01:10:59 +01:00
Brian White
7afc70de40
url: remove invalid file protocol check
...
'file' should have been 'file:' but since the WHATWG URL spec
suggests using an opaque origin (which is what was already being
used for file URLs), we'll just keep using that, making this merely
a cleanup.
PR-URL: https://github.com/nodejs/node/pull/11691
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-09 08:56:51 -05:00
Brian White
d3480776c7
http: concatenate outgoing Cookie headers
...
This commit enables automatic concatenation of multiple Cookie header
values with a semicolon, except when 2D header arrays are used.
Fixes: https://github.com/nodejs/node/issues/11256
PR-URL: https://github.com/nodejs/node/pull/11259
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-09 08:10:30 -05:00
Brian White
6b2cef65c9
http: append Cookie header values with semicolon
...
Previously, separate incoming Cookie headers would be concatenated
with a comma, which can cause confusion in userland code when it
comes to parsing the final Cookie header value. This commit
concatenates using a semicolon instead.
Fixes: https://github.com/nodejs/node/issues/11256
PR-URL: https://github.com/nodejs/node/pull/11259
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-09 08:10:25 -05:00
Brian White
8243ca0e0e
http: reuse existing StorageObject
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:23 -05:00
Brian White
b377034359
http: support old private properties and function
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:23 -05:00
Brian White
940b5303be
http: use Symbol for outgoing headers
...
PR-URL: https://github.com/nodejs/node/pull/10941
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-03-09 05:50:22 -05:00
Joyee Cheung
4775942957
lib, test: fix server.listen error message
...
Previously the error messages are mostly `[object Object]`
after the options get normalized. Use util.inspect to make
it more useful.
Refactor the listen option test, add precise
error message validation and a few more test cases.
PR-URL: https://github.com/nodejs/node/pull/11693
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-03-09 10:55:58 +01:00
Claudio Rodriguez
a9e64a8ce1
dgram: refactor dgram to module.exports
...
Refactor dgram module to use the more efficient
module.exports = {} pattern.
PR-URL: https://github.com/nodejs/node/pull/11696
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Ron Korving <ron@ronkorving.nl >
2017-03-09 10:50:18 +01:00
Joyee Cheung
53f3869322
net: refactor overloaded argument handling
...
* Make normalizeArgs return either [options, null] or [options, cb]
(the second element won't be undefined anymore) and avoid OOB read
* Use Socket.prototype.connect.call instead of .apply when the number
of arguments is certain(returned by normalizeArgs).
* Rename some args[i] for readability
* Refactor Server.prototype.listen, separate backlogFromArgs and
options.backlog, comment the overloading process, refactor control
flow
PR-URL: https://github.com/nodejs/node/pull/11667
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-03-08 15:06:32 +08:00
Timothy Gu
3f27f02da0
repl: docs-only deprecation of magic mode
...
The workaround used in repl to support `let` and `const` in non-strict
mode (known as "magic" mode) has been unnecessary since V8 v4.9 /
Node.js v6.0.0. This commit doc-deprecate magic mode (which is now
entirely equivalent to sloppy mode) in both `repl` module and in
`internal/repl`, which is responsible for starting the REPL in `node`
interactive mode.
PR-URL: https://github.com/nodejs/node/pull/11599
Refs: https://v8project.blogspot.com/2016/01/v8-release-49.html
Refs: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V6.md#6.0.0
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
2017-03-06 19:23:34 -08:00
Timothy Gu
b77c89022b
repl: remove magic mode semantics
...
The workaround used in repl to support `let` and `const` in non-strict
mode (known as "magic" mode) has been unnecessary since V8 v4.9 /
Node.js v6.0.0. This commit functionally removes this workaround.
PR-URL: https://github.com/nodejs/node/pull/11599
Refs: https://v8project.blogspot.com/2016/01/v8-release-49.html
Refs: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V6.md#6.0.0
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com >
2017-03-06 19:22:23 -08:00
James M Snell
a2ae08999b
tls: runtime deprecation for tls.createSecurePair()
...
Upgrade the deprecation for _tls_legacy (`tls.createSecurePair()`)
to a runtime deprecation.
PR-URL: https://github.com/nodejs/node/pull/11349
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
2017-03-06 14:23:20 -08:00
Nemanja Stojanovic
aab0d202f8
util: convert inspect.styles and inspect.colors to prototype-less objects
...
Use a prototype-less object for inspect.styles and inspect.colors to allow
modification of Object.prototype in the REPL.
Fixes: https://github.com/nodejs/node/issues/11614
PR-URL: https://github.com/nodejs/node/pull/11624
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-03-06 13:14:07 -08:00
Ali BARIN
d0b93c9fef
util: fix inspecting symbol key in string
...
PR-URL: https://github.com/nodejs/node/pull/11672
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-06 16:18:38 +01:00
Andres Suarez
70beef97bd
v8: add cachedDataVersionTag
...
Adds `v8.cachedDataVersionTag()`, which returns an integer
representing the version tag for `cachedData` for the current V8
version & flags.
PR-URL: https://github.com/nodejs/node/pull/11515
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-03-05 14:23:02 +01:00
James M Snell
531de63c14
dns: minor refactor of dns module
...
Move to the more efficient module.exports = {} pattern.
PR-URL: https://github.com/nodejs/node/pull/11597
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-03-04 14:16:03 -08:00
Daijiro Wachi
cccc6d8545
url: use hasIntl instead of try-catch
...
Like the other internal modules, we should use
`process.binding('config').hasIntl` instead of `try-catch`
to make sure `icu` is bonded or not.
PR-URL: https://github.com/nodejs/node/pull/11571
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
2017-03-04 08:04:08 -08:00
Wang Xinyong
202b07f414
stream: fix comment for sync flag of ReadableState
...
It seems that the comment for sync flag of ReadableState is
copied from WritableState without modification.
PR-URL: https://github.com/nodejs/node/pull/11139
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-03 14:16:24 -08:00
Wang Xinyong
1004b9b4ad
stream: remove unused ranOut from ReadableState
...
flag `ranOut` became unused since 0f8de5e1f9 ,
but 0f8de5e1f9 did not remove it.
PR-URL: https://github.com/nodejs/node/pull/11139
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-03-03 14:14:05 -08:00
Brian White
4e05952a8a
os: improve cpus() performance
...
PR-URL: https://github.com/nodejs/node/pull/11564
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
2017-03-02 15:31:21 -05:00
Rich Trott
4c05d6a0b7
buffer: refactor Buffer.prototype.inspect()
...
Replace toString().match().join() with toString().replace().trim(). This
enables the elimination of a length check becuase replace() will return
empty string if Buffer is empty whereas match() returns null.
PR-URL: https://github.com/nodejs/node/pull/11600
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-03-02 09:39:03 -08:00
Ben Noordhuis
04c1fbb0fa
net: remove misleading comment
...
The allowHalfOpen comment was added in commit 8a3befa ("net: Refactor
to use streams2") from 2012 but it wasn't true even then as far as I
can tell: Node.js simply always does a shutdown(2) first.
It is true that streams2 withholds the 'end' event when allowHalfOpen
is true but the comment is about a callback that hangs off the 'finish'
event that is emitted after calling `socket.end()`.
PR-URL: https://github.com/nodejs/node/pull/11573
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-03-01 17:31:53 +01:00
Vse Mozhet Byt
dd81d539e2
child_process: fix deoptimizing use of arguments
...
Removed or fixed use of arguments in execFile(),
normalizeExecArgs(), and normalizeSpawnArguments().
Refs: https://github.com/nodejs/node/issues/10323
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=6010
PR-URL: https://github.com/nodejs/node/pull/11535
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-03-01 10:24:03 -05:00
Timothy Gu
b610a4db1c
url: enforce valid UTF-8 in WHATWG parser
...
This commit implements the Web IDL USVString conversion, which mandates
all unpaired Unicode surrogates be turned into U+FFFD REPLACEMENT
CHARACTER. It also disallows Symbols to be used as USVString per spec.
Certain functions call into C++ methods in the binding that use the
Utf8Value class to access string arguments. Utf8Value already does the
normalization using V8's String::Write, so in those cases, instead of
doing the full USVString normalization, only a symbol check is done
(`'' + val`, which uses ES's ToString, versus `String()` which has
special provisions for symbols).
PR-URL: https://github.com/nodejs/node/pull/11436
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-02-28 18:39:20 -08:00
Timothy Gu
c2a302c50b
src: do not ignore IDNA conversion error
...
Old behavior can be restored using a special `lenient` mode, as used in
the legacy URL parser.
PR-URL: https://github.com/nodejs/node/pull/11549
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2017-02-28 18:32:01 -08:00
Arseniy Maximov
84c448eafb
net: prefer === to ==
...
* Change === to == in one place
* Add explanation about another non-strict if-statement
PR-URL: https://github.com/nodejs/node/pull/11513
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-02-27 12:26:44 -08:00
Joyee Cheung
562cf5a81c
assert: fix premature deep strict comparison
...
Refactors _deepEqual and fixes a few code paths that lead to
behaviors contradicting what the doc says. Before this commit
certain types of objects (Buffers, Dates, etc.) are not checked
properly, and can get away with different prototypes AND different
enumerable owned properties because _deepEqual would jump to
premature conclusion for them.
Since we no longer follow CommonJS unit testing spec,
the checks for primitives and object prototypes are moved
forward for faster failure.
Improve regexp and float* array checks:
* Don't compare lastIndex of regexps, because they are not
enumerable, so according to the docs they should not be compared
* Compare flags of regexps instead of separate properties
* Use built-in tags to test for float* arrays instead of using
instanceof
Use full link to the archived GitHub repository.
Use util.objectToString for future improvements to that function
that makes sure the call won't be tampered with.
PR-URL: https://github.com/nodejs/node/pull/11128
Refs: https://github.com/nodejs/node/pull/10282#issuecomment-274267895
Refs: https://github.com/nodejs/node/issues/10258#issuecomment-266963234
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2017-02-27 18:39:40 +08:00
Brian White
22abb39b2c
fs: improve performance for sync stat() functions
...
PR-URL: https://github.com/nodejs/node/pull/11522
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-02-25 20:58:42 -05:00
Brian White
efdc571a58
os: improve loadavg() performance
...
PR-URL: https://github.com/nodejs/node/pull/11516
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2017-02-25 20:53:56 -05:00
levsthings
ee7b7f6935
process: fix typo in comments
...
Fixing a typo in comments, the word 'remaining' had a typo.
PR-URL: https://github.com/nodejs/node/pull/11503
Fixes: https://github.com/nodejs/node/issues/11491
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-02-26 00:46:55 +09:00