mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Fix race condition where not all logs would be added to the viewer.
This commit is contained in:
@@ -220,6 +220,11 @@ function applyFilter() {
|
||||
editor.setValue(filtered, -1);
|
||||
}
|
||||
|
||||
function appendLines(lines) {
|
||||
editor.session.insert({ row: editor.session.getLength(), column: 0}, lines);
|
||||
logLines += lines;
|
||||
}
|
||||
|
||||
function readLines(offset, limit) {
|
||||
const lines = logLines.split("\n")
|
||||
if (offset >= lines.length) {
|
||||
|
||||
@@ -46,7 +46,11 @@ object DebugLogsViewer {
|
||||
fun appendLines(webview: WebView, lines: String) {
|
||||
// Set the debug log lines
|
||||
val escaped = JSONObject.quote(lines)
|
||||
ThreadUtil.runOnMain { webview.evaluateJavascript("editor.insert($escaped); logLines+=$escaped;", null) }
|
||||
val latch = CountDownLatch(1)
|
||||
ThreadUtil.runOnMain {
|
||||
webview.evaluateJavascript("appendLines($escaped)") { latch.countDown() }
|
||||
}
|
||||
latch.await()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
Reference in New Issue
Block a user