Title: [145035] trunk
- Revision
- 145035
- Author
- [email protected]
- Date
- 2013-03-06 21:20:29 -0800 (Wed, 06 Mar 2013)
Log Message
File.lastModifiedDate() should return the current date/time if the file date/time is not available
https://bugs.webkit.org/show_bug.cgi?id=111403
Reviewed by Kent Tamura.
Source/WebCore:
Per the recent File API spec change:
http://www.w3.org/TR/2012/WD-FileAPI-20121025/#dfn-lastModifiedDate
Test: http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js:
* fileapi/File.cpp:
(WebCore::File::lastModifiedDate): Changed to return the current date/time instead null if the valid file date/time is not available.
* fileapi/File.h:
(File):
LayoutTests:
* http/tests/local/fileapi/file-last-modified-after-delete-expected.txt: Updated.
* http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js: Updated.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (145034 => 145035)
--- trunk/LayoutTests/ChangeLog 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/LayoutTests/ChangeLog 2013-03-07 05:20:29 UTC (rev 145035)
@@ -1,3 +1,13 @@
+2013-03-05 Kinuko Yasuda <[email protected]>
+
+ File.lastModifiedDate() should return the current date/time if the file date/time is not available
+ https://bugs.webkit.org/show_bug.cgi?id=111403
+
+ Reviewed by Kent Tamura.
+
+ * http/tests/local/fileapi/file-last-modified-after-delete-expected.txt: Updated.
+ * http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js: Updated.
+
2013-03-06 Jer Noble <[email protected]>
Unreviewed gardening.
Modified: trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt (145034 => 145035)
--- trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt 2013-03-07 05:20:29 UTC (rev 145035)
@@ -4,7 +4,9 @@
PASS event.dataTransfer contains a File object on drop.
-PASS lastModifiedDate is null
+PASS lastModifiedDate is not null
+PASS lastModifiedDate is >= testStartTime
+PASS (new Date()).getTime() is >= lastModifiedDate
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js (145034 => 145035)
--- trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js 2013-03-07 05:20:29 UTC (rev 145035)
@@ -2,6 +2,7 @@
var tempFileContent = "1234567890";
var tempFileName = "file-last-modified-after-delete.tmp";
+var testStartTime = new Date();
var lastModifiedDate;
function onFileDrop(file)
@@ -11,7 +12,11 @@
// This synchronosly queries the file's lastModifiedDate (which should fail) until/unless we start capturing the file metadata at File construction time.
lastModifiedDate = file.lastModifiedDate;
- shouldBe('lastModifiedDate', 'null');
+
+ // The returned value should be equal to the current date/time since the file's modified date/time is not available.
+ shouldNotBe('lastModifiedDate', 'null');
+ shouldBeGreaterThanOrEqual('lastModifiedDate', 'testStartTime');
+ shouldBeGreaterThanOrEqual('(new Date()).getTime()', 'lastModifiedDate');
}
function runTest()
Modified: trunk/Source/WebCore/ChangeLog (145034 => 145035)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 05:20:29 UTC (rev 145035)
@@ -1,3 +1,20 @@
+2013-03-04 Kinuko Yasuda <[email protected]>
+
+ File.lastModifiedDate() should return the current date/time if the file date/time is not available
+ https://bugs.webkit.org/show_bug.cgi?id=111403
+
+ Reviewed by Kent Tamura.
+
+ Per the recent File API spec change:
+ http://www.w3.org/TR/2012/WD-FileAPI-20121025/#dfn-lastModifiedDate
+
+ Test: http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js:
+
+ * fileapi/File.cpp:
+ (WebCore::File::lastModifiedDate): Changed to return the current date/time instead null if the valid file date/time is not available.
+ * fileapi/File.h:
+ (File):
+
2013-03-06 Philippe Liard <[email protected]>
Make RuleData support up to 8191 selectors
Modified: trunk/Source/WebCore/fileapi/File.cpp (145034 => 145035)
--- trunk/Source/WebCore/fileapi/File.cpp 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/Source/WebCore/fileapi/File.cpp 2013-03-07 05:20:29 UTC (rev 145035)
@@ -30,6 +30,7 @@
#include "FileSystem.h"
#include "MIMETypeRegistry.h"
#include <wtf/CurrentTime.h>
+#include <wtf/DateMath.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -152,16 +153,15 @@
double File::lastModifiedDate() const
{
#if ENABLE(FILE_SYSTEM)
- if (hasValidSnapshotMetadata())
- return m_snapshotModificationTime * 1000.0;
+ if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime))
+ return m_snapshotModificationTime * msPerSecond;
#endif
time_t modificationTime;
- if (!getFileModificationTime(m_path, modificationTime))
- return invalidFileTime();
+ if (getFileModificationTime(m_path, modificationTime) && isValidFileTime(modificationTime))
+ return modificationTime * msPerSecond;
- // Needs to return epoch time in milliseconds for Date.
- return modificationTime * 1000.0;
+ return currentTime() * msPerSecond;
}
unsigned long long File::size() const
Modified: trunk/Source/WebCore/fileapi/File.h (145034 => 145035)
--- trunk/Source/WebCore/fileapi/File.h 2013-03-07 04:54:39 UTC (rev 145034)
+++ trunk/Source/WebCore/fileapi/File.h 2013-03-07 05:20:29 UTC (rev 145035)
@@ -91,7 +91,7 @@
const String& path() const { return m_path; }
const String& name() const { return m_name; }
- // 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.
+ // This returns the current date and time if the file's last modifiecation date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate).
double lastModifiedDate() const;
#if ENABLE(DIRECTORY_UPLOAD)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes