diff options
author | Patrick Scott <phanna@android.com> | 2010-01-15 08:12:15 -0500 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2010-01-26 08:17:18 -0500 |
commit | 74f6c03bb25e04f120252a89d1ad79996787a865 (patch) | |
tree | e19d997ef9e44e57b925bf5a1ed463734e94b206 /core/java/android/webkit/SslErrorHandler.java | |
parent | 79896bd123aa3bc69c6455d4e2ddf2b2b555e6e5 (diff) | |
download | frameworks_base-74f6c03bb25e04f120252a89d1ad79996787a865.zip frameworks_base-74f6c03bb25e04f120252a89d1ad79996787a865.tar.gz frameworks_base-74f6c03bb25e04f120252a89d1ad79996787a865.tar.bz2 |
Set a flag that indicates a response is pending.
This will keep track of multiple calls to proceed/cancel. If an error has
occurred and the client calls proceed or cancel more than once, the loader may
be null. Set the flag during the callback and reset after a response.
Bug: 2371305
Diffstat (limited to 'core/java/android/webkit/SslErrorHandler.java')
-rw-r--r-- | core/java/android/webkit/SslErrorHandler.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java index 90ed65d..d99c2c0 100644 --- a/core/java/android/webkit/SslErrorHandler.java +++ b/core/java/android/webkit/SslErrorHandler.java @@ -51,6 +51,11 @@ public class SslErrorHandler extends Handler { */ private Bundle mSslPrefTable; + /** + * Flag indicating that a client reponse is pending. + */ + private boolean mResponsePending; + // Message id for handling the response private static final int HANDLE_RESPONSE = 100; @@ -191,6 +196,7 @@ public class SslErrorHandler extends Handler { // if we do not have information on record, ask // the user (display a dialog) CallbackProxy proxy = loader.getFrame().getCallbackProxy(); + mResponsePending = true; proxy.onReceivedSslError(this, error); } @@ -202,7 +208,11 @@ public class SslErrorHandler extends Handler { * Proceed with the SSL certificate. */ public void proceed() { - sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0, mLoaderQueue.poll())); + if (mResponsePending) { + mResponsePending = false; + sendMessage(obtainMessage(HANDLE_RESPONSE, 1, 0, + mLoaderQueue.poll())); + } } /** @@ -210,7 +220,11 @@ public class SslErrorHandler extends Handler { * the error. */ public void cancel() { - sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0, mLoaderQueue.poll())); + if (mResponsePending) { + mResponsePending = false; + sendMessage(obtainMessage(HANDLE_RESPONSE, 0, 0, + mLoaderQueue.poll())); + } } /** |