diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 00:43:22 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 00:43:22 +0000 |
commit | ebabf6a5a0f406ce82cb69f4a063530c594741f0 (patch) | |
tree | cbe440c3926dbe6c4a4d18e0de0b930862c06495 /android_webview | |
parent | 57b2e0618237aa6bd570c7a3e2fd6e41d12a49b4 (diff) | |
download | chromium_src-ebabf6a5a0f406ce82cb69f4a063530c594741f0.zip chromium_src-ebabf6a5a0f406ce82cb69f4a063530c594741f0.tar.gz chromium_src-ebabf6a5a0f406ce82cb69f4a063530c594741f0.tar.bz2 |
Minor correctness fix to dialog handler
IDMap::Remove will check if the id is invalid, so short-circuit the
entire method if lookup fails.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/19385004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/native/aw_contents_client_bridge.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index c044197..7b84c26 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc @@ -161,12 +161,15 @@ void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); content::JavaScriptDialogManager::DialogClosedCallback* callback = pending_js_dialog_callbacks_.Lookup(id); + if (!callback) { + LOG(WARNING) << "Unexpected JS dialog confirm. " << id; + return; + } string16 prompt_text; if (prompt) { prompt_text = ConvertJavaStringToUTF16(env, prompt); } - if (callback) - callback->Run(true, prompt_text); + callback->Run(true, prompt_text); pending_js_dialog_callbacks_.Remove(id); } @@ -174,8 +177,11 @@ void AwContentsClientBridge::CancelJsResult(JNIEnv*, jobject, int id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); content::JavaScriptDialogManager::DialogClosedCallback* callback = pending_js_dialog_callbacks_.Lookup(id); - if (callback) - callback->Run(false, string16()); + if (!callback) { + LOG(WARNING) << "Unexpected JS dialog cancel. " << id; + return; + } + callback->Run(false, string16()); pending_js_dialog_callbacks_.Remove(id); } |