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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <?php 1 <?php
2 $date = $_GET['date']; 2 $date = $_GET['date'];
3 $expected = $_GET['expected']; 3 $expected = $_GET['expected'];
4 header("Last-Modified: $date"); 4 header("Last-Modified: $date");
5 ?> 5 ?>
6 <script> 6 <script>
7 var expected = '<?=$expected?>'; 7 var expected = '<?=$expected?>';
8 var lastModified = document.lastModified; 8 var lastModified = document.lastModified;
9 if (expected == lastModified) { 9
10 // If expected is 'illformed-date', then the Last-Modified: header
11 // is assumed to contain an unparseable date. For which we're supposed
12 // to return the current time per spec. Simply verify that by checking
13 // that the |lastModified| parses.
14 if (expected === lastModified ||
15 (expected === "illformed-date" && !isNaN(Date.parse(lastModified)))) {
10 document.write('PASS'); 16 document.write('PASS');
11 } else { 17 } else {
12 document.write('FAIL: expect ' + expected + ', but got ' + lastModified); 18 document.write('FAIL: expect ' + expected + ', but got ' + lastModified);
13 } 19 }
14 </script> 20 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698