Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java

Issue 1912083002: [WebView] Don't try to set cookies with null values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java
index c8bf9bef954999c2ebda97ce35c2810e14b40a7f..67773883c4a1efb9707797df38596343cbc8f61e 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/CookieManagerAdapter.java
@@ -6,12 +6,12 @@ package com.android.webview.chromium;
import android.net.ParseException;
import android.net.WebAddress;
-import android.util.Log;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import org.chromium.android_webview.AwCookieManager;
+import org.chromium.base.Log;
import org.chromium.base.annotations.SuppressFBWarnings;
/**
@@ -21,7 +21,7 @@ import org.chromium.base.annotations.SuppressFBWarnings;
@SuppressWarnings("deprecation")
@SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD")
public class CookieManagerAdapter extends CookieManager {
- private static final String LOGTAG = "CookieManager";
+ private static final String TAG = "CookieManager";
AwCookieManager mChromeCookieManager;
@@ -51,19 +51,29 @@ public class CookieManagerAdapter extends CookieManager {
@Override
public void setCookie(String url, String value) {
+ if (value == null) {
+ Log.e(TAG, "Not setting cookie with null value for URL: %s", url);
+ return;
+ }
+
try {
mChromeCookieManager.setCookie(fixupUrl(url), value);
} catch (ParseException e) {
- Log.e(LOGTAG, "Not setting cookie due to error parsing URL: " + url, e);
+ Log.e(TAG, "Not setting cookie due to error parsing URL: %s", url, e);
}
}
@Override
public void setCookie(String url, String value, ValueCallback<Boolean> callback) {
+ if (value == null) {
+ Log.e(TAG, "Not setting cookie with null value for URL: %s", url);
+ return;
+ }
+
try {
mChromeCookieManager.setCookie(fixupUrl(url), value, callback);
} catch (ParseException e) {
- Log.e(LOGTAG, "Not setting cookie due to error parsing URL: " + url, e);
+ Log.e(TAG, "Not setting cookie due to error parsing URL: %s", url, e);
}
}
@@ -72,7 +82,7 @@ public class CookieManagerAdapter extends CookieManager {
try {
return mChromeCookieManager.getCookie(fixupUrl(url));
} catch (ParseException e) {
- Log.e(LOGTAG, "Unable to get cookies due to error parsing URL: " + url, e);
+ Log.e(TAG, "Unable to get cookies due to error parsing URL: %s", url, e);
return null;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698