Changeset 189679 in webkit
- Timestamp:
- Sep 13, 2015 9:18:18 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189678 r189679 1 2015-09-13 Chris Dumez <cdumez@apple.com> 2 3 document.lastModified should use the user's local time zone 4 https://bugs.webkit.org/show_bug.cgi?id=149092 5 6 Reviewed by Ryosuke Niwa. 7 8 Update test so that it converts document.lastModified to UTF before 9 printing it. This is so that we can consistent layout tests results, no 10 matter the system's timezone. 11 12 * http/tests/misc/last-modified-parsing-expected.txt: 13 * http/tests/resources/last-modified.php: 14 1 15 2015-09-13 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 16 -
trunk/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt
r67513 r189679 4 4 Frame: '<!--framePath //<!--frame0-->-->' 5 5 -------- 6 11/21/2008 01:03:33 6 Fri, 21 Nov 2008 01:03:33 GMT 7 7 8 8 -------- 9 9 Frame: '<!--framePath //<!--frame1-->-->' 10 10 -------- 11 11/21/2008 01:03:33 11 Fri, 21 Nov 2008 01:03:33 GMT 12 12 13 13 -------- 14 14 Frame: '<!--framePath //<!--frame2-->-->' 15 15 -------- 16 11/21/1997 01:03:33 16 Fri, 21 Nov 1997 01:03:33 GMT 17 17 18 18 -------- 19 19 Frame: '<!--framePath //<!--frame3-->-->' 20 20 -------- 21 11/21/2008 01:03:33 21 Fri, 21 Nov 2008 01:03:33 GMT 22 22 23 23 -------- 24 24 Frame: '<!--framePath //<!--frame4-->-->' 25 25 -------- 26 02/21/2008 01:03:33 26 Thu, 21 Feb 2008 01:03:33 GMT 27 27 28 28 -------- 29 29 Frame: '<!--framePath //<!--frame5-->-->' 30 30 -------- 31 02/03/2008 01:03:33 31 Sun, 03 Feb 2008 01:03:33 GMT 32 32 33 33 -------- 34 34 Frame: '<!--framePath //<!--frame6-->-->' 35 35 -------- 36 03/03/2008 01:03:33 36 Mon, 03 Mar 2008 01:03:33 GMT -
trunk/LayoutTests/http/tests/resources/last-modified.php
r67513 r189679 4 4 ?> 5 5 <script> 6 document.write( document.lastModified);6 document.write((new Date(document.lastModified)).toUTCString()); 7 7 </script> -
trunk/LayoutTests/imported/w3c/ChangeLog
r189677 r189679 1 2015-09-13 Chris Dumez <cdumez@apple.com> 2 3 document.lastModified should use the user's local time zone 4 https://bugs.webkit.org/show_bug.cgi?id=149092 5 <rdar://problem/22567705> 6 7 Reviewed by Ryosuke Niwa. 8 9 Rebaseline a couple of W3C tests now that more checks are passing. 10 11 * web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01-expected.txt: 12 * web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-expected.txt: 13 1 14 2015-09-13 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-01-expected.txt
r189472 r189679 1 1 2 FAIL Date returned by lastModified is current at page load assert_true: expected true got false 2 PASS Date returned by lastModified is current at page load 3 3 PASS Date returned by lastModified is in the form "MM/DD/YYYY hh:mm:ss". 4 FAIL Date returned by lastModified is in the user's local time zone. assert_true: expected true got false 5 FAIL Date returned by lastModified is current after timeout. assert_true: expected true got false 4 PASS Date returned by lastModified is in the user's local time zone. 5 PASS Date returned by lastModified is current after timeout. 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/resource-metadata-management/document-lastModified-expected.txt
r189472 r189679 1 1 2 FAIL lastModified should return the last modified date and time assert_equals: expected "12/31/1969 17:23:45" but got "01/01/1970 01:23:45" 2 PASS lastModified should return the last modified date and time 3 3 -
trunk/Source/WebCore/ChangeLog
r189677 r189679 1 2015-09-13 Chris Dumez <cdumez@apple.com> 2 3 document.lastModified should use the user's local time zone 4 https://bugs.webkit.org/show_bug.cgi?id=149092 5 <rdar://problem/22567705> 6 7 Reviewed by Ryosuke Niwa. 8 9 document.lastModified should use the user's local time zone: 10 https://html.spec.whatwg.org/multipage/dom.html#dom-document-lastmodified 11 12 Chrome and Firefox comply with the specification but WebKit was using 13 UTC. This patch aligns WebKit's behavior with the specification and 14 other browsers. 15 16 No new tests, already covered by existing tests. 17 18 * dom/Document.cpp: 19 (WebCore::Document::lastModified): 20 (WebCore::Document::setCookieURL): Deleted. 21 1 22 2015-09-13 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebCore/dom/Document.cpp
r189677 r189679 162 162 #include "htmlediting.h" 163 163 #include <JavaScriptCore/Profile.h> 164 #include <ctime> 164 165 #include <inspector/ScriptCallStack.h> 165 166 #include <wtf/CurrentTime.h> … … 4237 4238 String Document::lastModified() const 4238 4239 { 4239 DateComponents date; 4240 bool foundDate = false; 4241 if (m_frame) { 4242 auto lastModifiedDate = loader() ? loader()->response().lastModified() : Nullopt; 4243 if (lastModifiedDate) { 4244 using namespace std::chrono; 4245 date.setMillisecondsSinceEpochForDateTime(duration_cast<milliseconds>(lastModifiedDate.value().time_since_epoch()).count()); 4246 foundDate = true; 4247 } 4248 } 4240 using namespace std::chrono; 4241 Optional<system_clock::time_point> dateTime; 4242 if (m_frame && loader()) 4243 dateTime = loader()->response().lastModified(); 4244 4249 4245 // FIXME: If this document came from the file system, the HTML5 4250 // specific iation tells us to read the last modification date from the file4246 // specification tells us to read the last modification date from the file 4251 4247 // system. 4252 if (! foundDate) {4253 d ouble fallbackDate = currentTimeMS();4248 if (!dateTime) { 4249 dateTime = system_clock::now(); 4254 4250 #if ENABLE(WEB_REPLAY) 4255 4251 InputCursor& cursor = inputCursor(); 4256 4252 if (cursor.isCapturing()) 4257 cursor.appendInput<DocumentLastModifiedDate>( fallbackDate);4253 cursor.appendInput<DocumentLastModifiedDate>(duration_cast<milliseconds>(dateTime.value().time_since_epoch()).count()); 4258 4254 else if (cursor.isReplaying()) { 4259 4255 if (DocumentLastModifiedDate* input = cursor.fetchInput<DocumentLastModifiedDate>()) 4260 fallbackDate = input->fallbackValue();4256 dateTime = system_clock::time_point(milliseconds(static_cast<long long>(input->fallbackValue()))); 4261 4257 } 4262 4258 #endif 4263 date.setMillisecondsSinceEpochForDateTime(fallbackDate); 4264 } 4265 4266 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, date.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4259 } 4260 4261 auto ctime = system_clock::to_time_t(dateTime.value()); 4262 auto localDateTime = std::localtime(&ctime); 4263 return String::format("%02d/%02d/%04d %02d:%02d:%02d", localDateTime->tm_mon + 1, localDateTime->tm_mday, 1900 + localDateTime->tm_year, localDateTime->tm_hour, localDateTime->tm_min, localDateTime->tm_sec); 4267 4264 } 4268 4265
Note: See TracChangeset
for help on using the changeset viewer.