File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
app/src/main/java/org/matrix/chromext Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -103,13 +103,16 @@ object UserScriptHook : BaseHook() {
103103 }
104104
105105 findMethod(if (Chrome .isSamsung) proxy.tabImpl else proxy.tabWebContentsDelegateAndroidImpl) {
106- name == " onUpdateUrl"
106+ name == " onUpdateUrl" || name == " onUpdateTargetUrl "
107107 }
108- // public void onUpdateUrl (GURL url)
108+ // public void onUpdateTargetUrl (GURL url)
109109 .hookAfter {
110110 val tab = proxy.getTab(it.thisObject)!!
111111 if (! Chrome .isSamsung) Chrome .updateTab(tab)
112- val url = proxy.parseUrl(it.args[0 ])!!
112+ var url = proxy.parseUrl(it.args[0 ])!!
113+ if (url.isEmpty() && proxy.getUrl != null ) {
114+ url = proxy.parseUrl(proxy.getUrl(tab))!!
115+ }
113116 val isLoading = proxy.mIsLoading.get(tab) as Boolean
114117 if (! url.startsWith(" chrome" ) && isLoading) {
115118 ScriptDbManager .invokeScript(url)
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ object UserScriptProxy {
8484 } else target
8585 }
8686 .also { it.isAccessible = true }
87+ val getUrl = findMethodOrNull(tabImpl) { returnType == gURL }
8788 val loadUrl =
8889 findMethod(if (Chrome .isSamsung) tabWebContentsDelegateAndroidImpl else tabImpl) {
8990 parameterTypes contentDeepEquals arrayOf(loadUrlParams) &&
You can’t perform that action at this time.
0 commit comments