Diff
Modified: trunk/Source/WebCore/ChangeLog (119679 => 119680)
--- trunk/Source/WebCore/ChangeLog 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/ChangeLog 2012-06-07 04:34:40 UTC (rev 119680)
@@ -1,3 +1,28 @@
+2012-06-06 Kinuko Yasuda <[email protected]>
+
+ File::lastModifiedDate should use NaN or separate boolean flag for null Date value
+ https://bugs.webkit.org/show_bug.cgi?id=87826
+
+ Reviewed by Kent Tamura.
+
+ Test: http/tests/local/fileapi/file-last-modified-after-delete.html
+
+ * fileapi/File.cpp:
+ (WebCore::File::File):
+ (WebCore::File::captureSnapshot):
+ (WebCore::File::lastModifiedDate):
+ (WebCore::File::lastModifiedDateForBinding): Removed.
+ * fileapi/File.h:
+ (File):
+ * fileapi/File.idl:
+ * platform/FileMetadata.h:
+ (WebCore::FileMetadata::FileMetadata):
+ * platform/FileSystem.h:
+ * platform/chromium/support/WebHTTPBody.cpp:
+ (WebKit::WebHTTPBody::elementAt):
+ * platform/network/BlobData.cpp:
+ (WebCore):
+
2012-06-06 Sheriff Bot <[email protected]>
Unreviewed, rolling out r119668.
Modified: trunk/Source/WebCore/fileapi/File.cpp (119679 => 119680)
--- trunk/Source/WebCore/fileapi/File.cpp 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/fileapi/File.cpp 2012-06-07 04:34:40 UTC (rev 119680)
@@ -30,6 +30,7 @@
#include "FileSystem.h"
#include "MIMETypeRegistry.h"
#include <wtf/CurrentTime.h>
+#include <wtf/MathExtras.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -86,7 +87,7 @@
, m_name(pathGetFileName(path))
#if ENABLE(FILE_SYSTEM)
, m_snapshotSize(-1)
- , m_snapshotModificationTime(0)
+ , m_snapshotModificationTime(invalidTime)
#endif
{
}
@@ -96,7 +97,7 @@
, m_path(path)
#if ENABLE(FILE_SYSTEM)
, m_snapshotSize(-1)
- , m_snapshotModificationTime(0)
+ , m_snapshotModificationTime(invalidTime)
#endif
{
m_name = pathGetFileName(path);
@@ -111,7 +112,7 @@
, m_name(name)
#if ENABLE(FILE_SYSTEM)
, m_snapshotSize(-1)
- , m_snapshotModificationTime(0)
+ , m_snapshotModificationTime(invalidTime)
#endif
{
}
@@ -136,18 +137,12 @@
time_t modificationTime;
if (!getFileModificationTime(m_path, modificationTime))
- return 0;
+ return invalidTime;
// Needs to return epoch time in milliseconds for Date.
return modificationTime * 1000.0;
}
-double File::lastModifiedDateForBinding() const
-{
- double value = lastModifiedDate();
- return (!value) ? std::numeric_limits<double>::quiet_NaN() : value;
-}
-
unsigned long long File::size() const
{
#if ENABLE(FILE_SYSTEM)
@@ -178,7 +173,7 @@
FileMetadata metadata;
if (!getFileMetadata(m_path, metadata)) {
snapshotSize = 0;
- snapshotModificationTime = 0;
+ snapshotModificationTime = invalidTime;
return;
}
Modified: trunk/Source/WebCore/fileapi/File.h (119679 => 119680)
--- trunk/Source/WebCore/fileapi/File.h 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/fileapi/File.h 2012-06-07 04:34:40 UTC (rev 119680)
@@ -77,12 +77,9 @@
const String& path() const { return m_path; }
const String& name() const { return m_name; }
- // This may return zero if getFileModificationTime() platform call has failed or zero snapshot lastModifiedTime is given at construction time.
+ // This may return NaN (which is converted to null Date in _javascript_ layer) if getFileModificationTime() platform call has failed or the information is not available.
double lastModifiedDate() const;
- // For binding. We want to return null Date if we get the value 0 Date (which is used to indicate the information is unavailable).
- double lastModifiedDateForBinding() const;
-
#if ENABLE(DIRECTORY_UPLOAD)
// Returns the relative path of this file in the context of a directory selection.
const String& webkitRelativePath() const { return m_relativePath; }
Modified: trunk/Source/WebCore/fileapi/File.idl (119679 => 119680)
--- trunk/Source/WebCore/fileapi/File.idl 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/fileapi/File.idl 2012-06-07 04:34:40 UTC (rev 119680)
@@ -32,7 +32,7 @@
] File : Blob {
readonly attribute DOMString name;
#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
- readonly attribute [ImplementedAs=lastModifiedDateForBinding] Date lastModifiedDate;
+ readonly attribute Date lastModifiedDate;
#endif
#if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD
readonly attribute DOMString webkitRelativePath;
Modified: trunk/Source/WebCore/platform/FileMetadata.h (119679 => 119680)
--- trunk/Source/WebCore/platform/FileMetadata.h 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/platform/FileMetadata.h 2012-06-07 04:34:40 UTC (rev 119680)
@@ -31,6 +31,7 @@
#ifndef FileMetadata_h
#define FileMetadata_h
+#include "FileSystem.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -56,7 +57,7 @@
String platformPath;
#endif
- FileMetadata() : modificationTime(0.0), length(-1), type(TypeUnknown) { }
+ FileMetadata() : modificationTime(invalidTime), length(-1), type(TypeUnknown) { }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/FileSystem.h (119679 => 119680)
--- trunk/Source/WebCore/platform/FileSystem.h 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/platform/FileSystem.h 2012-06-07 04:34:40 UTC (rev 119680)
@@ -145,6 +145,8 @@
SeekFromEnd
};
+const double invalidTime = std::numeric_limits<double>::quiet_NaN();
+
#if OS(WINDOWS)
static const char PlatformFilePathSeparator = '\\';
#else
Modified: trunk/Source/WebCore/platform/chromium/support/WebHTTPBody.cpp (119679 => 119680)
--- trunk/Source/WebCore/platform/chromium/support/WebHTTPBody.cpp 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/platform/chromium/support/WebHTTPBody.cpp 2012-06-07 04:34:40 UTC (rev 119680)
@@ -31,6 +31,7 @@
#include "config.h"
#include <public/WebHTTPBody.h>
+#include "FileSystem.h"
#include "FormData.h"
using namespace WebCore;
@@ -77,7 +78,7 @@
result.filePath.reset();
result.fileStart = 0;
result.fileLength = 0;
- result.modificationTime = 0.0;
+ result.modificationTime = invalidTime;
result.blobURL = KURL();
switch (element.m_type) {
Modified: trunk/Source/WebCore/platform/network/BlobData.cpp (119679 => 119680)
--- trunk/Source/WebCore/platform/network/BlobData.cpp 2012-06-07 04:34:23 UTC (rev 119679)
+++ trunk/Source/WebCore/platform/network/BlobData.cpp 2012-06-07 04:34:40 UTC (rev 119680)
@@ -30,6 +30,7 @@
#include "config.h"
#include "BlobData.h"
+#include "FileSystem.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -40,7 +41,7 @@
namespace WebCore {
const long long BlobDataItem::toEndOfFile = -1;
-const double BlobDataItem::doNotCheckFileChange = 0;
+const double BlobDataItem::doNotCheckFileChange = invalidTime;
RawData::RawData()
{