Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
env:
global:
- NODE_VERSION=10
- NDK_VERSION=r19c
- NDK_VERSION=r20
- DATE=$(date +%Y-%m-%d)
- PACKAGE_VERSION=next-$DATE-$TRAVIS_BUILD_NUMBER
- EMULATOR_API_LEVEL=21
Expand Down
2 changes: 1 addition & 1 deletion build-artifacts/project-template-gradle/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"v8Version": "7.5.288.22",
"v8Version": "7.6.303.28",
"mksnapshotParams": "--profile_deserialization --turbo_instruction_scheduling --target_os=android --no-native-code-counters"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"version": "5.1.1",
"android": "3.4.2"
},
"android_ndk_version": "19c"
"android_ndk_version": "20"
}
Binary file modified test-app/app/src/main/assets/app/modules/libCalc-arm.so
Binary file not shown.
Binary file modified test-app/app/src/main/assets/app/modules/libCalc-arm64.so
Binary file not shown.
Binary file modified test-app/app/src/main/assets/app/modules/libCalc-x86.so
Binary file not shown.
5 changes: 4 additions & 1 deletion test-app/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif (CCACHE_FOUND AND (USE_CCACHE))
# "-DANDROID_STL=c++_static" is just not enough for clang++ to find some libraries in the ndk
MESSAGE(STATUS "## ANDROID_NDK_ROOT: " ${ANDROID_NDK_ROOT})

set(COMMON_CMAKE_ARGUMENTS "-std=c++11 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -D_LIBCPP_ABI_VERSION=Cr -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_ABI_UNSTABLE")
set(COMMON_CMAKE_ARGUMENTS "-nostdinc++ -std=c++14 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -D_LIBCPP_ABI_VERSION=Cr -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_ABI_UNSTABLE")

# AOSP has switched to using LLD by default and the NDK will use it by default in the next release.
# BFD and Gold will be removed once LLD has been through a release cycle with no major unresolved issues (estimated r21)
Expand Down Expand Up @@ -89,6 +89,7 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
src/main/cpp/v8_inspector/src/inspector/v8-overlay-agent-impl.cpp
src/main/cpp/v8_inspector/src/inspector/v8-page-agent-impl.cpp

src/main/cpp/v8_inspector/third_party/inspector_protocol/encoding/encoding.cc
src/main/cpp/v8_inspector/src/inspector/custom-preview.cc
src/main/cpp/v8_inspector/src/inspector/injected-script.cc
src/main/cpp/v8_inspector/src/inspector/inspected-context.cc
Expand All @@ -104,12 +105,14 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
src/main/cpp/v8_inspector/src/inspector/v8-debugger-script.cc
src/main/cpp/v8_inspector/src/inspector/v8-heap-profiler-agent-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-inspector-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-inspector-protocol-encoding.cc
src/main/cpp/v8_inspector/src/inspector/v8-inspector-session-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-profiler-agent-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-regex.cc
src/main/cpp/v8_inspector/src/inspector/v8-runtime-agent-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-schema-agent-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-stack-trace-impl.cc
src/main/cpp/v8_inspector/src/inspector/v8-string-conversions.cc
src/main/cpp/v8_inspector/src/inspector/v8-value-utils.cc
src/main/cpp/v8_inspector/src/inspector/value-mirror.cc
src/main/cpp/v8_inspector/src/inspector/wasm-translation.cc
Expand Down
9 changes: 5 additions & 4 deletions test-app/runtime/src/main/cpp/ArgConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ int64_t ArgConverter::ConvertToJavaLong(Isolate* isolate, const Local<Value>& va

assert(!valueProp.IsEmpty());

string num = ConvertToString(valueProp->ToString(isolate));
Local<Context> context = isolate->GetCurrentContext();
string num = ConvertToString(valueProp->ToString(context).ToLocalChecked());

int64_t longValue = atoll(num.c_str());

Expand Down Expand Up @@ -268,7 +269,7 @@ jstring ArgConverter::ConvertToJavaString(const Local<Value>& value) {
}

Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const jchar* data, int length) {
return String::NewFromTwoByte(isolate, (const uint16_t*) data, String::kNormalString, length);
return String::NewFromTwoByte(isolate, (const uint16_t*) data, NewStringType::kNormal, length).ToLocalChecked();
}

Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const string& s) {
Expand All @@ -277,11 +278,11 @@ Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const string& s)
}

Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const char* data, int length) {
return String::NewFromUtf8(isolate, (const char*) data, String::kNormalString, length);
return String::NewFromUtf8(isolate, (const char*) data, NewStringType::kNormal, length).ToLocalChecked();
}

