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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php

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
Index: third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php b/third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php
index 6465f77cd6133177b723e53ed6f3aa057d343161..8dded1c4e755e2163212b120076bcadb4957387a 100644
--- a/third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php
+++ b/third_party/WebKit/LayoutTests/http/tests/resources/last-modified.php
@@ -6,7 +6,13 @@
<script>
var expected = '<?=$expected?>';
var lastModified = document.lastModified;
-if (expected == lastModified) {
+
+// If expected is 'illformed-date', then the Last-Modified: header
+// is assumed to contain an unparseable date. For which we're supposed
+// to return the current time per spec. Simply verify that by checking
+// that the |lastModified| parses.
+if (expected === lastModified ||
+ (expected === "illformed-date" && !isNaN(Date.parse(lastModified)))) {
document.write('PASS');
} else {
document.write('FAIL: expect ' + expected + ', but got ' + lastModified);

Powered by Google App Engine
This is Rietveld 408576698