Do not allow our resend/dontresend messages to be sent twice.

Fix for http://b/issue?id=2340086
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 512f2b7..a313269 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -402,6 +402,8 @@
     // -------------------------------------------------------------------------
 
     private final WebViewClient mWebViewClient = new WebViewClient() {
+        private Message mDontResend;
+        private Message mResend;
         @Override
         public void onPageStarted(WebView view, String url, Bitmap favicon) {
             mInLoad = true;
@@ -548,6 +550,14 @@
                 dontResend.sendToTarget();
                 return;
             }
+            if (mDontResend != null) {
+                Log.w(LOGTAG, "onFormResubmission should not be called again "
+                        + "while dialog is still up");
+                dontResend.sendToTarget();
+                return;
+            }
+            mDontResend = dontResend;
+            mResend = resend;
             new AlertDialog.Builder(mActivity).setTitle(
                     R.string.browserFrameFormResubmitLabel).setMessage(
                     R.string.browserFrameFormResubmitMessage)
@@ -555,17 +565,29 @@
                             new DialogInterface.OnClickListener() {
                                 public void onClick(DialogInterface dialog,
                                         int which) {
-                                    resend.sendToTarget();
+                                    if (mResend != null) {
+                                        mResend.sendToTarget();
+                                        mResend = null;
+                                        mDontResend = null;
+                                    }
                                 }
                             }).setNegativeButton(R.string.cancel,
                             new DialogInterface.OnClickListener() {
                                 public void onClick(DialogInterface dialog,
                                         int which) {
-                                    dontResend.sendToTarget();
+                                    if (mDontResend != null) {
+                                        mDontResend.sendToTarget();
+                                        mResend = null;
+                                        mDontResend = null;
+                                    }
                                 }
                             }).setOnCancelListener(new OnCancelListener() {
                         public void onCancel(DialogInterface dialog) {
-                            dontResend.sendToTarget();
+                            if (mDontResend != null) {
+                                mDontResend.sendToTarget();
+                                mResend = null;
+                                mDontResend = null;
+                            }
                         }
                     }).show();
         }