fix: BrowserRestrictMitigation: CommonJsPluginFactory class not found

This commit is contained in:
ACh Sulfate
2023-10-02 13:33:17 +08:00
parent e192f093e4
commit a4a632847b

View File

@@ -109,6 +109,13 @@ public class BrowserRestrictMitigation extends CommonSwitchFunctionHook {
}
}
}
if (kCommonJsPluginFactory == null) {
Class<?> kAbsWebView = Initiator.findClassWithSynthetics("com.tencent.mobileqq.webview.AbsWebView", 1);
if (kAbsWebView != null) {
Method myCommonJsPlugins = kAbsWebView.getDeclaredMethod("myCommonJsPlugins");
kCommonJsPluginFactory = myCommonJsPlugins.getReturnType();
}
}
Objects.requireNonNull(kCommonJsPluginFactory, "kCommonJsPluginFactory is null");
Method m1 = ArraysKt.single(kCommonJsPluginFactory.getDeclaredMethods(), m -> m.getReturnType() == List.class);
HookUtils.hookAfterIfEnabled(this, m1, param -> {