0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00
Commit Graph

29970 Commits

Author SHA1 Message Date
Rich Trott
bdfbbf6c68
doc: trim wording in n-api.md text about exceptions
PR-URL: https://github.com/nodejs/node/pull/32457
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-03-26 10:23:29 -04:00
Victor
afb5639119
doc: update async_hooks.md
Typo `runAndReturn` -> `runSyncAndReturn`

PR-URL: https://github.com/nodejs/node/pull/32382
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-26 10:20:49 -04:00
AshCripps
a621608f12 build: update macos deployment target to 10.13 for 14.x
Update the macos deployment target to 10.13 (High Sierra) for Node 14

refs: https://github.com/nodejs/build/issues/2168

PR-URL: https://github.com/nodejs/node/pull/32454
Refs: https://github.com/nodejs/build/issues/2168
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-26 09:41:06 -04:00
Rich Trott
f0a33d99ec doc: simplify and correct example descriptions in net.md
Instead of indicating that examples show lines to change in previous
examples, present the examples as standalone items. They suffice on
their own.

In the first of these, it says to change "the second line" of a previous
example, but if it were literally changed to the provided line, it would
result in a syntax error.

In the second of these, it gives the wrong line to change.

All of this is unnecessary and probably makes the examples harder to
follow. So simplify and treat each one as a separate example.

PR-URL: https://github.com/nodejs/node/pull/32451
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-25 23:15:20 -07:00
himself65
dade90db9c src: enhance C++ sprintf utility
PR-URL: https://github.com/nodejs/node/pull/32385
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
2020-03-25 19:46:11 -07:00
Anna Henningsen
b950daf836 src: use single ObjectTemplate for TextDecoder
`ObjectTemplate`s are not garbage-collected like regular objects
(for some reason). It is sufficient to create a single template
anyway, so do that to address the memory leak.

Fixes: https://github.com/nodejs/node/issues/32424

PR-URL: https://github.com/nodejs/node/pull/32426
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-03-26 02:37:46 +00:00
Harshitha KP
2fa74e3e38 report: handle on-fatalerror better
--report-on-fatalerror was not honored properly, as there was no
way to check the value which was stored in the Environment pointer
which can be inaccessible under certain fatal error situations.

Move the flag out of Environment pointer so that this is doable.

Co-authored-by: Shobhit Chittora schittora@paypal.com

PR-URL: https://github.com/nodejs/node/pull/32207
Fixes: https://github.com/nodejs/node/issues/31576
Refs: https://github.com/nodejs/node/pull/29881
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2020-03-25 12:43:45 -07:00
Robert Nagy
388cef61e8 stream: align stream.Duplex with net.Socket
stream.Duplex and net.Socket slightly differs in behavior.

Especially when it comes to the case where one side never
becomes readable or writable. This aligns Duplex with the
behavior of Socket.

PR-URL: https://github.com/nodejs/node/pull/32139
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-25 15:20:22 +01:00
Robert Nagy
05f1df5200 stream: fix pipeline with dest in objectMode
pipeline did not support destination with generator
that does not return strings or buffers.

PR-URL: https://github.com/nodejs/node/pull/32414
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-03-25 14:46:10 +01:00
Robert Nagy
9e3eddc75d stream: add pipeline test for destroy of returned stream
Adds a test to ensure that destroying the returned stream
of pipeline will cause a premature close error.

PR-URL: https://github.com/nodejs/node/pull/32425
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-03-25 12:56:09 +01:00
Michael Dawson
f4153c2fe7 doc: add new TSC members
Refs: https://github.com/nodejs/TSC/issues/829
Refs: https://github.com/nodejs/TSC/issues/832
Refs: https://github.com/nodejs/TSC/issues/831

Signed-off-by: Michael Dawson <michael_dawson@ca.ibm.com>

PR-URL: https://github.com/nodejs/node/pull/32473
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-03-24 21:27:56 -07:00
Richard Lau
066bdec643
doc: fix lint warning in doc/api/esm.md
Signed-off-by: Richard Lau <riclau@uk.ibm.com>

PR-URL: https://github.com/nodejs/node/pull/32462
Refs: https://github.com/nodejs/node/pull/31479
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-03-24 14:35:35 -04:00
James M Snell
d0c0e20bc2 test: refactoring / cleanup on child-process tests
PR-URL: https://github.com/nodejs/node/pull/32078
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-24 11:21:00 -07:00
Rich Trott
c78d3f2256 doc: improve wording in vm.md
Simplify complex sentence. Remove use of "straightforward".

PR-URL: https://github.com/nodejs/node/pull/32427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-03-24 10:24:37 -07:00
Rich Trott
43922a55ea doc: improve wording in esm.md
Simplify complex sentence. Remove use of "straightforward".

PR-URL: https://github.com/nodejs/node/pull/32427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-03-24 10:24:34 -07:00
Richard Lau
f467b9b5e2
build: annotate markdown lint failures in pull requests
Add a problem matcher for output from remark-lint to our lint-md GitHub
Actions CI workflow so that any markdown linter failures are annotated
in the pull request in the web UI.

Signed-off-by: Richard Lau <riclau@uk.ibm.com>

PR-URL: https://github.com/nodejs/node/pull/32391
Refs: https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md
Refs: https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
2020-03-24 12:21:03 -04:00
Eric Dobbertin
f92df33832
doc: import clarifications with links to MDN
PR-URL: https://github.com/nodejs/node/pull/31479
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-03-24 12:14:39 -04:00
Robert Nagy
eeccd52b4e net: make readable/writable start as true
`net.Socket` is slightly breaking stream invariants by
having readable/writable going from `false` to `true`.
Streams assume that readable/writable starts out `true`
and then goes to `false` through `push(null)`/`end()`
after which it never goes back to `true`, e.g. once a
stream is `writable == false` it is assumed it will
never become `true`.

This PR changes 2 things:

Unless explicitly set to `false` through options:

- starts as `readable`/`writable` `true` by default.
- uses `push(null)`/`end()` to set `readable`/`writable`
  to `false`. Note that this would cause the socket to
  emit the `'end'`/`'finish'` events, which it did not
  do previously.

In the case it is explicitly set to `false` through
options` it is assumed to never become `true`.

PR-URL: https://github.com/nodejs/node/pull/32272
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-24 09:45:25 +01:00
Rich Trott
96f06e6482 test: use mustCall in place of countdown in timers test
Use common.mustCall() in place of countdown in
test-timers-immediate-unref.

PR-URL: https://github.com/nodejs/node/pull/32416
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-23 22:54:13 -07:00
Rod Vagg
10d8e2687e
doc: add note re term-size commit on top of npm
Until npm updates update-notifier to a newer version, the dependency
tree will contain a version of term-size that has an unsigned macOS
binary. This will fail .pkg notarization and will result in failed
release builds. We built and signed a term-size and contributed it back
to the project for this purpose, but the dependency chain is long enough
that it's not likely to be included in a new npm very quickly.
Until it is, we need to cherry-pick commit d2f08a1bdb ontop of any npm
updates to master and any other release branch that includes
notarization.

PR-URL: https://github.com/nodejs/node/pull/32403
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-03-24 13:22:32 +11:00
Anna Henningsen
668bc11c1b
src: delete BaseObjectWeakPtr data when pointee is gone
Fix the condition for deleting the underlying data pointed to by
a `BaseObjectWeakPtr`, which erroneously skipped that deletion
when `ptr->get()` was `nullptr`. This fixes a memory leak reported
by some of the tests.

Refs: https://github.com/nodejs/node/pull/30374#issuecomment-601848973

PR-URL: https://github.com/nodejs/node/pull/32393
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-03-23 12:06:24 -07:00
Anna Henningsen
f2b0fb270d
src: simplify IsolateData shortcut accesses
PR-URL: https://github.com/nodejs/node/pull/32407
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
2020-03-23 11:04:11 -07:00
Anna Henningsen
678e1be6aa
src: delete CallbackInfo when cleared from cleanup hook
Fixes: https://github.com/nodejs/node/issues/32400

PR-URL: https://github.com/nodejs/node/pull/32405
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 11:02:04 -07:00
Anna Henningsen
f2cc28aec3
test: use InitializeNodeWithArgs in cctest
Refs: d7f11077f1
Fixes: https://github.com/nodejs/node/issues/30257

PR-URL: https://github.com/nodejs/node/pull/32406
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 10:59:49 -07:00
Sam Roberts
6b5f82d7f8 test: end tls connection with some data
In openssl-1.1.1e the client doesn't seem to like having the TLS
connection shut down with no data sent, so send an empty string. A
number of related issues showed up in the TLS1.3 port, so this is
not entirely surprising.

PR-URL: https://github.com/nodejs/node/pull/32328
Fixes: https://github.com/nodejs/node/issues/32210
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 07:37:40 -07:00
Hassaan Pasha
3d0f2257be test: discard data received by client
This test was timing out after update to OpenSSL-1.1.1e.

PR-URL: https://github.com/nodejs/node/pull/32328
Fixes: https://github.com/nodejs/node/issues/32210
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 07:37:35 -07:00
Hassaan Pasha
ec144d5628 deps: update archs files for OpenSSL-1.1.1e
After an OpenSSL source update, all the config files need to be
regenerated and comitted by:
    $ cd deps/openssl/config
    $ make
    $ git add deps/openssl/config/archs
    $ git add deps/openssl/include

PR-URL: https://github.com/nodejs/node/pull/32328
Fixes: https://github.com/nodejs/node/issues/32210
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 07:37:26 -07:00
Hassaan Pasha
425b962031 deps: adjust openssl configuration for 1.1.1e
The scripts used by make were modified to correctly reference the source
files that were originially in crypto/include/internal, but got moved to
include/crypto.  The base path has been left unaltered since that would
require too many changes

PR-URL: https://github.com/nodejs/node/pull/32328
Fixes: https://github.com/nodejs/node/issues/32210
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 07:37:19 -07:00
Hassaan Pasha
116a30b04f deps: upgrade openssl sources to 1.1.1e
This updates all sources in deps/openssl/openssl by:
    $ cd deps/openssl/
    $ rm -rf openssl
    $ tar zxf ~/tmp/openssl-1.1.1e.tar.gz
    $ mv openssl-1.1.1e openssl
    $ git add --all openssl
    $ git commit openssl

PR-URL: https://github.com/nodejs/node/pull/32328
Fixes: https://github.com/nodejs/node/issues/32210
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-03-23 07:37:11 -07:00
Jan Krems
07a1fb953e module: add hook for global preload code
PR-URL: https://github.com/nodejs/node/pull/32068
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-03-23 08:39:37 -05:00
Rich Trott
ecfb7b0988 test: replace countdown with Promise.all() in cluster-net-listen tests
PR-URL: https://github.com/nodejs/node/pull/32381
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-21 21:52:03 -07:00
Rich Trott
7d4dedbf6a test: replace Map with Array in cluster-net-listen tests
PR-URL: https://github.com/nodejs/node/pull/32381
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-21 21:51:59 -07:00
Sam Roberts
1d49558273
Revert "build: add asan check in Github action"
This reverts commit 3ec4b21b1c.

See: https://github.com/nodejs/node/issues/32257

PR-URL: https://github.com/nodejs/node/pull/32324
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
2020-03-21 20:55:27 -07:00
Michaël Zasso
d23eed256b
src: remove calls to deprecated ArrayBuffer methods
v8::ArrayBuffer::IsExternal and v8::ArrayBuffer::Externalize are
no longer necessary.

PR-URL: https://github.com/nodejs/node/pull/32358
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-03-21 12:00:57 +01:00
Anna Henningsen
2061c33670
test: add extended embedder cctest
Add an embedder cctest that also covers a multi-Environment situation,
including worker_threads-style inspector support.

Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:58:28 +01:00
Anna Henningsen
e04f599258
doc: add basic embedding example documentation
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:58:25 +01:00
Anna Henningsen
43d32b073f
src,test: add full-featured embedder API test
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:58:23 +01:00
Anna Henningsen
a8cf886de7
src: shutdown platform from FreePlatform()
There is currently no way to properly do this.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:58:19 +01:00
Jichan
0e576740dc
src: fix what a dispose without checking
If created platform with CreatePlatform, the crash occurs because
it does not check if it was initialized to v8_platform
when DisposePlatform was called.

Refs: https://github.com/nodejs/node/pull/31260
Co-authored-by: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:45 +01:00
Anna Henningsen
887b6a143b
src: allow non-Node.js TracingControllers
We do not need a Node.js-provided `v8::TracingController`, generally.
Loosen that restriction in order to make it easier for embedders
to provide their own subclass of `v8::TracingController`,
or none at all.

Refs: 9c36576ddd

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:40 +01:00
Anna Henningsen
7e0264d932
src: add ability to look up platform based on Environment*
This should eventually remove any necessity to use the global-state
`GetMainThreadMultiIsolatePlatform()`.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:38 +01:00
Anna Henningsen
d7f11077f1
src: make InitializeNodeWithArgs() official public API
This is a decent replacement for the to-be-deprecated Init() API.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:34 +01:00
Anna Henningsen
821e21de8c
src: add unique_ptr equivalent of CreatePlatform
This makes this bit of the embedder situation a bit easier to use.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:31 +01:00
Anna Henningsen
2561484dcb
test: re-enable cctest that was commented out
Refs: https://github.com/nodejs/node/pull/31910

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:29 +01:00
Anna Henningsen
7dead8440c
src: add LoadEnvironment() variant taking a string
Allow passing a string as the main module rather than using
the callback variant.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:26 +01:00
Anna Henningsen
c44edec4da
src: provide a variant of LoadEnvironment taking a callback
This allows embedders to flexibly control how they start JS code
rather than using `third_party_main`.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:23 +01:00
Anna Henningsen
a9fb51f9be
src: align worker and main thread code with embedder API
This addresses some long-standing TODOs by Joyee and me about
making the embedder API more powerful and us less reliant on
internal APIs for creating the main thread and Workers.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:20 +01:00
Anna Henningsen
084c379648
src: associate is_main_thread() with worker_context()
In our codebase, the assumption generally is that `!is_main_thread()`
means that the current Environment belongs to a Node.js Worker thread.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:17 +01:00
Anna Henningsen
64c01222d9
src: move worker_context from Environment to IsolateData
Workers are fully in control of their Isolates, and this helps
avoid a problem with later changes to `CreateEnvironment()`
because now we can run the boostrapping code inside the latter.

PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:15 +01:00
Anna Henningsen
288382a4ce
src: fix memory leak in CreateEnvironment when bootstrap fails
PR-URL: https://github.com/nodejs/node/pull/30467
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-03-21 10:57:12 +01:00