Skip to content

Commit

Permalink
Better hint for error stack trace
Browse files Browse the repository at this point in the history
DevTools cannot handle local://ChromeXt:num:num correctly
  • Loading branch information
JingMatrix committed Sep 3, 2023
1 parent 9ff031d commit c0a80f1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/matrix/chromext/hook/UserScript.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object UserScriptHook : BaseHook() {
val lineNumber = it.args[2] as Int
val sourceId = it.args[3] as String
if (it.args[0] as Int == 0 &&
sourceId == "local://ChromeXt" &&
sourceId == "local://ChromeXt/init" &&
lineNumber == Local.anchorInChromeXt) {
Listener.startAction(it.args[1] as String, proxy.getTab(it.thisObject))
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/matrix/chromext/hook/WebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object WebViewHook : BaseHook() {
// This should be the way to communicate with the front-end of ChromeXt
val consoleMessage = it.args[0] as ConsoleMessage
if (consoleMessage.messageLevel() == ConsoleMessage.MessageLevel.TIP &&
consoleMessage.sourceId() == "local://ChromeXt" &&
consoleMessage.sourceId() == "local://ChromeXt/init" &&
consoleMessage.lineNumber() == Local.anchorInChromeXt) {
Listener.startAction(consoleMessage.message())
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/matrix/chromext/script/Manager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ object ScriptDbManager {
}
}
if (runScripts) codes.add("ChromeXt.lock(${Local.key});")
codes.add("//# sourceURL=local://ChromeXt")
codes.add("//# sourceURL=local://ChromeXt/init")
webSettings?.javaScriptEnabled = true
Chrome.evaluateJavascript(listOf(codes.joinToString("\n")), null, bypassSandbox, bypassSandbox)
if (runScripts) {
Expand Down

0 comments on commit c0a80f1

Please sign in to comment.