[Bug]: Plugin call after navigation can be answered before reply proxy is updated
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- android, java
- Bereich
- mobile-dev
Rechercherichtung
Beginne in MessageHandler.java und untersuche die Reihenfolge der Aktualisierung des Reply-Proxys und des Postens der Nachricht während der Navigation oder des Reloads. Reproduziere das Problem mit einem schnellen Preferences-Lesevorgang auf Android und verifiziere anschließend, dass Plugin-Aufrufe von der neuen Seite den aktualisierten Proxy verwenden und aufgelöst werden, anstatt stillschweigend verworfen zu werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 16.7k
- Forks
- 1.3k
- Ø Merge
- 3 T. 10 Std.
- Gemergte PRs (30 T.)
- 10
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ionic-team/capacitor
-
triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ionic-team/capacitor#8601 ·
-
triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ionic-team/capacitor#8574 ·
-
SystemBars: safe area CSS injection throws "Cannot read properties of null" on startup (Android 16) Offentriage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ionic-team/capacitor#8530 · 2 Kommentare ·
-
triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ionic-team/capacitor#8529 ·
-
needs reproduction
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ionic-team/capacitor#8472 · 2 Kommentare · 1 Reaktion ·
Alle Issues in ionic-team/capacitor
Ähnliche Issues
-
calcite-components needs triage refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Esri/calcite-design-system#15203 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Automattic/studio#4908 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100