Local<String> ArgConverter::ConvertToV8UTF16String(Isolate* isolate, const u16string& utf16string) {
return String::NewFromTwoByte(isolate, ((const uint16_t*) utf16string.data()));
return String::NewFromTwoByte(isolate, ((const uint16_t*) utf16string.data())).ToLocalChecked();
}

std::map<Isolate*, ArgConverter::TypeLongOperationsCache*> ArgConverter::s_type_long_operations_cache;
4 changes: 2 additions & 2 deletions test-app/runtime/src/main/cpp/ArrayElementAccessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ void ArrayElementAccessor::SetArrayElement(Isolate* isolate, const Local<Object>
jboolean isCopy = false;

if (elementSignature == "Z") { //bool
jboolean boolElementValue = (jboolean) value->BooleanValue(context).ToChecked();
jboolean boolElementValue = (jboolean) value->BooleanValue(isolate);
jbooleanArray boolArr = static_cast<jbooleanArray>(arr);
env.SetBooleanArrayRegion(boolArr, index, 1, &boolElementValue);
} else if (elementSignature == "B") { //byte
jbyte byteElementValue = (jbyte) value->Int32Value(context).ToChecked();
jbyteArray byteArr = static_cast<jbyteArray>(arr);
env.SetByteArrayRegion(byteArr, index, 1, &byteElementValue);
} else if (elementSignature == "C") { //char
String::Utf8Value utf8(isolate, value->ToString(isolate));
String::Utf8Value utf8(isolate, value->ToString(context).ToLocalChecked());
JniLocalRef s(env.NewString((jchar*) *utf8, 1));
const char* singleChar = env.GetStringUTFChars(s, &isCopy);
jchar charElementValue = *singleChar;
Expand Down
22 changes: 12 additions & 10 deletions test-app/runtime/src/main/cpp/CallbackHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,11 @@ CallbackHandlers::GetImplementedInterfaces(JEnv& env, const Local<Object>& imple
v8::String::Utf8Value propName(isolate, name);
std::string arrNameC = std::string(*propName);
if (arrNameC == "interfaces") {
auto interfacesArr = prop->ToObject(isolate);
auto interfacesArr = prop->ToObject(context).ToLocalChecked();

auto context = isolate->GetCurrentContext();
int length = interfacesArr->Get(
v8::String::NewFromUtf8(isolate, "length"))->ToObject(isolate)->Uint32Value(
v8::String::NewFromUtf8(isolate, "length").ToLocalChecked())->ToObject(context).ToLocalChecked()->Uint32Value(
context).ToChecked();

if (length > 0) {
Expand Down Expand Up @@ -651,7 +651,8 @@ void CallbackHandlers::LogMethodCallback(const v8::FunctionCallbackInfo<v8::Valu
try {
if ((args.Length() > 0) && args[0]->IsString()) {
auto isolate = args.GetIsolate();
String::Utf8Value message(isolate, args[0]->ToString(isolate));
auto context = isolate->GetCurrentContext();
String::Utf8Value message(isolate, args[0]->ToString(context).ToLocalChecked());
DEBUG_WRITE("%s", *message);
}
} catch (NativeScriptException& e) {
Expand Down Expand Up @@ -937,7 +938,8 @@ void CallbackHandlers::NewThreadCallback(const v8::FunctionCallbackInfo<v8::Valu
currentDir = currentDir.substr(fileSchema.length());
}

auto workerPath = ArgConverter::ConvertToString(args[0]->ToString(isolate));
auto context = isolate->GetCurrentContext();
auto workerPath = ArgConverter::ConvertToString(args[0]->ToString(context).ToLocalChecked());

// Will throw if path is invalid or doesn't exist
ModuleInternal::CheckFileExists(isolate, workerPath, currentDir);
Expand Down Expand Up @@ -1202,7 +1204,7 @@ CallbackHandlers::WorkerObjectTerminateCallback(const v8::FunctionCallbackInfo<v
V8GetPrivateValue(isolate, thiz, ArgConverter::ConvertToV8String(isolate, "isTerminated"),
isTerminated);

if (!isTerminated.IsEmpty() && isTerminated->BooleanValue(context).ToChecked()) {
if (!isTerminated.IsEmpty() && isTerminated->BooleanValue(isolate)) {
DEBUG_WRITE(
"Main: WorkerObjectTerminateCallback - Worker(id=%d)'s terminate has already been called.",
id);
Expand Down Expand Up @@ -1247,7 +1249,7 @@ void CallbackHandlers::WorkerGlobalCloseCallback(const v8::FunctionCallbackInfo<
auto isTerminating = globalObject->Get(
ArgConverter::ConvertToV8String(isolate, "isTerminating"));

if (!isTerminating.IsEmpty() && isTerminating->BooleanValue(context).ToChecked()) {
if (!isTerminating.IsEmpty() && isTerminating->BooleanValue(isolate)) {
DEBUG_WRITE("WORKER: WorkerThreadCloseCallback - Worker is currently terminating...");
return;
}
Expand Down Expand Up @@ -1317,7 +1319,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
func->Call(context, Undefined(isolate), 1, args1).ToLocal(&result);

// return 'true'-like value, don't bubble up to main Worker.onerror
if (!result.IsEmpty() && result->BooleanValue(context).ToChecked()) {
if (!result.IsEmpty() && result->BooleanValue(isolate)) {
// Do nothing, exception has been handled
return;
}
Expand All @@ -1332,7 +1334,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
if (!outStackTrace.IsEmpty()) {
stackTrace = outStackTrace->ToDetailString(context).FromMaybe(Local<String>());
}
auto source = innerTc.Message()->GetScriptResourceName()->ToString(isolate);
auto source = innerTc.Message()->GetScriptResourceName()->ToString(context).ToLocalChecked();

auto runtime = Runtime::GetRuntime(isolate);
runtime->PassUncaughtExceptionFromWorkerToMainHandler(msg, stackTrace, source, lno);
Expand All @@ -1341,7 +1343,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
// throw so that it may bubble up to main
auto lno = tc.Message()->GetLineNumber(context).ToChecked();
auto msg = tc.Message()->Get();
auto source = tc.Message()->GetScriptResourceName()->ToString(isolate);
auto source = tc.Message()->GetScriptResourceName()->ToString(context).ToLocalChecked();
Local<Value> outStackTrace = tc.StackTrace(context).FromMaybe(Local<Value>());
Local<String> stackTrace;
if (!outStackTrace.IsEmpty()) {
Expand Down Expand Up @@ -1414,7 +1416,7 @@ CallbackHandlers::CallWorkerObjectOnErrorHandle(Isolate* isolate, jint workerId,
// Handle exceptions thrown in onmessage with the worker.onerror handler, if present
Local<Value> result;
func->Call(context, Undefined(isolate), 1, args1).ToLocal(&result);
if (!result.IsEmpty() && result->BooleanValue(context).ToChecked()) {
if (!result.IsEmpty() && result->BooleanValue(isolate)) {
// Do nothing, exception is handled and does not need to be raised to application level
return;
}
Expand Down
28 changes: 14 additions & 14 deletions test-app/runtime/src/main/cpp/DOMDomainCallbackHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ void DOMDomainCallbackHandlers::ChildNodeInsertedCallback(const v8::FunctionCall
throw NativeScriptException("Calling ChildNodeInserted with invalid arguments. Required params: parentId: number, lastId: number, node: JSON String");
}

auto parentId = args[0]->ToNumber(isolate);
auto lastId = args[1]->ToNumber(isolate);
auto node = args[2]->ToString(isolate);
auto context = isolate->GetCurrentContext();
auto parentId = args[0]->ToNumber(context).ToLocalChecked();
auto lastId = args[1]->ToNumber(context).ToLocalChecked();
auto node = args[2]->ToString(context).ToLocalChecked();

auto resultString = V8DOMAgentImpl::AddBackendNodeIdProperty(isolate, node);
auto resultUtf16Data = resultString.data();
Expand All @@ -54,7 +55,6 @@ void DOMDomainCallbackHandlers::ChildNodeInsertedCallback(const v8::FunctionCall
return;
}

auto context = isolate->GetCurrentContext();
domAgentInstance->m_frontend.childNodeInserted(parentId->Int32Value(context).ToChecked(), lastId->Int32Value(context).ToChecked(), std::move(domNode));
} catch (NativeScriptException& e) {
e.ReThrowToV8();
Expand Down Expand Up @@ -85,10 +85,10 @@ void DOMDomainCallbackHandlers::ChildNodeRemovedCallback(const v8::FunctionCallb
throw NativeScriptException("Calling ChildNodeRemoved with invalid arguments. Required params: parentId: number, nodeId: number");
}

auto parentId = args[0]->ToNumber(isolate);
auto nodeId = args[1]->ToNumber(isolate);

auto context = isolate->GetCurrentContext();
auto parentId = args[0]->ToNumber(context).ToLocalChecked();
auto nodeId = args[1]->ToNumber(context).ToLocalChecked();

domAgentInstance->m_frontend.childNodeRemoved(parentId->Int32Value(context).ToChecked(), nodeId->Int32Value(context).ToChecked());
} catch (NativeScriptException& e) {
e.ReThrowToV8();
Expand Down Expand Up @@ -119,11 +119,11 @@ void DOMDomainCallbackHandlers::AttributeModifiedCallback(const v8::FunctionCall
throw NativeScriptException("Calling AttributeModified with invalid arguments. Required params: nodeId: number, name: string, value: string");
}

auto nodeId = args[0]->ToNumber(isolate);
auto attributeName = args[1]->ToString(isolate);
auto attributeValue = args[2]->ToString(isolate);

auto context = isolate->GetCurrentContext();
auto nodeId = args[0]->ToNumber(context).ToLocalChecked();
auto attributeName = args[1]->ToString(context).ToLocalChecked();
auto attributeValue = args[2]->ToString(context).ToLocalChecked();

domAgentInstance->m_frontend.attributeModified(nodeId->Int32Value(context).ToChecked(),
v8_inspector::toProtocolString(isolate, attributeName),
v8_inspector::toProtocolString(isolate, attributeValue));
Expand Down Expand Up @@ -155,10 +155,10 @@ void DOMDomainCallbackHandlers::AttributeRemovedCallback(const v8::FunctionCallb
throw NativeScriptException("Calling AttributeRemoved with invalid arguments. Required params: nodeId: number, name: string");
}

auto nodeId = args[0]->ToNumber(isolate);
auto attributeName = args[1]->ToString(isolate);

auto context = isolate->GetCurrentContext();
auto nodeId = args[0]->ToNumber(context).ToLocalChecked();
auto attributeName = args[1]->ToString(context).ToLocalChecked();

domAgentInstance->m_frontend.attributeRemoved(nodeId->Int32Value(context).ToChecked(),
v8_inspector::toProtocolString(isolate, attributeName));
} catch (NativeScriptException& e) {
Expand Down
9 changes: 5 additions & 4 deletions test-app/runtime/src/main/cpp/FieldAccessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
case 'Z': { //bool
//TODO: validate value is a boolean before calling
if (isStatic) {
env.SetStaticBooleanField(clazz, fieldId, value->BooleanValue(context).ToChecked());
env.SetStaticBooleanField(clazz, fieldId, value->BooleanValue(isolate));
} else {
env.SetBooleanField(targetJavaObject, fieldId, value->BooleanValue(context).ToChecked());
env.SetBooleanField(targetJavaObject, fieldId, value->BooleanValue(isolate));
}
break;
}
Expand All @@ -256,7 +256,7 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
}
case 'C': { //char
//TODO: validate value is a single char
String::Utf8Value stringValue(isolate, value->ToString(isolate));
String::Utf8Value stringValue(isolate, value->ToString(context).ToLocalChecked());
JniLocalRef strValue(env.NewStringUTF(*stringValue));
const char* chars = env.GetStringUTFChars(strValue, 0);

Expand Down Expand Up @@ -327,7 +327,8 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
//TODO: validate valie is a string;
result = ArgConverter::ConvertToJavaString(value);
} else {
auto objectWithHiddenID = value->ToObject(isolate);
auto context = isolate->GetCurrentContext();
auto objectWithHiddenID = value->ToObject(context).ToLocalChecked();
result = objectManager->GetJavaObjectByJsObject(objectWithHiddenID);
}
}
Expand Down
Loading