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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 394903004: document.lastModified should consider user's local time zone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Finger crossed Created 6 years, 5 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #include "platform/network/ContentSecurityPolicyParsers.h" 188 #include "platform/network/ContentSecurityPolicyParsers.h"
189 #include "platform/network/HTTPParsers.h" 189 #include "platform/network/HTTPParsers.h"
190 #include "platform/scroll/ScrollbarTheme.h" 190 #include "platform/scroll/ScrollbarTheme.h"
191 #include "platform/text/PlatformLocale.h" 191 #include "platform/text/PlatformLocale.h"
192 #include "platform/text/SegmentedString.h" 192 #include "platform/text/SegmentedString.h"
193 #include "platform/weborigin/OriginAccessEntry.h" 193 #include "platform/weborigin/OriginAccessEntry.h"
194 #include "platform/weborigin/SchemeRegistry.h" 194 #include "platform/weborigin/SchemeRegistry.h"
195 #include "platform/weborigin/SecurityOrigin.h" 195 #include "platform/weborigin/SecurityOrigin.h"
196 #include "public/platform/Platform.h" 196 #include "public/platform/Platform.h"
197 #include "wtf/CurrentTime.h" 197 #include "wtf/CurrentTime.h"
198 #include "wtf/DateMath.h"
198 #include "wtf/HashFunctions.h" 199 #include "wtf/HashFunctions.h"
199 #include "wtf/MainThread.h" 200 #include "wtf/MainThread.h"
200 #include "wtf/StdLibExtras.h" 201 #include "wtf/StdLibExtras.h"
201 #include "wtf/TemporaryChange.h" 202 #include "wtf/TemporaryChange.h"
202 #include "wtf/text/StringBuffer.h" 203 #include "wtf/text/StringBuffer.h"
203 #include "wtf/text/TextEncodingRegistry.h" 204 #include "wtf/text/TextEncodingRegistry.h"
204 205
205 using namespace WTF; 206 using namespace WTF;
206 using namespace Unicode; 207 using namespace Unicode;
207 208
(...skipping 3863 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 4072
4072 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified 4073 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
4073 String Document::lastModified() const 4074 String Document::lastModified() const
4074 { 4075 {
4075 DateComponents date; 4076 DateComponents date;
4076 bool foundDate = false; 4077 bool foundDate = false;
4077 if (m_frame) { 4078 if (m_frame) {
4078 if (DocumentLoader* documentLoader = loader()) { 4079 if (DocumentLoader* documentLoader = loader()) {
4079 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified"); 4080 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified");
4080 if (!httpLastModified.isEmpty()) { 4081 if (!httpLastModified.isEmpty()) {
4081 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModi fied)); 4082 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(par seDate(httpLastModified)));
4082 foundDate = true; 4083 foundDate = true;
4083 } 4084 }
4084 } 4085 }
4085 } 4086 }
4086 // FIXME: If this document came from the file system, the HTML5 4087 // FIXME: If this document came from the file system, the HTML5
4087 // specificiation tells us to read the last modification date from the file 4088 // specificiation tells us to read the last modification date from the file
4088 // system. 4089 // system.
4089 if (!foundDate) 4090 if (!foundDate)
4090 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); 4091 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(currentTime MS()));
4091 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); 4092 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second());
4092 } 4093 }
4093 4094
4094 const KURL& Document::firstPartyForCookies() const 4095 const KURL& Document::firstPartyForCookies() const
4095 { 4096 {
4096 return topDocument().url(); 4097 return topDocument().url();
4097 } 4098 }
4098 4099
4099 static bool isValidNameNonASCII(const LChar* characters, unsigned length) 4100 static bool isValidNameNonASCII(const LChar* characters, unsigned length)
4100 { 4101 {
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after
5887 using namespace blink; 5888 using namespace blink;
5888 void showLiveDocumentInstances() 5889 void showLiveDocumentInstances()
5889 { 5890 {
5890 WeakDocumentSet& set = liveDocumentSet(); 5891 WeakDocumentSet& set = liveDocumentSet();
5891 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5892 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5892 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5893 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5893 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5894 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5894 } 5895 }
5895 } 5896 }
5896 #endif 5897 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698