fix: sendLogToJavaScript#2111
Conversation
Greptile SummaryThis PR fixes a crash in
Confidence Score: 4/5The fix is now compilable and the immediate crash is addressed, but the WebView cast path has a silent-failure mode that could drop log messages without indication. The core JavaScript-level fix (the typeof guard) addresses the root crash. The lambda syntax and try-catch placement are now correct. The one remaining concern is that if the android.webkit.WebView cast fails at runtime, log messages are silently swallowed — the catch block only logs internally and gives no indication to callers that JS evaluation was skipped entirely. src/plugins/system/android/com/foxdebug/system/System.java — specifically the WebView cast and error handling in sendLogToJavaScript Important Files Changed
Sequence DiagramsequenceDiagram
participant BG as Background Thread
participant UI as UI Thread
participant WV as WebView (JS)
BG->>UI: cordova.getActivity().runOnUiThread(lambda)
UI->>UI: "try { cast to android.webkit.WebView }"
alt cast succeeds
UI->>WV: evaluateJavascript(js, null)
WV->>WV: "if typeof window.log === function window.log else console.log"
else cast fails (ClassCastException)
UI->>UI: catch(Exception e) Log.e(TAG, message)
end
Reviews (4): Last reviewed commit: "fix: lamda issue" | Re-trigger Greptile |
Fixed crash from: #2106
Related to #2105