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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2698773005: document.lastModified: treat invalid dates like unknown ones. (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index dc5974ba26fa9533ccc3859d07c7794ee1d1ad18..c621e248b7dd1e6395708ac2e5537879aef650a7 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4666,9 +4666,12 @@ String Document::lastModified() const {
const AtomicString& httpLastModified =
documentLoader->response().httpHeaderField(HTTPNames::Last_Modified);
if (!httpLastModified.isEmpty()) {
- date.setMillisecondsSinceEpochForDateTime(
- convertToLocalTime(parseDate(httpLastModified)));
- foundDate = true;
+ double dateValue = parseDate(httpLastModified);
+ if (!std::isnan(dateValue)) {
+ date.setMillisecondsSinceEpochForDateTime(
+ convertToLocalTime(dateValue));
+ foundDate = true;
+ }
}
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698