summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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