Add benchmarks to compare the performance between
URLSearchParams and querystring, remove duplicate
benchmarks.
PR-URL: https://github.com/nodejs/node/pull/11170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Fix a warning that was introduced in commit 67af1ad ("src: refactor
CopyProperties to remove JS") from a few days ago. This particular
change was suggested by me, mea culpa.
Fixes the following warning:
../src/node_contextify.cc:151:13: warning: ignoring return
value of function declared with warn_unused_result attribute
[-Wunused-result]
sandbox_obj->DefineProperty(context, key, *desc);
PR-URL: https://github.com/nodejs/node/pull/11197
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Disable "warning C4267: conversion from 'size_t' to 'int', possible
loss of data". Many originate from our dependencies and their sheer
number drowns out other, more legitimate warnings.
PR-URL: https://github.com/nodejs/node/pull/11205
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Writable.cork() and Writable.uncork() are meant to be documented
together, but we maintain a lexicographic order. This commit
introduces some links between the two.
Fixes: https://github.com/nodejs/node/issues/7340
PR-URL: https://github.com/nodejs/node/pull/11222
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Mutations of the environment can invalidate pointers to environment
variables, so make `secure_getenv()` copy them out instead of returning
pointers.
PR-URL: https://github.com/nodejs/node/pull/11051
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
test-assert contains Boolean checks without initializing the Boolean to
false. It will be true thanks to previous tests in the file.
Block-scope all instances of `threw` so that side effects like this are
not an issue. Add missing initializations for `threw` in the tests
where it is missing.
PR-URL: https://github.com/nodejs/node/pull/11191
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Expand error message checking to include the entire error string in
test-dgram-membership.
PR-URL: https://github.com/nodejs/node/pull/11187
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
About path, address and port properties, these are not described though
being also represented as augmented Error objects with added properties.
And also, fix all property descriptions and add type annotations.
PR-URL: https://github.com/nodejs/node/pull/10986
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/11143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
There is a typographical error in the dgram documentation. Reword to
eliminate the error and increase clarity.
PR-URL: https://github.com/nodejs/node/pull/11186
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The stability index is explained elsewhere in the documentation. It is
not necessary to repeat the information about Locked stability index in
the assert documentation.
PR-URL: https://github.com/nodejs/node/pull/11174
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>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Only throw the Error object itself or an object using the Error object
as base objects for user-defined exceptions.
PR-URL: https://github.com/nodejs/node/pull/11168
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
test-tls-econnreset and test-http-response-status-message throw literals
instead of Error objects. Use common.fail() which throws an
AssertionError.
PR-URL: https://github.com/nodejs/node/pull/11168
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Add guide on choice of assertions, use of ES.Next features,
and the WPT upstream.
PR-URL: https://github.com/nodejs/node/pull/11150
Ref: https://github.com/nodejs/node/pull/11142
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Throw error after calling CipherBase#final
PR-URL: https://github.com/nodejs/node/pull/9405
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Currently, `vcbuild` only supports `jslint`. `vcbuild lint` will not
work because there is no `lint` task specified in `vcbuild.bat`. Update
documentation to use `vcbuild jslint` instead.
PR-URL: https://github.com/nodejs/node/pull/11151
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit adds a mustNotCall() helper for testing. This provides
an alternative to using common.fail() as a callback, or creating
a callback function for the sole purpose of calling common.fail().
PR-URL: https://github.com/nodejs/node/pull/11152
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Updates the fs module APIs to allow 'file://' URL objects
to be passed as the path.
For example:
```js
const URL = require('url').URL;
const myURL = new URL('file:///C:/path/to/file');
fs.readFile(myURL, (err, data) => {});
```
On Windows, file: URLs with a hostname convert to UNC paths,
while file: URLs with drive letters convert to local absolute
paths:
```
file://hostname/a/b/c => \\hostname\a\b\c
file:///c:/a/b/c => c:\a\b\c
```
On all other platforms, file: URLs with a hostname are unsupported
and will result in a throw:
```
file://hostname/a/b/c => throw!
file:///a/b/c => /a/b/c
```
The documentation for the fs API is intentionally not updated in
this commit because the URL API is still considered experimental
and is not officially documented *at this time*
Note that file: URLs are *required* by spec to always be absolute
paths from the file system root.
This is a semver-major commit because it changes error handling
on the fs APIs.
PR-URL: https://github.com/nodejs/node/pull/10739
Ref: https://github.com/nodejs/node/issues/10703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add not-an-aardvark as someone to CC for ESLint issues.
PR-URL: https://github.com/nodejs/node/pull/11169
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Replace .map() + .replace().trim() with a single .replace().
PR-URL: https://github.com/nodejs/node/pull/11124
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: Italo A. Casas <me@italoacasas.com>
This prevents the confusing behavior of `buf.toString(0, 5)` by
disallowing passing `0` as the encoding.
PR-URL: https://github.com/nodejs/node/pull/11120
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
CopyProperties() is refactored to use
the V8 5.5 DefineProperty() API call.
The change does not alter current behaviour.
It is a step prior to removing the function
CopyProperties, which becomes reduntant
after fixes of V8 SetNamedPropertyHandler
in 5.5. V8.
Strings used as property attributes
(value, enumerable etc) and accessors
are defined as persistent strings
in src/env.h
PR-URL: https://github.com/nodejs/node/pull/11102
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
In test-module-loading-error:
* Do not skip the rest of the test just because we are running on a
platform for which the test does not know the expected system error
message. Simply skip the message validation but run the remainder of
the test.
* Use assert.throws() in place of try/catch
* Make checks more strict. Instead of partial string matches, match the
entire string. Add check for Error name to at least do some validation
in situations where we do not have the system error message.
PR-URL: https://github.com/nodejs/node/pull/11116
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Check that the property doesn't have the read-only flag set before
overwriting it.
This is Ben Noordhuis previous commit, but keeping
is_contextual_store. is_contextual_store describes whether
this.foo = 42 or foo = 42 was called. The second is contextual
and will fail in strict mode if foo is used without
declaration. Therefore only do an early return if it is
a contextual store. In particular, don't do an early
return for Object.defineProperty(this, ...).
Fixes: https://github.com/nodejs/node/issues/10223
Refs: https://github.com/nodejs/node/pull/10227
PR-URL: https://github.com/nodejs/node/pull/11109
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Fix a typo and add a missing line break.
PR-URL: https://github.com/nodejs/node/pull/11163
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Updates benchmark result output to actual real result.
1 * 1e9 + 552 = 1000000552 not 1000000527
PR-URL: https://github.com/nodejs/node/pull/11158
Reviewed-By: Anna Henningsen <anna@addaleax.net>
https://github.com/nodejs/node/pull/11086 had introduced a regression
that broke command line options processing for tools/test.py.
Basically, it made tools/test.py discard the command line argument that
would be passed after `--abort-on-timeout`. For instance, when running:
```
$ python tools/test.py --abort-on-timeout path/to/some-test
```
all tests would be run because the last command line argument
(`/path/to/some-test`) would be discarded.
This change fixes this regression.
Refs: https://github.com/nodejs/node/pull/11086
PR-URL: https://github.com/nodejs/node/pull/11153
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
* declare v8_platform.platform_ unconditionally
v8_platform.platform_ is referenced by node::Start
without regard to the value of NODE_USE_V8_PLATFORM,
so it should be declared unconditionally, otherwise
Node fails to compile when !NODE_USE_V8_PLATFORM.
* update v8_platform.StartInspector signature
The call signature of v8_platform.StartInspector needs
to be the same whether or not NODE_USE_V8_PLATFORM,
otherwise Node will fail to compile if HAVE_INSPECTOR
and !NODE_USE_V8_PLATFORM.
* don't call tracing_agent->Start w/nullptr
node::tracing::Agent::Start can't accept a nullptr
argument to its platform parameter, so don't call it
when Node is compiled with NODE_USE_V8_PLATFORM=0.
* refactor tracing_agent into v8_platform
Move tracing_agent global into the v8_platform struct,
renaming it to tracing_agent_; CHECK(tracing_agent_ ==
nullptr) in StartTracingAgent() to detect double calls;
and relace another tracing_agent->Stop() call with a call
to StopTracingAgent().
PR-URL: https://github.com/nodejs/node/pull/11088
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
PR-URL: https://github.com/nodejs/node/pull/11140
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Updates the fs module APIs to allow 'file://' URL objects
to be passed as the path.
For example:
```js
const URL = require('url').URL;
const myURL = new URL('file:///C:/path/to/file');
fs.readFile(myURL, (err, data) => {});
```
On Windows, file: URLs with a hostname convert to UNC paths,
while file: URLs with drive letters convert to local absolute
paths:
```
file://hostname/a/b/c => \\hostname\a\b\c
file:///c:/a/b/c => c:\a\b\c
```
On all other platforms, file: URLs with a hostname are unsupported
and will result in a throw:
```
file://hostname/a/b/c => throw!
file:///a/b/c => /a/b/c
```
The documentation for the fs API is intentionally not updated in
this commit because the URL API is still considered experimental
and is not officially documented *at this time*
Note that file: URLs are *required* by spec to always be absolute
paths from the file system root.
This is a semver-major commit because it changes error handling
on the fs APIs.
PR-URL: https://github.com/nodejs/node/pull/10739
Ref: https://github.com/nodejs/node/issues/10703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
vcbuild doesn't sign by default since
92ed1ab450, but there might be people who
haven't noticed the change. This adds a message informing them that
"nosign" is no longer necessary.
PR-URL: https://github.com/nodejs/node/pull/11119
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* group tests by error type
* improve error validation for all messages
* use assert.throws instead of try and catch
* use arrow functions
* add missing test for readdir
* add missing test for readFileSync
* remove unnecessary variables
PR-URL: https://github.com/nodejs/node/pull/11096
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
The assert docs have some language that suggests that we don't want bug
fixes. We do. Send in bug fixes, please. (Just no new API features.)
We'd love to not have assert in core at all, but that ship has sailed.
It's here to stay. Let's at least make it not have surprising behaviors.
Because we want good things for our users.
PR-URL: https://github.com/nodejs/node/pull/11113
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Currently, when a process times out, it is terminated by sending it the
SIGTERM signal. Sending SIGBART instead allows the operating system to
generate a core file that can be investigated later using post-mortem
debuggers such as llnode or mdb_v8.
This can be very useful when investigating flaky tests that time out,
since in that case the failure is difficult to reproduce, and being able
to look at a core file makes a big difference.
With these changes, passing the --abort-on-timeout command line option
to tools/test.py now sends SIGABRT to processes timing out on all
platforms but Windows.
PR-URL: https://github.com/nodejs/node/pull/11086
Ref: https://github.com/nodejs/node/issues/11026
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>