mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Fix NPE when POLLING bridge mode is used.
This commit is contained in:
parent
4dad9d0e37
commit
448071b02d
4
framework/.settings/org.eclipse.jdt.core.prefs
Normal file
4
framework/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -83,7 +83,7 @@ public class NativeToJsMessageQueue {
|
||||
this.cordova = cordova;
|
||||
this.webView = webView;
|
||||
registeredListeners = new BridgeMode[4];
|
||||
registeredListeners[0] = null; // Polling. Requires no logic.
|
||||
registeredListeners[0] = new PollingBridgeMode();
|
||||
registeredListeners[1] = new LoadUrlBridgeMode();
|
||||
registeredListeners[2] = new OnlineEventsBridgeMode();
|
||||
registeredListeners[3] = new PrivateApiBridgeMode();
|
||||
@ -279,7 +279,13 @@ public class NativeToJsMessageQueue {
|
||||
abstract void onNativeToJsMessageAvailable();
|
||||
void notifyOfFlush(boolean fromOnlineEvent) {}
|
||||
}
|
||||
|
||||
|
||||
/** Uses JS polls for messages on a timer.. */
|
||||
private class PollingBridgeMode extends BridgeMode {
|
||||
@Override void onNativeToJsMessageAvailable() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Uses webView.loadUrl("javascript:") to execute messages. */
|
||||
private class LoadUrlBridgeMode extends BridgeMode {
|
||||
final Runnable runnable = new Runnable() {
|
||||
|
Loading…
Reference in New Issue
Block a user