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

Unified Diff: android_webview/native/cookie_manager.cc

Issue 2821623003: Allow WebView setCookie api to set secure cookies for http urls. (Closed)
Patch Set: Add a test Created 3 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 | « android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/cookie_manager.cc
diff --git a/android_webview/native/cookie_manager.cc b/android_webview/native/cookie_manager.cc
index e5e666844b68e8fa482c9621bed7e93515e2298a..c8a0990ef5c38d83cf9145a0c6506c3af687f781 100644
--- a/android_webview/native/cookie_manager.cc
+++ b/android_webview/native/cookie_manager.cc
@@ -387,12 +387,20 @@ void CookieManager::SetCookieHelper(
options.set_include_httponly();
// Log message for catching strict secure cookies related bugs.
- if (!host.has_scheme() || host.SchemeIs(url::kHttpScheme)) {
+ // TODO(sgurun) temporary. Add UMA stats to monitor, and remove afterwards.
+ if (host.is_valid() &&
+ (!host.has_scheme() || host.SchemeIs(url::kHttpScheme))) {
net::ParsedCookie parsed_cookie(value);
if (parsed_cookie.IsValid() && parsed_cookie.IsSecure()) {
LOG(WARNING) << "Strict Secure Cookie policy does not allow setting a "
"secure cookie for "
<< host.spec();
+ GURL::Replacements replace_host;
+ replace_host.SetSchemeStr("https");
+ GURL new_host = host.ReplaceComponents(replace_host);
+ GetCookieStore()->SetCookieWithOptionsAsync(new_host, value, options,
+ callback);
+ return;
}
}
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698