[Bug]: Plugin call after navigation can be answered before reply proxy is updated
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- android, java
- Ambito
- mobile-dev
Direzione di ricerca
Inizia da MessageHandler.java e analizza l’ordine di aggiornamento del proxy di risposta e di pubblicazione del messaggio durante la navigazione o il ricaricamento. Riproduci il problema con una lettura rapida di Preferences su Android, quindi verifica che le chiamate dei plugin dalla nuova pagina usino il proxy aggiornato e vengano risolte, invece di essere ignorate silenziosamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Capacitor Version
@capacitor/cli: 8.4.0
@capacitor/core: 8.4.0
@capacitor/android: 8.4.0
Other API Details
npm: 11.0.0
node: 22.13.0
Platforms Affected
- iOS
- Android
- Web
Current Behavior
After a reload or navigation, a fast plugin call (e.g. a Preferences read, which is how the bug appeared for us) can potentially never resolve as it uses the previous proxy instead of the updated one. The cause are these lines in MessageHandler.java:
if (isMainFrame) {
postMessage(message.getData());
javaScriptReplyProxy = replyProxy;
}
In case of a fast plugin call, sendResponseMessage() is reached before the proxy is updated, and therefore still uses the previous proxy and is silently dropped. Later calls work, and there's also no issue upon first page load as, at this point, javaScriptReplyProxy is null and the old evaluateJavascript path is used instead.
Expected Behavior
All plugin calls of the new page should go through the updated proxy.
Project Reproduction
Reproduced in a private repo
Additional Information
The bug is avoidable with android.useLegacyBridge = true as this routes every response through evaluateJavascriptand avoids the proxy entirely.
I've locally fixed the bug by swapping the two lines above, i.e., making sure the proxy is updated before the message post.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 1.3k
- Merge medio
- 3g 10h
- PR unite (30g)
- 10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ionic-team/capacitor
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ionic-team/capacitor#8601 ·
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ionic-team/capacitor#8574 ·
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16) Apertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ionic-team/capacitor#8530 · 2 commenti ·
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ionic-team/capacitor#8529 ·
-
needs reproduction
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ionic-team/capacitor#8472 · 2 commenti · 1 reazione ·
Tutte le issue di ionic-team/capacitor
Issue simili
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Automattic/studio#4908 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100