Commit 600742eb authored by Misha Efimov's avatar Misha Efimov Committed by Commit Bot

[Cronet] Disable DCHECK(created) in GetCreationTimeFromObject.

- iOS 12 returns nil for system cookie with null creation time.

Bug: 865803, 688540
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I612b4ab55aedb0a2c0d9b2a7cb24418c5a0a6c19
Reviewed-on: https://chromium-review.googlesource.com/1157229Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Misha Efimov <mef@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579763}
parent 7721d7fa
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ios/net/ios_net_buildflags.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -26,7 +27,11 @@ base::Time GetCreationTimeFromObject(NSHTTPCookie* cookie) { ...@@ -26,7 +27,11 @@ base::Time GetCreationTimeFromObject(NSHTTPCookie* cookie) {
// The "Created" key is not documented. // The "Created" key is not documented.
// Return a null time if the key is missing. // Return a null time if the key is missing.
id created = [[cookie properties] objectForKey:kHTTPCookieCreated]; id created = [[cookie properties] objectForKey:kHTTPCookieCreated];
#if !BUILDFLAG(CRONET_BUILD)
// In Cronet the cookie store is recreated on startup, so |created| could be
// nil.
DCHECK(created && [created isKindOfClass:[NSNumber class]]); DCHECK(created && [created isKindOfClass:[NSNumber class]]);
#endif
if (!created || ![created isKindOfClass:[NSNumber class]]) if (!created || ![created isKindOfClass:[NSNumber class]])
return base::Time(); return base::Time();
// created is the time from January 1st, 2001 in seconds. // created is the time from January 1st, 2001 in seconds.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment