summaryrefslogtreecommitdiff
path: root/node.gyp
AgeCommit message (Collapse)Author
2019-04-06src: port coverage serialization to C++Joyee Cheung
This patch moves the serialization of coverage profiles into C++. With this we no longer need to patch `process.reallyExit` and hook into the exit events, but instead hook into relevant places in C++ which are safe from user manipulation. This also makes the code easier to reuse for other types of profiles. PR-URL: https://github.com/nodejs/node/pull/26874 Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-04-04src: move AsyncResource impl out of public headerBen Noordhuis
Implementing the methods out-of-line (i.e., not inline) means we can fix bugs and have already compiled add-ons pick up the fixes automatically, something that doesn't work when the methods are inline because then they get compiled into the add-on instead of the node binary. PR-URL: https://github.com/nodejs/node/pull/26348 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-04-04src: port bootstrap/cache.js to C++Joyee Cheung
This allows us to query the categories of modules in C++ so we can implement the code cache generator in C++ that does not depend on a Node.js binary. PR-URL: https://github.com/nodejs/node/pull/27046 Refs: https://github.com/nodejs/node/issues/21563 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-04-03process: run RunBootstrapping in CreateEnvironmentJoyee Cheung
Also creates `CreateMainEnvironment` to encapsulate the code creating the main environment from the provided Isolate data and arguments. PR-URL: https://github.com/nodejs/node/pull/26788 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28deps: sync V8 gypfiles with 7.4Ujjwal Sharma
Normalized boolean options in the gypfiles for consistency both internally and with the V8 GN config. Co-authored-by: Michaël Zasso <targos@protonmail.com> PR-URL: https://github.com/nodejs/node/pull/26685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-19src: replace heap_utils.createHeapSnapshot with v8.getHeapSnapshotJoyee Cheung
Remove the internal testing utility and use the public API instead. PR-URL: https://github.com/nodejs/node/pull/26671 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-15src,lib: make DOMException available in all ContextsAnna Henningsen
This allows using `DOMException` from Node.js code for any `vm.Context`. PR-URL: https://github.com/nodejs/node/pull/26497 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-15src,lib: allow running multiple per-context filesAnna Henningsen
Create an `lib/internal/per_context/` directory that can host multiple files which we execute for each context. PR-URL: https://github.com/nodejs/node/pull/26497 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-12lib: move DTRACE_* probes out of global scopeJames M Snell
The DTRACE_* probes have been global for no really good reason. Move those into an internalBinding. PR-URL: https://github.com/nodejs/node/pull/26541 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-12build: enable v8's siphash for hash seed creationRod Vagg
Triggers the V8_USE_SIPHASH to switch from the internal custom V8 hash seed generation function to an implementation of SipHash. Final step needed to clear up HashWick. PR-URL: https://github.com/nodejs/node/pull/26367 Refs: https://github.com/nodejs/node/issues/23259 Refs: https://darksi.de/12.hashwick-v8-vulnerability/ Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
2019-03-12src: refactor coverage connectionJoyee Cheung
- Refactor the C++ class to be resuable for other types of profiles - Move the try-catch block around coverage collection callback to be inside the callback to silence potential JSON or write errors. - Use Function::Call instead of MakeCallback to call the coverage message callback since it does not actually need async hook handling. This way we no longer needs to disable the async hooks when writing the coverage results. - Renames `lib/internal/coverage-gen/with_profiler.js` to `lib/internal/profiler.js` because it is now the only way to generate coverage. PR-URL: https://github.com/nodejs/node/pull/26513 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-03-11process: refactor global.queueMicrotask()Joyee Cheung
- Lazy load `async_hooks` in the implementation - Rename `process/next_tick.js` to `process/task_queues.js` and move the implementation of `global.queueMicrotask()` there since these methods are conceptually related to each other. - Move the bindings used by `global.queueMicrotask()` into `node_task_queue.cc` instead of the generic `node_util.cc` - Use `defineOperation` to define `global.queueMicrotask()` PR-URL: https://github.com/nodejs/node/pull/26523 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-09src: add public API for linked bindingsAnna Henningsen
(Re-?)add a public API for creating linked bindings (access to `NM_F_LINKED` as a constant was previously removed in d6ac8a4db0c0a588258f594dc21fbd8018bef7c2), and add a test for the functionality. PR-URL: https://github.com/nodejs/node/pull/26457 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-08lib: explicitly initialize debuglog during bootstrapJoyee Cheung
This patch splits the implementation of util.debuglog into a separate file and explicitly initialize it during pre-execution since the initialization depends on environment variables. Also delays the call to `debuglog` in modules that are loaded during bootstrap to make sure we only access the environment variable during pre-execution. PR-URL: https://github.com/nodejs/node/pull/26468 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-08repl: add replDefaults to customize the writerRuben Bridgewater
So far it was not possible to modify the inspection defaults used by the REPL from the running instance itself. This introduces a new property on `util.inspect` which is only used inside the REPL and which allows to modify the used inspection defaults at any point of time. PR-URL: https://github.com/nodejs/node/pull/26375 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-04bootstrap: experimental --frozen-intrinsics flagGuy Bedford
PR-URL: https://github.com/nodejs/node/pull/25685 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-14build: move optimizing link directives to node.exe targetRefael Ackermann
* ASCIIbetize directives * Merge duplicate directives from 'conditions' PR-URL: https://github.com/nodejs/node/pull/25931 Reviewed-By: João Reis <reis@janeasystems.com>
2019-02-13lib: move per_context.js under lib/internal/bootstrapJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/26033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-11repl: add repl.setupHistory for programmatic replLance Ball
Adds a `repl.setupHistory()` instance method so that programmatic REPLs can also write history to a file. This change also refactors all of the history file management to `lib/internal/repl/history.js`, cleaning up and simplifying `lib/internal/repl.js`. PR-URL: https://github.com/nodejs/node/pull/25895 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-02-11build: export deprecated OpenSSL symbols on WindowsRichard Lau
Methods such as `TLSv1_server_method` are categorized as `DEPRECATEDIN_1_1_0`. Add the deprecated categories to the list of categories to include passed to `mkssldef.py`. Adds a regression test to `test/addons/openssl-binding`. PR-URL: https://github.com/nodejs/node/pull/25991 Refs: https://github.com/nodejs/node/issues/20369 Refs: https://github.com/nodejs/node/issues/25981 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-08perf_hooks: implement histogram based apiJames M Snell
Add a sampling-based event loop delay monitor. ```js const { monitorEventLoopDelay } = require('perf_hooks'); const h = monitorEventLoopDelay(); h.enable(); h.disable(); console.log(h.percentiles); console.log(h.min); console.log(h.max); console.log(h.mean); console.log(h.stddev); console.log(h.percentile(50)); ``` PR-URL: https://github.com/nodejs/node/pull/25378 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-08deps: update acorn to 6.0.7Michaël Zasso
acorn and acorn-walk are now published as two different packages. Put them both in subdirectories of `deps/acorn`. Adapt the REPL's recoverable error detection to use the new API for extending acorn parsers. PR-URL: https://github.com/nodejs/node/pull/25844 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-02-08assert: create internal/assert micro-moduleRich Trott
For use in built-in modules that could benefit from `assert()` without having to load the entire module (unless an AssertionError actually occurs): lib/internal/assert.js. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-08assert: refactor internal assert.jsRich Trott
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-02-05report: use libuv calls for OS and machine infocjihrig
PR-URL: https://github.com/nodejs/node/pull/25900 Fixes: https://github.com/nodejs/node/issues/25843 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-02lib: save primordials during bootstrap and use it in builtinsJoyee Cheung
This patches changes the `safe_globals` internal module into a script that gets run during bootstrap and saves JavaScript builtins (primordials) into an object that is available for all other builtin modules to access lexically later. PR-URL: https://github.com/nodejs/node/pull/25816 Refs: https://github.com/nodejs/node/issues/18795 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host>
2019-02-01src: move public C++ APIs into src/api/*.ccJoyee Cheung
This patch moves most of the public C++ APIs into src/api/*.cc so that it's easier to tell that we need to be careful about the compatibility of these code. Some APIs, like `node::LoadEnvironmet()`, `node::Start()` and `node::Init()` still stay in `node.cc` because they are still very specific to our use cases and do not work quite well yet for embedders anyway - we could not even manage to write cctest for them at the moment. PR-URL: https://github.com/nodejs/node/pull/25541 Reviewed-By: Gus Caplan <me@gus.host>
2019-02-01src: move v8_platform implementation into node_v8_platform-inl.hJoyee Cheung
So that the v8_platform global variable can be referenced in other files. PR-URL: https://github.com/nodejs/node/pull/25541 Reviewed-By: Gus Caplan <me@gus.host>
2019-01-30process: split execution into main scriptsJoyee Cheung
This patch splits the execution mode selection from the environment setup in `lib/internal/bootstrap/node.js`, and split the entry point of different execution mode into main scripts under `lib/internal/main`: - `check_syntax.js`: used when `-c`/`--check` which only checks the syntax of the input instead of executing it. - `eval_stdin.js`: used when `-e` is passed without value and stdin is not a TTY (e.g. something is piped). - `eval_string`: used when `-e` is passed along with a string argument - `inspect.js`: for `node inspect`/`node debug` - `print_bash_completion.js`: for `--completion-bash` - `print_help.js`: for `--help` - `prof_process.js`: for `--prof-process` - `repl.js`: for the REPL - `run_main_module.js`: used when a main module is passed - `run_third_party_main.js`: for the legacy `_third_party_main.js` support - `worker_thread.js`: for workers This makes the entry points easier to navigate and paves the way for customized v8 snapshots (that do not need to deserialize execution mode setup) and better embedder APIs. As an example, after this patch, for the most common case where Node.js executes a user module as an entry point, it essentially goes through: - `lib/internal/per_context.js` to setup the v8 Context (which is also run when setting up contexts for the `vm` module) - `lib/internal/bootstrap/loaders.js` to set up internal binding and builtin module loaders (that are separate from the loaders accessible in the user land). - `lib/internal/bootstrap/node.js`: to set up the rest of the environment, including various globals and the process object - `lib/internal/main/run_main_module.js`: which is selected from C++ to prepare execution of the user module. This patch also removes `NativeModuleLoader::CompileAndCall` and exposes `NativeModuleLoader::LookupAndCompile` directly so that we can handle syntax errors and runtime errors of bootstrap scripts differently. PR-URL: https://github.com/nodejs/node/pull/25667 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-28dns: use IDNA 2008 to encode non-ascii hostnamesBen Noordhuis
Before this commit, Node.js left it up to the system resolver or c-ares. Leaving it to the system resolver introduces platform differences because: * some support IDNA 2008 * some only IDNA 2003 (glibc until 2.28), and * some don't support IDNA at all (musl libc) c-ares doesn't support IDNA either although curl does, by virtue of linking against libidn2. Upgrading from libidn1 to libidn2 in order to get proper IDNA 2008 support was the fix for curl's CVE-2016-8625. libidn2 is not an option (incompatible license) but ICU has an IDNA API and we already use that in one place. For non-ICU builds, we fall back to the bundled punycode.js that also supports IDNA 2008. Fixes: https://github.com/nodejs-private/security/issues/97 Fixes: https://github.com/nodejs/node/issues/25558 PR-URL: https://github.com/nodejs/node/pull/25679 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2019-01-25src,test: fix JSON escaping in node-reportDenys Otrishko
Previously only simple escape sequences were handled (i.e. \n, \t, r etc.). This commit adds escaping of other control symbols in the range of 0x00 to 0x20. Also, this replaces multiple find+replace calls with a single pass replacer. PR-URL: https://github.com/nodejs/node/pull/25626 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-01-23build: remove AIX/ppc (32bit) dead codeRefael Ackermann
* also dedup OS400 detection PR-URL: https://github.com/nodejs/node/pull/25523 Refs: https://github.com/nodejs/node/pull/25447/files/36839defcfaf7c46435e16fb1f0da006f3ebe8ac#r247378894 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
2019-01-23console: refactor inspector console extension installationJoyee Cheung
- Instead of creating the console extensions eagerly during bootstrap and storing them on an object, wrap the code into a function to be called during `installAdditionalCommandLineAPI` only when the extensions are actually needed, which may not even happen if the user do not use the console in an inspector session, and does not need to happen during bootstrap unconditionally. - Simplify the console methods wrapping and move the `consoleFromVM` storage to `internal/util/inspector.js` PR-URL: https://github.com/nodejs/node/pull/25450 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-01-20test: switch to native v8 coverageBenjamin Coe
PR-URL: https://github.com/nodejs/node/pull/25157 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-01-18src: merge into coreGireesh Punathil
Make node-report part of core runtime because: 1. When enabled, node-report significantly helps root cause various types of problems, including support issues sent to the various repos of the Node.js organization. 2. The requirement of explicitly adding the dependency to node-report in user applications often represents a blocker to adoption. Major deviation from the module version of the node-report is that the report is generated in JSON format, as opposed to human readable text. No new functionalities have been added, changes that are required for melding it as a built-in capability has been affected on the module version of node-report (https://github.com/nodejs/node-report) Co-authored-by: Bidisha Pyne <bidipyne@in.ibm.com> Co-authored-by: Howard Hellyer <hhellyer@uk.ibm.com> Co-authored-by: Jeremiah Senkpiel <fishrock123@rocketmail.com> Co-authored-by: Julian Alimin <dmastag@yahoo.com> Co-authored-by: Lakshmi Swetha Gopireddy <lakshmigopireddy@in.ibm.com> Co-authored-by: Manusaporn Treerungroj <m.treerungroj@gmail.com> Co-authored-by: Michael Dawson <michael_dawson@ca.ibm.com> Co-authored-by: Richard Chamberlain <richard_chamberlain@uk.ibm.com> Co-authored-by: Richard Lau <riclau@uk.ibm.com> Co-authored-by: Sam Roberts <vieuxtech@gmail.com> Co-authored-by: Vipin Menon <vipinmv1@in.ibm.com> PR-URL: https://github.com/nodejs/node/pull/22712 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-01-17policy: manifest with subresource integrity checksBradley Farias
This enables code loaded via the module system to be checked for integrity to ensure the code loaded matches expectations. PR-URL: https://github.com/nodejs/node/pull/23834 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-01-16process: refactor coverage setup during bootstrapJoyee Cheung
- Renamed `internal/process/write-coverage.js` to `internal/coverage-gen/with_instrumentation.js`, `internal/process/coverage.js` to `internal/coverage-gen/with_profiler.js` to distinguish the two better and added comments. - Separate the coverage directory setup and the connection setup, moves the directory setup into `node.js` and closer to the exit hooks because that's where it's used. - Moves the `process.reallyExit` overwrite and `process.on('exit')` hooks setup into bootstrap/node.js for clarity, and move them to a later stage of bootstrap since they do not have to happen that early. PR-URL: https://github.com/nodejs/node/pull/25398 Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-01-11process: move C++ process events into node_process_events.ccJoyee Cheung
Move the C++ `process.emit` and `process.emitWarning` methods from `node.cc` into into `node_process_events.cc`, and reuse the implementation in other places that need to do `process.emit` in C++. PR-URL: https://github.com/nodejs/node/pull/25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-11src: declare process-related C++ methods in node_process.hJoyee Cheung
Instead of in node_internals.h. Also move process property accessors that are not reused into node_process_object.cc and make them static. PR-URL: https://github.com/nodejs/node/pull/25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-11src: move process object creation into node_process_object.ccJoyee Cheung
Changes `SetupProcessObject` to `CreateProessObject` which creates the process object from scratch and return it to `Environment::Start` to be stored in the Environment object. PR-URL: https://github.com/nodejs/node/pull/25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-05zlib: add brotli supportAnna Henningsen
Refs: https://github.com/nodejs/node/pull/20458 Co-authored-by: Hackzzila <admin@hackzzila.com> PR-URL: https://github.com/nodejs/node/pull/24938 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-01-03lib,test: remove lib/internal/test/unicode.jsRich Trott
Remove lib/internal/test/unicode.js and associated test. When we added the file and test, only comments in lib had non-ASCII characters. Now, lib/internal/cli_table.js has non-ASCII characters. Tests that exercise the `console.table()` therefore fulfill the need to test non-ASCII characters in built-in modules. PR-URL: https://github.com/nodejs/node/pull/25298 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-01-02build: fix Windows shared lib buildRichard Lau
PR-URL: https://github.com/nodejs/node/pull/25166 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-12-31process: split worker IO into internal/worker/io.jsJoyee Cheung
- Move `setupProcessStdio` which contains write access to the process object into `bootstrap/node.js` - Move `MessagePort`, `MessageChannel`, `ReadableWorkerStdio`, and `WritableWorkerStdio` into `internal/worker/io.js` - Move more worker-specific bootstrap code into `internal/process/worker_thread_only` from `setupChild` in `internal/worker.js`, and move the `process._fatalException` overwrite into `bootstrap/node.js` for clarity. PR-URL: https://github.com/nodejs/node/pull/25199 Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-31process: move eval and exception bootstrap ito process/execution.jsJoyee Cheung
This patch: - Moves `tryGetCwd`, `evalScript` and `fatalException` from `bootstrap/node.js` into `process/execution.js` so that they do have to be passed into the worker thread setup function, instead the worker code can require them when necessary. - Moves `setUncaughtExceptionCaptureCallback` and `hasUncaughtExceptionCaptureCallback` along with the two global state `exceptionHandlerState` and `shouldAbortOnUncaughtToggle` info `process.execution.js` as those are only used by the fatalException and these two accessors as one self-contained unit. PR-URL: https://github.com/nodejs/node/pull/25199 Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-28src: use consistent names for JSStreamSam Roberts
Its confusing to call a js class with a handle a "Wrap", usually it's the C++ handle that is called a Wrap (tcp_wrap, tls_wrap, ...). Its derived from Socket, and makes a JS stream look like a Socket, so call it that. Also, remove use of lib/_stream_wrap.js so it can be deprecated some time. PR-URL: https://github.com/nodejs/node/pull/25153 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-12-24crypto: add key object APITobias Nießen
This commit makes multiple important changes: 1. A new key object API is introduced. The KeyObject class itself is not exposed to users, instead, several new APIs can be used to construct key objects: createSecretKey, createPrivateKey and createPublicKey. The new API also allows to convert between different key formats, and even though the API itself is not compatible to the WebCrypto standard in any way, it makes interoperability much simpler. 2. Key objects can be used instead of the raw key material in all relevant crypto APIs. 3. The handling of asymmetric keys has been unified and greatly improved. Node.js now fully supports both PEM-encoded and DER-encoded public and private keys. 4. Conversions between buffers and strings have been moved to native code for sensitive data such as symmetric keys due to security considerations such as zeroing temporary buffers. 5. For compatibility with older versions of the crypto API, this change allows to specify Buffers and strings as the "passphrase" option when reading or writing an encoded key. Note that this can result in unexpected behavior if the password contains a null byte. PR-URL: https://github.com/nodejs/node/pull/24234 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-24src: move process.nextTick and promise setup into node_task_queue.ccJoyee Cheung
This patch: - Moves the process.nextTick and promise setup C++ code into node_task_queue.cc which is exposed as `internalBinding('task_queue')` - Makes `lib/internal/process/promises.js` and `lib/internal/process/next_tick.js` as side-effect-free as possible - Removes the bootstrapper object being passed into `bootstrap/node.js`, let `next_tick.js` and `promises.js` load whatever they need from `internalBinding('task_queue')` instead. - Rename `process._tickCallback` to `runNextTicks` internally for clarity but still expose it as `process._tickCallback`. PR-URL: https://github.com/nodejs/node/pull/25163 Refs: https://github.com/nodejs/node/issues/24961 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-12-24src: move symbols binding into node_symbols.ccJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/25163 Refs: https://github.com/nodejs/node/issues/24961 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
2018-12-19process: move POSIX credential accessors into node_credentials.ccJoyee Cheung
Expose the POSIX credential accessors through `internalBinding('credentials')` instead of setting them on the process or bootstrapper object from C++ directly. Also moves `SafeGetEnv` from `internalBinding('util')` to `internalBinding('credentials')` since it's closely related to the credentials. In the JS land, instead of wrapping the bindings then writing to the process object directly in main_thread_only.js, return the wrapped functions back to bootstrap/node.js where they get written to the process object conditionally for clarity. Refs: https://github.com/nodejs/node/issues/24961 PR-URL: https://github.com/nodejs/node/pull/25066 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>