summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2012-03-30 15:38:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-30 15:38:28 -0700
commit7784d151c1a8ba78b4ebb8b16a572c1c5f96f940 (patch)
treef0c5fb8088630eb003e9f662ed1f73f763072eea /core/java/android
parentd06fa89b52d6273a99548015944846db91ff1a57 (diff)
parentd2bfdfdd3e766062a40ddcd6cf30ddc8e3136d1b (diff)
downloadframeworks_base-7784d151c1a8ba78b4ebb8b16a572c1c5f96f940.zip
frameworks_base-7784d151c1a8ba78b4ebb8b16a572c1c5f96f940.tar.gz
frameworks_base-7784d151c1a8ba78b4ebb8b16a572c1c5f96f940.tar.bz2
Merge "Prevent message being sent twice in onSavePassword"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/webkit/WebViewClassic.java41
1 files changed, 31 insertions, 10 deletions
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index ba1c7e3..04fa07a 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -1420,6 +1420,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
// Used to notify listeners about find-on-page results.
private WebView.FindListener mFindListener;
+ // Used to prevent resending save password message
+ private Message mResumeMsg;
+
/**
* Refer to {@link WebView#requestFocusNodeHref(Message)} for more information
*/
@@ -1868,11 +1871,17 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
/* package */ boolean onSavePassword(String schemePlusHost, String username,
String password, final Message resumeMsg) {
- boolean rVal = false;
- if (resumeMsg == null) {
- // null resumeMsg implies saving password silently
- mDatabase.setUsernamePassword(schemePlusHost, username, password);
- } else {
+ boolean rVal = false;
+ if (resumeMsg == null) {
+ // null resumeMsg implies saving password silently
+ mDatabase.setUsernamePassword(schemePlusHost, username, password);
+ } else {
+ if (mResumeMsg != null) {
+ Log.w(LOGTAG, "onSavePassword should not be called while dialog is up");
+ resumeMsg.sendToTarget();
+ return true;
+ }
+ mResumeMsg = resumeMsg;
final Message remember = mPrivateHandler.obtainMessage(
REMEMBER_PASSWORD);
remember.getData().putString("host", schemePlusHost);
@@ -1894,34 +1903,46 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- resumeMsg.sendToTarget();
+ if (mResumeMsg != null) {
+ resumeMsg.sendToTarget();
+ mResumeMsg = null;
+ }
}
})
.setNeutralButton(com.android.internal.R.string.save_password_remember,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- remember.sendToTarget();
+ if (mResumeMsg != null) {
+ remember.sendToTarget();
+ mResumeMsg = null;
+ }
}
})
.setNegativeButton(com.android.internal.R.string.save_password_never,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- neverRemember.sendToTarget();
+ if (mResumeMsg != null) {
+ neverRemember.sendToTarget();
+ mResumeMsg = null;
+ }
}
})
.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
- resumeMsg.sendToTarget();
+ if (mResumeMsg != null) {
+ resumeMsg.sendToTarget();
+ mResumeMsg = null;
+ }
}
}).show();
// Return true so that WebViewCore will pause while the dialog is
// up.
rVal = true;
}
- return rVal;
+ return rVal;
}
@Override