Skip to content

Commit 1470796

Browse files
authored
feat: devtools element/network inspectors (#1808)
1 parent aca9852 commit 1470796

27 files changed

+586
-2244
lines changed

Diff for: test-app/app/src/main/java/com/tns/AndroidJsV8Inspector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ protected void onPong(NanoWSD.WebSocketFrame pong) {
350350
@Override
351351
protected void onException(IOException exception) {
352352
// when the chrome inspector is disconnected by closing the tab a "Broken pipe" exception is thrown which we don't need to log, only in verbose logging mode
353-
if(!exception.getMessage().equals("Broken pipe") || currentRuntimeLogger.isEnabled()) {
353+
if(exception != null && !exception.getMessage().equals("Broken pipe") || currentRuntimeLogger.isEnabled()) {
354354
if (com.tns.Runtime.isDebuggable()) {
355355
exception.printStackTrace();
356356
}

Diff for: test-app/runtime/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
7070
INSPECTOR_SOURCES
7171

7272
src/main/cpp/com_tns_AndroidJsV8Inspector.cpp
73-
src/main/cpp/DOMDomainCallbackHandlers.cpp
7473
src/main/cpp/JsV8InspectorClient.cpp
75-
src/main/cpp/NetworkDomainCallbackHandlers.cpp
74+
src/main/cpp/v8_inspector/ns-v8-tracing-agent-impl.cpp
7675
)
7776
else ()
7877
# When building in Release mode we do not include the V8 inspector sources

Diff for: test-app/runtime/src/main/cpp/ArgConverter.h

+27-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,33 @@ class ArgConverter {
6464
}
6565
}
6666

67-
static std::u16string ConvertToUtf16String(const v8::Local<v8::String>& s);
67+
inline static v8::Local<v8::String> ToV8String(v8::Isolate *isolate, const std::string &value) {
68+
return v8::String::NewFromUtf8(isolate, value.c_str(), v8::NewStringType::kNormal,
69+
(int) value.length()).ToLocalChecked();
70+
}
71+
72+
inline static std::string ToString(v8::Isolate *isolate, const v8::Local<v8::Value> &value) {
73+
if (value.IsEmpty()) {
74+
return std::string();
75+
}
76+
77+
if (value->IsStringObject()) {
78+
v8::Local<v8::String> obj = value.As<v8::StringObject>()->ValueOf();
79+
return ToString(isolate, obj);
80+
}
81+
82+
v8::String::Utf8Value result(isolate, value);
83+
84+
const char *val = *result;
85+
if (val == nullptr) {
86+
return std::string();
87+
}
88+
89+
return std::string(*result, result.length());
90+
}
91+
92+
93+
static std::u16string ConvertToUtf16String(const v8::Local<v8::String>& s);
6894

6995
inline static jstring ConvertToJavaString(const v8::Local<v8::Value>& jsValue) {
7096
JEnv env;

Diff for: test-app/runtime/src/main/cpp/CSSAgentImpl.cpp

-279
This file was deleted.

0 commit comments

Comments
 (0)