Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 0ebf6d5

Browse files
Allen Yongshuang Wangfs-eire
Allen Yongshuang Wang
authored andcommitted
fix build/test break introduced by v8 breaking change from node v10.x (#224)
* because of v8 breaking change introduced from node v10.x, 1.disable test cases of builtin-type-transportation; 2.fix build break due * make v8 version control more accurate * Update lock-wrap.cpp
1 parent 20f632d commit 0ebf6d5

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

inc/napa/v8-helpers/json.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ namespace v8_helpers {
2727
}
2828

2929
/// <summary> JSON.parse </summary>
30+
#if (V8_MINOR_VERSION >= 6)
31+
inline v8::MaybeLocal<v8::Value> Parse(v8::Local<v8::Context> context, const v8::Local<v8::String>& jsonString) {
32+
return v8::JSON::Parse(context, jsonString);
33+
}
34+
#else
3035
inline v8::MaybeLocal<v8::Value> Parse(const v8::Local<v8::String>& jsonString) {
3136
return v8::JSON::Parse(jsonString);
3237
}
38+
#endif
3339
}
3440
}
3541
}

src/module/core-modules/napa/lock-wrap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void LockWrap::GuardSyncCallback(const v8::FunctionCallbackInfo<v8::Value>& args
4444
auto holder = args.Holder();
4545
auto thisObject = NAPA_OBJECTWRAP::Unwrap<LockWrap>(args.Holder());
4646

47-
v8::TryCatch tryCatch;
47+
v8::TryCatch tryCatch(isolate);
4848
try {
4949
auto mutex = thisObject->Get<std::mutex>();
5050
std::lock_guard<std::mutex> guard(*mutex);

src/module/loader/javascript-module-loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ bool JavascriptModuleLoader::TryGet(const std::string& path, v8::Local<v8::Value
4646
_moduleCache.Upsert(path, module_loader_helpers::ExportModule(moduleContext->Global(), nullptr));
4747
}
4848

49-
v8::TryCatch tryCatch;
49+
v8::TryCatch tryCatch(isolate);
5050
{
5151
auto origin = v8::ScriptOrigin(v8_helpers::MakeV8String(isolate, path));
5252
auto script = v8::Script::Compile(source, &origin);

test/transport-test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ describe('napajs/transport', () => {
341341

342342
let builtinTestGroup = 'Transport built-in objects';
343343
let nodeVersionMajor = parseInt(process.versions.node.split('.')[0]);
344-
if (nodeVersionMajor >= 9) {
344+
345+
// TODO #223: Fix transportation support for builtin types, which is broken due to breaking changes of v8 introduced from node v10.0.0.
346+
if (nodeVersionMajor == 9) {
345347
describe(builtinTestGroup, transportBuiltinObjects);
346348
} else {
347349
describe.skip(builtinTestGroup, transportBuiltinObjects);
348-
require('npmlog').warn(builtinTestGroup, 'This test group is skipped since it requires node v9.0.0 or above.');
350+
require('npmlog').warn(builtinTestGroup, 'This test group is skipped since it requires node v9.0.0 .');
349351
}
350352
});

0 commit comments

Comments
 (0)