summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-01-19 15:42:59 -0500
committerAnatoli Papirovski <apapirovski@mac.com>2018-01-29 11:37:29 -0500
commiteeede3b19c8bdb78605764eec75bea327c9014ff (patch)
treef57709e12c4e7e9562951bb07042f0023925a441 /test
parente4743ab61929bcccc729165e74eb6d6b3ef25135 (diff)
downloadandroid-node-v8-eeede3b19c8bdb78605764eec75bea327c9014ff.tar.gz
android-node-v8-eeede3b19c8bdb78605764eec75bea327c9014ff.tar.bz2
android-node-v8-eeede3b19c8bdb78605764eec75bea327c9014ff.zip
domain: further abstract usage in C++
Move the majority of C++ domain-related code into JS land by introducing a top level domain callback which handles entering & exiting the domain. Move the rest of the domain necessities into their own file that creates an internal binding, to avoid exposing domain-related code on the process object. Modify an existing test slightly to better test domain-related code. PR-URL: https://github.com/nodejs/node/pull/18291 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/addons/repl-domain-abort/binding.cc16
-rw-r--r--test/addons/repl-domain-abort/test.js3
-rw-r--r--test/cctest/node_module_reg.cc1
3 files changed, 14 insertions, 6 deletions
diff --git a/test/addons/repl-domain-abort/binding.cc b/test/addons/repl-domain-abort/binding.cc
index 1b4dbfa84e..d2f7560048 100644
--- a/test/addons/repl-domain-abort/binding.cc
+++ b/test/addons/repl-domain-abort/binding.cc
@@ -22,6 +22,7 @@
#include <node.h>
#include <v8.h>
+using v8::Boolean;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::Local;
@@ -31,11 +32,16 @@ using v8::Value;
void Method(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
- node::MakeCallback(isolate,
- isolate->GetCurrentContext()->Global(),
- args[0].As<Function>(),
- 0,
- nullptr);
+ Local<Value> params[] = {
+ Boolean::New(isolate, true),
+ Boolean::New(isolate, false)
+ };
+ Local<Value> ret = node::MakeCallback(isolate,
+ isolate->GetCurrentContext()->Global(),
+ args[0].As<Function>(),
+ 2,
+ params);
+ assert(ret->IsTrue());
}
void init(Local<Object> exports) {
diff --git a/test/addons/repl-domain-abort/test.js b/test/addons/repl-domain-abort/test.js
index 1d6116159c..2049fe6e6a 100644
--- a/test/addons/repl-domain-abort/test.js
+++ b/test/addons/repl-domain-abort/test.js
@@ -40,7 +40,8 @@ const lines = [
// This line shouldn't cause an assertion error.
`require('${buildPath}')` +
// Log output to double check callback ran.
- '.method(function() { console.log(\'cb_ran\'); });',
+ '.method(function(v1, v2) {' +
+ 'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
];
const dInput = new stream.Readable();
diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc
index a0736d2cc3..bd4f20bc9f 100644
--- a/test/cctest/node_module_reg.cc
+++ b/test/cctest/node_module_reg.cc
@@ -5,6 +5,7 @@
void _register_cares_wrap() {}
void _register_config() {}
void _register_contextify() {}
+void _register_domain() {}
void _register_fs() {}
void _register_fs_event_wrap() {}
void _register_http2() {}