Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4062 if (result == OriginAccessEntry::MatchesOriginButIsPublicSuffix) { | 4063 if (result == OriginAccessEntry::MatchesOriginButIsPublicSuffix) { |
| 4063 exceptionState.throwSecurityError("'" + newDomain + "' is a top-level do main."); | 4064 exceptionState.throwSecurityError("'" + newDomain + "' is a top-level do main."); |
| 4064 return; | 4065 return; |
| 4065 } | 4066 } |
| 4066 | 4067 |
| 4067 securityOrigin()->setDomainFromDOM(newDomain); | 4068 securityOrigin()->setDomainFromDOM(newDomain); |
| 4068 if (m_frame) | 4069 if (m_frame) |
| 4069 m_frame->script().updateSecurityOrigin(securityOrigin()); | 4070 m_frame->script().updateSecurityOrigin(securityOrigin()); |
| 4070 } | 4071 } |
| 4071 | 4072 |
| 4073 static double convertToLocalTime(double ms) | |
|
tkent
2014/07/18 14:16:56
We have this calculation at multiple places.
https
kangil_
2014/07/21 02:34:42
Done.
| |
| 4074 { | |
| 4075 double utcOffset = calculateUTCOffset(); | |
| 4076 double dstOffset = calculateDSTOffset(ms, utcOffset); | |
| 4077 return (ms + utcOffset + dstOffset); | |
| 4078 } | |
| 4079 | |
| 4072 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified | 4080 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified |
| 4073 String Document::lastModified() const | 4081 String Document::lastModified() const |
| 4074 { | 4082 { |
| 4075 DateComponents date; | 4083 DateComponents date; |
| 4076 bool foundDate = false; | 4084 bool foundDate = false; |
| 4077 if (m_frame) { | 4085 if (m_frame) { |
| 4078 if (DocumentLoader* documentLoader = loader()) { | 4086 if (DocumentLoader* documentLoader = loader()) { |
| 4079 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified"); | 4087 const AtomicString& httpLastModified = documentLoader->response().ht tpHeaderField("Last-Modified"); |
| 4080 if (!httpLastModified.isEmpty()) { | 4088 if (!httpLastModified.isEmpty()) { |
| 4081 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModi fied)); | 4089 date.setMillisecondsSinceEpochForDateTime(convertToLocalTime(par seDate(httpLastModified))); |
| 4082 foundDate = true; | 4090 foundDate = true; |
| 4083 } | 4091 } |
| 4084 } | 4092 } |
| 4085 } | 4093 } |
| 4086 // FIXME: If this document came from the file system, the HTML5 | 4094 // FIXME: If this document came from the file system, the HTML5 |
| 4087 // specificiation tells us to read the last modification date from the file | 4095 // specificiation tells us to read the last modification date from the file |
| 4088 // system. | 4096 // system. |
| 4089 if (!foundDate) | 4097 if (!foundDate) |
| 4090 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); | 4098 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()); | 4099 return String::format("%02d/%02d/%04d %02d:%02d:%02d", date.month() + 1, dat e.monthDay(), date.fullYear(), date.hour(), date.minute(), date.second()); |
| 4092 } | 4100 } |
| 4093 | 4101 |
| 4094 const KURL& Document::firstPartyForCookies() const | 4102 const KURL& Document::firstPartyForCookies() const |
| 4095 { | 4103 { |
| 4096 return topDocument().url(); | 4104 return topDocument().url(); |
| 4097 } | 4105 } |
| 4098 | 4106 |
| 4099 static bool isValidNameNonASCII(const LChar* characters, unsigned length) | 4107 static bool isValidNameNonASCII(const LChar* characters, unsigned length) |
| 4100 { | 4108 { |
| (...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5887 using namespace WebCore; | 5895 using namespace WebCore; |
| 5888 void showLiveDocumentInstances() | 5896 void showLiveDocumentInstances() |
| 5889 { | 5897 { |
| 5890 WeakDocumentSet& set = liveDocumentSet(); | 5898 WeakDocumentSet& set = liveDocumentSet(); |
| 5891 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5899 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5892 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { | 5900 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()); | 5901 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); |
| 5894 } | 5902 } |
| 5895 } | 5903 } |
| 5896 #endif | 5904 #endif |
| OLD | NEW |