0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib
Joyee Cheung 804138093a src: use NativeModuleLoader to compile per_context.js
This patch introduces a NativeModuleLoader::CompileAndCall that
can run a JS script under `lib/` as a function called
with a null receiver and arguments specified from the C++ layer.
Since all our bootstrappers are wrapped in functions in the
source to avoid leaking variables into the global scope anyway,
this allows us to remove that extra indentation in the JS source code.

As a start we move the compilation and execution of per_context.js
to NativeModuleLoader::CompileAndCall(). This patch also changes the
return value of NativeModuleLoader::LookupAndCompile() to a MaybeLocal
since the caller has to take care of the result being empty
anyway.

This patch reverts the previous design of having the
NativeModuleLoader::Compile() method magically know about the
parameters of the function - until we have tooling
in-place to guess the parameter names in the source with some
annotation, it's more readable to allow the caller to specify
the parameters along with the arguments values.

PR-URL: https://github.com/nodejs/node/pull/24660
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2018-11-28 11:05:28 -08:00
..
internal src: use NativeModuleLoader to compile per_context.js 2018-11-28 11:05:28 -08:00
_http_agent.js async_hooks: add missing async_hooks destroys in AsyncReset 2018-10-10 08:45:56 +02:00
_http_client.js lib: change anonymous function to arrow function 2018-11-26 17:36:35 +05:30
_http_common.js http: reduce duplicated code for cleaning parser 2018-10-12 14:53:36 -07:00
_http_incoming.js
_http_outgoing.js http: change DEP0066 to a runtime deprecation 2018-11-22 04:45:27 -08:00
_http_server.js http,https: protect against slow headers attack 2018-11-28 11:36:34 +11:00
_stream_duplex.js
_stream_passthrough.js
_stream_readable.js stream: correctly pause and resume after once('readable') 2018-11-21 12:16:47 +01:00
_stream_transform.js
_stream_wrap.js
_stream_writable.js stream: change comment on duplex stream options 2018-11-15 11:48:27 -08:00
_tls_common.js tls: add min/max protocol version options 2018-11-22 09:14:58 -08:00
_tls_wrap.js tls: add min/max protocol version options 2018-11-22 09:14:58 -08:00
.eslintrc.yaml bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
assert.js assert: remove unused catch bindings 2018-11-06 10:58:42 -05:00
async_hooks.js
buffer.js buffer: move process.binding('buffer') to internalBinding 2018-10-15 19:01:20 +08:00
child_process.js Revert "child_process: change windowsHide default to true" 2018-11-13 14:38:23 -08:00
cluster.js
console.js console: lazy load process.stderr and process.stdout 2018-11-29 01:52:54 +08:00
constants.js src,lib: move natives and constants to internalBinding() 2018-10-21 03:17:12 +02:00
crypto.js crypto: allow monkey patching of pseudoRandomBytes 2018-11-24 18:26:17 -08:00
dgram.js net,dgram: add ipv6Only option for net and dgram 2018-11-22 21:45:08 +08:00
dns.js dns: fix inconsistent (hostname vs host) 2018-10-20 21:56:28 -07:00
domain.js async_hooks: remove promise object from resource 2018-10-15 19:40:51 +01:00
events.js events: extract listener check as a function 2018-11-19 14:45:52 +01:00
fs.js fs: make process.binding('fs') internal 2018-11-16 21:56:29 +09:00
http2.js http2: order declarations in http2.js 2018-11-20 10:42:31 -08:00
http.js
https.js http,https: protect against slow headers attack 2018-11-28 11:36:34 +11:00
inspector.js inspector: enable Inspector JS API in workers 2018-09-17 09:49:53 -07:00
module.js
net.js net: emit "write after end" errors in the next tick 2018-11-24 23:46:02 -08:00
os.js os: do not call into JS to push values to an array in GetCPUInfo 2018-11-14 02:59:45 +08:00
path.js lib: remove useless cwd in posix.resolve 2018-10-30 05:23:52 +01:00
perf_hooks.js bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
process.js
punycode.js
querystring.js lib: move encodeStr function to internal for reusable 2018-11-20 18:24:02 -08:00
readline.js readline: add support for async iteration 2018-11-20 15:41:16 -08:00
repl.js repl: handle buffered string logic on finish 2018-11-19 10:47:41 -08:00
stream.js tools: lint for unused catch bindings 2018-11-06 10:59:27 -05:00
string_decoder.js bootstrapper: move internalBinding to NativeModule 2018-10-04 11:55:34 +02:00
sys.js
timers.js timers: run nextTicks after each immediate and timer 2018-10-17 20:38:07 -07:00
tls.js tls: add min/max protocol version options 2018-11-22 09:14:58 -08:00
trace_events.js trace_events: forbid tracing modifications from worker threads 2018-10-24 11:20:35 -03:00
tty.js Revert "tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLE" 2018-10-04 09:20:21 -07:00
url.js url: avoid hostname spoofing w/ javascript protocol 2018-11-28 11:36:34 +11:00
util.js util: treat format arguments equally 2018-10-17 19:56:43 +02:00
v8.js buffer: move process.binding('buffer') to internalBinding 2018-10-15 19:01:20 +08:00
vm.js src: cache the result of GetOptions() in JS land 2018-11-07 20:40:38 -08:00
worker_threads.js
zlib.js lib: improved conditional check in zlib 2018-11-14 20:40:36 -08:00