Skip to content

Commit

Permalink
feat: devtools element/network inspectors (#1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz authored Apr 7, 2024
1 parent aca9852 commit 1470796
Show file tree
Hide file tree
Showing 27 changed files with 586 additions and 2,244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ protected void onPong(NanoWSD.WebSocketFrame pong) {
@Override
protected void onException(IOException exception) {
// 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
if(!exception.getMessage().equals("Broken pipe") || currentRuntimeLogger.isEnabled()) {
if(exception != null && !exception.getMessage().equals("Broken pipe") || currentRuntimeLogger.isEnabled()) {
if (com.tns.Runtime.isDebuggable()) {
exception.printStackTrace();
}
Expand Down
3 changes: 1 addition & 2 deletions test-app/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
INSPECTOR_SOURCES

src/main/cpp/com_tns_AndroidJsV8Inspector.cpp
src/main/cpp/DOMDomainCallbackHandlers.cpp
src/main/cpp/JsV8InspectorClient.cpp
src/main/cpp/NetworkDomainCallbackHandlers.cpp
src/main/cpp/v8_inspector/ns-v8-tracing-agent-impl.cpp
)
else ()
# When building in Release mode we do not include the V8 inspector sources
Expand Down
28 changes: 27 additions & 1 deletion test-app/runtime/src/main/cpp/ArgConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,33 @@ class ArgConverter {
}
}

static std::u16string ConvertToUtf16String(const v8::Local<v8::String>& s);
inline static v8::Local<v8::String> ToV8String(v8::Isolate *isolate, const std::string &value) {
return v8::String::NewFromUtf8(isolate, value.c_str(), v8::NewStringType::kNormal,
(int) value.length()).ToLocalChecked();
}

inline static std::string ToString(v8::Isolate *isolate, const v8::Local<v8::Value> &value) {
if (value.IsEmpty()) {
return std::string();
}

if (value->IsStringObject()) {
v8::Local<v8::String> obj = value.As<v8::StringObject>()->ValueOf();
return ToString(isolate, obj);
}

v8::String::Utf8Value result(isolate, value);

const char *val = *result;
if (val == nullptr) {
return std::string();
}

return std::string(*result, result.length());
}


static std::u16string ConvertToUtf16String(const v8::Local<v8::String>& s);

inline static jstring ConvertToJavaString(const v8::Local<v8::Value>& jsValue) {
JEnv env;
Expand Down
279 changes: 0 additions & 279 deletions test-app/runtime/src/main/cpp/CSSAgentImpl.cpp

This file was deleted.

Loading

0 comments on commit 1470796

Please sign in to comment.