Skip to content

Commit 005cc1d

Browse files
author
Gabriel Schulhof
committed
Fix test errors
* Implement node::MakeCallback between 8.0.0 and 8.6.0 to fix unresolved symbol * Fix error message expectation (was: "Invalid pointer", is: "Invalid argument") * Add -fvisibility=hidden to the compilation of sources of node_api.a so as to avoid conflicts with Node.js symbols Fixes: #142 Fixes: #282
1 parent 25c03ad commit 005cc1d

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/node_api.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'defines': [
1414
'EXTERNAL_NAPI',
1515
],
16+
'cflags_cc': ['-fvisibility=hidden']
1617
}
1718
]
1819
}

src/node_internals.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <unistd.h> // getpid
1111
#endif
1212

13-
#if NODE_MAJOR_VERSION < 8
13+
#if NODE_MAJOR_VERSION < 8 || NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION < 6
1414
CallbackScope::CallbackScope(void *work) {
1515
}
1616
#endif // NODE_MAJOR_VERSION < 8
@@ -30,6 +30,15 @@ void EmitAsyncDestroy(v8::Isolate* isolate,
3030
async_context asyncContext) {
3131
}
3232

33+
AsyncResource::AsyncResource(v8::Isolate* isolate,
34+
v8::Local<v8::Object> object,
35+
const char *name) {
36+
}
37+
38+
#endif // NODE_MAJOR_VERSION < 8
39+
40+
#if NODE_MAJOR_VERSION < 8 || NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION < 6
41+
3342
v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
3443
v8::Local<v8::Object> recv,
3544
v8::Local<v8::Function> callback,
@@ -39,12 +48,7 @@ v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
3948
return node::MakeCallback(isolate, recv, callback, argc, argv);
4049
}
4150

42-
AsyncResource::AsyncResource(v8::Isolate* isolate,
43-
v8::Local<v8::Object> object,
44-
const char *name) {
45-
}
46-
47-
#endif // NODE_MAJOR_VERSION < 8
51+
#endif // NODE_MAJOR_VERSION < 8 || NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION < 6
4852

4953
static void PrintErrorString(const char* format, ...) {
5054
va_list ap;

test/function.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function test(binding) {
4646

4747
assert.throws(() => {
4848
binding.function.callWithInvalidReceiver();
49-
}, /Invalid pointer/);
49+
}, /Invalid (pointer passed as )?argument/);
5050

5151
obj = binding.function.callConstructorWithArgs(testConstructor, 5, 6, 7);
5252
assert(obj instanceof testConstructor);

test/typedarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ function test(binding) {
6666

6767
assert.throws(() => {
6868
binding.typedarray.createInvalidTypedArray();
69-
}, /Invalid pointer/);
69+
}, /Invalid (pointer passed as )?argument/);
7070
}

0 commit comments

Comments
 (0)