[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c

jianli at chromium.org jianli at chromium.org
Mon Dec 27 16:25:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6d5a411f19e01978e430f9048aa945a77e7259dd
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 21 02:17:26 2010 +0000

    Add lastModifiedDate attribute to File interface per File API spec
    https://bugs.webkit.org/show_bug.cgi?id=49895
    
    Reviewed by David Levin.
    
    WebCore:
    
    lastModifiedDate is not supported for GObject bindings because Date is
    not support in code generation.
    
    Test: http/tests/local/fileapi/file-last-modified.html
    
    * fileapi/File.cpp:
    (WebCore::File::lastModifiedDate):
    * fileapi/File.h:
    * fileapi/File.idl:
    
    LayoutTests:
    
    * http/tests/local/fileapi/file-last-modified-expected.txt: Added.
    * http/tests/local/fileapi/file-last-modified.html: Added.
    * http/tests/local/fileapi/script-tests/file-last-modified.js: Added.
    * http/tests/resources/file-last-modified.php: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74380 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c72548b..b156b0d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-20  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
+        Add lastModifiedDate attribute to File interface per File API spec
+        https://bugs.webkit.org/show_bug.cgi?id=49895
+
+        * http/tests/local/fileapi/file-last-modified-expected.txt: Added.
+        * http/tests/local/fileapi/file-last-modified.html: Added.
+        * http/tests/local/fileapi/script-tests/file-last-modified.js: Added.
+        * http/tests/resources/file-last-modified.php: Added.
+
 2010-12-20  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/LayoutTests/http/tests/local/fileapi/file-last-modified-expected.txt b/LayoutTests/http/tests/local/fileapi/file-last-modified-expected.txt
new file mode 100644
index 0000000..1ff107a
--- /dev/null
+++ b/LayoutTests/http/tests/local/fileapi/file-last-modified-expected.txt
@@ -0,0 +1,11 @@
+Test File.lastModifiedDate.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.dataTransfer contains a File object on drop.
+PASS file.lastModifiedDate verified
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/local/fileapi/file-last-modified.html b/LayoutTests/http/tests/local/fileapi/file-last-modified.html
new file mode 100644
index 0000000..89e173e
--- /dev/null
+++ b/LayoutTests/http/tests/local/fileapi/file-last-modified.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../../fast/js/resources/js-test-style.css">
+<script src="../../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/setup-file-input-element-for-drag.js"></script>
+<script src="script-tests/file-last-modified.js"></script>
+<script src="../../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified.js b/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified.js
new file mode 100644
index 0000000..e104737
--- /dev/null
+++ b/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified.js
@@ -0,0 +1,33 @@
+description("Test File.lastModifiedDate.");
+
+function onFileDrop(file, filePath)
+{
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", "http://127.0.0.1:8000/resources/file-last-modified.php?path=../local/fileapi/" + filePath, false);
+    xhr.send();
+    var expectedDate = new Date(parseInt(xhr.responseText) * 1000);
+    var actualDate = file.lastModifiedDate;
+    if (expectedDate.toString() == actualDate.toString())
+        testPassed("file.lastModifiedDate verified");
+    else
+        testFailed("file.lastModifiedDate incorrect");
+}
+
+function runTest()
+{
+    var testFilePath = "../resources/file-for-drag-to-send.txt";
+    setFileInputDropCallback(function(file) { onFileDrop(file, testFilePath); });
+    eventSender.beginDragWithFiles([testFilePath]);
+    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;
diff --git a/LayoutTests/http/tests/resources/file-last-modified.php b/LayoutTests/http/tests/resources/file-last-modified.php
new file mode 100644
index 0000000..efcf950
--- /dev/null
+++ b/LayoutTests/http/tests/resources/file-last-modified.php
@@ -0,0 +1,7 @@
+<?php
+date_default_timezone_set('UTC');
+$filePath = $_GET['path'];
+if (file_exists($filePath)) {
+    echo date("U", filemtime($filePath));
+}
+?>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 186e56c..0fd434b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-20  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
+        Add lastModifiedDate attribute to File interface per File API spec
+        https://bugs.webkit.org/show_bug.cgi?id=49895
+
+        lastModifiedDate is not supported for GObject bindings because Date is
+        not support in code generation.
+
+        Test: http/tests/local/fileapi/file-last-modified.html
+
+        * fileapi/File.cpp:
+        (WebCore::File::lastModifiedDate):
+        * fileapi/File.h:
+        * fileapi/File.idl:
+
 2010-12-20  Mark Rowe  <mrowe at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/fileapi/File.cpp b/WebCore/fileapi/File.cpp
index 51ada6c..dd81f5a 100644
--- a/WebCore/fileapi/File.cpp
+++ b/WebCore/fileapi/File.cpp
@@ -28,6 +28,8 @@
 
 #include "FileSystem.h"
 #include "MIMETypeRegistry.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -68,6 +70,16 @@ File::File(const String& relativePath, const String& path)
 }
 #endif
 
+double File::lastModifiedDate() const
+{
+    time_t modificationTime;
+    if (!getFileModificationTime(m_path, modificationTime))
+        return 0;
+
+    // Needs to return epoch time in milliseconds for Date.
+    return modificationTime * 1000.0;
+}
+
 unsigned long long File::size() const
 {
     // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to
diff --git a/WebCore/fileapi/File.h b/WebCore/fileapi/File.h
index 06b03cd..d22b035 100644
--- a/WebCore/fileapi/File.h
+++ b/WebCore/fileapi/File.h
@@ -60,6 +60,7 @@ public:
 
     const String& path() const { return m_path; }
     const String& name() const { return m_name; }
+    double lastModifiedDate() 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; }
@@ -91,4 +92,4 @@ private:
 
 } // namespace WebCore
 
-#endif // FileList_h
+#endif // File_h
diff --git a/WebCore/fileapi/File.idl b/WebCore/fileapi/File.idl
index 1937901..74a6f76 100644
--- a/WebCore/fileapi/File.idl
+++ b/WebCore/fileapi/File.idl
@@ -31,6 +31,9 @@ module html {
         NoStaticTables
     ] File : Blob {
         readonly attribute DOMString name;
+#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
+        readonly attribute Date lastModifiedDate;
+#endif
 #if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD
         readonly attribute DOMString webkitRelativePath;
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list