Diff
Modified: trunk/LayoutTests/ChangeLog (118919 => 118920)
--- trunk/LayoutTests/ChangeLog 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/LayoutTests/ChangeLog 2012-05-30 13:57:32 UTC (rev 118920)
@@ -1,3 +1,17 @@
+2012-05-30 Kinuko Yasuda <[email protected]>
+
+ File.lastModifiedDate must return null if the modified time info is not available
+ https://bugs.webkit.org/show_bug.cgi?id=87709
+
+ Reviewed by Kentaro Hara.
+
+ * http/tests/local/fileapi/file-last-modified-after-delete-expected.txt: Added.
+ * http/tests/local/fileapi/file-last-modified-after-delete.html: Added.
+ * http/tests/local/fileapi/resources/temp-file-utils.js: Added.
+ * http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js: Added.
+ * http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js: Factored out common temp-file related functions into temp-file-utils.js.
+ * http/tests/local/fileapi/send-sliced-dragged-file.html:
+
2012-05-30 Mikhail Pozdnyakov <[email protected]>
[EFL][DRT] EFL's DRT needs "postProgressFinishedNotification" message
Added: trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt (0 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt 2012-05-30 13:57:32 UTC (rev 118920)
@@ -0,0 +1,11 @@
+Test File.lastModifiedDate returns null if the information is not available.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.dataTransfer contains a File object on drop.
+PASS lastModifiedDate is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete.html (from rev 118918, trunk/LayoutTests/http/tests/local/fileapi/send-sliced-dragged-file.html) (0 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete.html (rev 0)
+++ trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete.html 2012-05-30 13:57:32 UTC (rev 118920)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/local/fileapi/resources/temp-file-utils.js (0 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/resources/temp-file-utils.js (rev 0)
+++ trunk/LayoutTests/http/tests/local/fileapi/resources/temp-file-utils.js 2012-05-30 13:57:32 UTC (rev 118920)
@@ -0,0 +1,32 @@
+function createTempFile(fileName, fileData)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "http://127.0.0.1:8000/resources/write-temp-file.php?filename=" + fileName + "&data="" + fileData, false);
+ xhr.send();
+ if (xhr.status != 200) {
+ testFailed("Unexpected response status received: " + xhr.status);
+ return;
+ }
+
+ var values = xhr.responseText.split('\n');
+ if (xhr.responseText.indexOf("FAIL") == 0) {
+ testFailed("Unexpected response text received: " + xhr.responseText);
+ return;
+ }
+
+ return xhr.responseText;
+}
+
+function touchTempFile(fileName)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "http://127.0.0.1:8000/resources/touch-temp-file.php?filename=" + fileName, false);
+ xhr.send();
+}
+
+function removeTempFile(fileName)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "http://127.0.0.1:8000/resources/reset-temp-file.php?filename=" + fileName, false);
+ xhr.send();
+}
Added: trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js (0 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js (rev 0)
+++ trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js 2012-05-30 13:57:32 UTC (rev 118920)
@@ -0,0 +1,37 @@
+description("Test File.lastModifiedDate returns null if the information is not available.");
+
+var tempFileContent = "1234567890";
+var tempFileName = "file-last-modified-after-delete.tmp";
+var lastModifiedDate;
+
+function onFileDrop(file)
+{
+ // Remove the temp file.
+ removeTempFile(tempFileName);
+
+ // 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');
+}
+
+function runTest()
+{
+ var tempFilePath = createTempFile(tempFileName, tempFileContent);
+ if (tempFilePath.length == 0)
+ return;
+
+ setFileInputDropCallback(onFileDrop);
+ eventSender.beginDragWithFiles([tempFilePath]);
+ moveMouseToCenterOfElement(fileInput);
+ eventSender.mouseUp();
+}
+
+if (window.eventSender) {
+ runTest();
+ // Clean up after ourselves
+ removeFileInputElement();
+} else {
+ testFailed("This test is not interactive, please run using DumpRenderTree");
+}
+
+var successfullyParsed = true;
Modified: trunk/LayoutTests/http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js (118919 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/LayoutTests/http/tests/local/fileapi/script-tests/send-sliced-dragged-file.js 2012-05-30 13:57:32 UTC (rev 118920)
@@ -41,39 +41,6 @@
testFailed(message);
}
-function createTempFile(fileData)
-{
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "http://127.0.0.1:8000/resources/write-temp-file.php?filename=" + tempFileName + "&data="" + fileData, false);
- xhr.send();
- if (xhr.status != 200) {
- testFailed("Unexpected response status received: " + xhr.status);
- return;
- }
-
- var values = xhr.responseText.split('\n');
- if (xhr.responseText.indexOf("FAIL") == 0) {
- testFailed("Unexpected response text received: " + xhr.responseText);
- return;
- }
-
- return xhr.responseText;
-}
-
-function touchTempFile()
-{
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "http://127.0.0.1:8000/resources/touch-temp-file.php?filename=" + tempFileName, false);
- xhr.send();
-}
-
-function removeTempFile()
-{
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "http://127.0.0.1:8000/resources/reset-temp-file.php?filename=" + tempFileName, false);
- xhr.send();
-}
-
function computeExpectedLength(fileLength, start, length)
{
var expectedLength = length;
@@ -116,18 +83,18 @@
uploadFile(subfile, filePath, start, length, false);
// Touch the underlying temp file.
- touchTempFile();
+ touchTempFile(tempFileName);
// Upload the sliced file. We should receive an exception since the file has been changed.
uploadFile(subfile, filePath, start, length, true);
// Remove the temp file.
- removeTempFile();
+ removeTempFile(tempFileName);
}
function dragAndSliceUnstableFile(start, length, contentType)
{
- var tempFilePath = createTempFile(tempFileContent);
+ var tempFilePath = createTempFile(tempFileName, tempFileContent);
if (tempFilePath.length == 0)
return;
Modified: trunk/LayoutTests/http/tests/local/fileapi/send-sliced-dragged-file.html (118919 => 118920)
--- trunk/LayoutTests/http/tests/local/fileapi/send-sliced-dragged-file.html 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/LayoutTests/http/tests/local/fileapi/send-sliced-dragged-file.html 2012-05-30 13:57:32 UTC (rev 118920)
@@ -7,6 +7,7 @@
<p id="description"></p>
<div id="console"></div>
<script src=""
+<script src=""
<script src=""
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (118919 => 118920)
--- trunk/Source/WebCore/ChangeLog 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/Source/WebCore/ChangeLog 2012-05-30 13:57:32 UTC (rev 118920)
@@ -1,3 +1,23 @@
+2012-05-30 Kinuko Yasuda <[email protected]>
+
+ File.lastModifiedDate must return null if the modified time info is not available
+ https://bugs.webkit.org/show_bug.cgi?id=87709
+
+ Reviewed by Kentaro Hara.
+
+ Per File API spec, File.lastModifiedDate must return null if the
+ modified time info is not available.
+ http://dev.w3.org/2006/webapi/FileAPI/#dfn-lastModifiedDate
+
+ Test: http/tests/local/fileapi/file-last-modified-after-delete.html
+
+ * fileapi/File.cpp:
+ (WebCore::File::lastModifiedDateForBinding): Added.
+ (WebCore):
+ * fileapi/File.h:
+ (File):
+ * fileapi/File.idl: Added ImplementedAs=lastModifiedDateForBinding.
+
2012-05-30 Jochen Eisinger <[email protected]>
Match Firefox restrictions to window.blur and window.focus
Modified: trunk/Source/WebCore/fileapi/File.cpp (118919 => 118920)
--- trunk/Source/WebCore/fileapi/File.cpp 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/Source/WebCore/fileapi/File.cpp 2012-05-30 13:57:32 UTC (rev 118920)
@@ -142,6 +142,12 @@
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)
Modified: trunk/Source/WebCore/fileapi/File.h (118919 => 118920)
--- trunk/Source/WebCore/fileapi/File.h 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/Source/WebCore/fileapi/File.h 2012-05-30 13:57:32 UTC (rev 118920)
@@ -80,6 +80,9 @@
// This may return zero if getFileModificationTime() platform call has failed or zero snapshot lastModifiedTime is given at construction time.
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 (118919 => 118920)
--- trunk/Source/WebCore/fileapi/File.idl 2012-05-30 13:56:09 UTC (rev 118919)
+++ trunk/Source/WebCore/fileapi/File.idl 2012-05-30 13:57:32 UTC (rev 118920)
@@ -32,8 +32,7 @@
] File : Blob {
readonly attribute DOMString name;
#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
- // FIXME: this should return null Date if the value is 0.
- readonly attribute Date lastModifiedDate;
+ readonly attribute [ImplementedAs=lastModifiedDateForBinding] Date lastModifiedDate;
#endif
#if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD
readonly attribute DOMString webkitRelativePath;