Fix compatibility with Chrome v150 - #305
Open
matheuslive wants to merge 2 commits into
Open
Conversation
TabImpl has 65 instance fields in Chrome v150, and the order in which the obfuscated names are sorted no longer matches the declaration order, so the heuristics locating mId and mIsLoading by position both resolve to nothing and the !! operator throws inside the initializer of UserScriptProxy. Since initHooks was not guarded, the resulting ExceptionInInitializerError aborted every hook. Resolve mId lazily, since it is dead weight whenever getId is available, and let mIsLoading be null: in that case, track the loading state by hooking loadingStateChanged, whose name is preserved by the obfuscation as it is called from the native side.
Three signatures changed: onMenuOrKeyboardAction takes up to 4 parameters now, the field of PropertyModel is declared as a HashMap instead of a Map, and MVCListAdapter.ListItem swapped its constructor parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chrome v150 renames the fields of
TabImpl, which breaks the heuristics that locate them by declaration order. With 65 instance fields, the order in which the obfuscated names are sorted (a,a0,b,b0, …) no longer matches the declaration order, so bothmIdandmIsLoadingresolve to nothing and the!!operator throws inside the initializer ofUserScriptProxy. AsinitHookswas not guarded, this aborts every hook and the module ends up completely inert:Same failure mode as #285. In v150 the fields are
TabImpl.b(mId, found in the body ofgetId) andTabImpl.A(mIsLoading, the only field written byloadingStateChanged).First commit
mIdis resolved lazily: it is dead weight whenevergetIdis found, so it must not break the initializer.mIsLoadingis allowed to be null; the loading state is then tracked by hookingloadingStateChanged(boolean), whose name is preserved by the obfuscation since it is called from the native side, and which is the only writer of that field. Last resort is to keep injecting, which is harmless because both the init script andGM.bootstrapare idempotent for a given document.initHooks(UserScriptHook)is guarded, so one broken hook no longer takes the others down.Second commit, for the page menu (same kind of breakage as #258)
onMenuOrKeyboardActiontakes up to 4 parameters now.PropertyModelis declared as aHashMap, no longer as aMap.MVCListAdapter.ListItemswapped its constructor parameters to(PropertyModel, int).Testing
Chrome
150.0.7871.186on Android 13: every hook initializes without exception, user scripts are injected again, and the Eruda console entry is back in the app menu. Only theChromeTabbedActivitypath was exercised — Custom Tabs, Edge, Samsung Internet and Cromite were not, though themIsLoadingchange does affect all of them.