[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
kinuko at chromium.org
kinuko at chromium.org
Wed Dec 22 14:41:40 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a55b0f9aff22a6ba30704197731a5caaf353963a
Author: kinuko at chromium.org <kinuko at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 16 02:05:55 2010 +0000
2010-10-15 Kinuko Yasuda <kinuko at google.com>
Reviewed by Jian Li.
Implement FileEntrySync.file() in FileSystem API
https://bugs.webkit.org/show_bug.cgi?id=47310
Tests: fast/filesystem/workers/file-from-file-entry-sync.html
fast/filesystem/workers/file-from-file-entry.html
* fileapi/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::createFile): Added.
* fileapi/DOMFileSystem.h:
* fileapi/DOMFileSystemSync.cpp:
(WebCore::DOMFileSystemSync::createFile): Added.
* fileapi/DOMFileSystemSync.h:
* fileapi/DirectoryReaderBase.h: Added 'virtual path' comment.
* fileapi/EntryBase.h: Added 'virtual path' comment.
* fileapi/FileEntry.cpp:
(WebCore::FileEntry::file): Changed to use DOMFileSystem::createFile.
* fileapi/FileEntrySync.cpp:
(WebCore::FileEntrySync::file): Implemented.
* fileapi/FileEntrySync.h:
* fileapi/FileEntrySync.idl: Added file().
2010-10-15 Kinuko Yasuda <kinuko at chromium.org>
Reviewed by Jian Li.
Implement FileEntrySync.file() in FileSystem API
https://bugs.webkit.org/show_bug.cgi?id=47310
* fast/filesystem/file-from-file-entry-expected.txt:
* fast/filesystem/file-from-file-entry.html:
* fast/filesystem/resources/file-from-file-entry-sync.js: Added.
* fast/filesystem/resources/file-from-file-entry.js: Added.
* fast/filesystem/script-tests/file-from-file-entry.js: Moved to
resources to make it available for workers tests too.
* fast/filesystem/workers/file-from-file-entry-expected.txt: Added.
* fast/filesystem/workers/file-from-file-entry-sync-expected.txt: Added.
* fast/filesystem/workers/file-from-file-entry-sync.html: Added.
* fast/filesystem/workers/file-from-file-entry.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 68ef425..bcb097a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-15 Kinuko Yasuda <kinuko at chromium.org>
+
+ Reviewed by Jian Li.
+
+ Implement FileEntrySync.file() in FileSystem API
+ https://bugs.webkit.org/show_bug.cgi?id=47310
+
+ * fast/filesystem/file-from-file-entry-expected.txt:
+ * fast/filesystem/file-from-file-entry.html:
+ * fast/filesystem/resources/file-from-file-entry-sync.js: Added.
+ * fast/filesystem/resources/file-from-file-entry.js: Added.
+ * fast/filesystem/script-tests/file-from-file-entry.js: Moved to
+ resources to make it available for workers tests too.
+ * fast/filesystem/workers/file-from-file-entry-expected.txt: Added.
+ * fast/filesystem/workers/file-from-file-entry-sync-expected.txt: Added.
+ * fast/filesystem/workers/file-from-file-entry-sync.html: Added.
+ * fast/filesystem/workers/file-from-file-entry.html: Added.
+
2010-10-15 Oliver Hunt <oliver at apple.com>
Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/filesystem/file-from-file-entry-expected.txt b/LayoutTests/fast/filesystem/file-from-file-entry-expected.txt
index 9dfaf96..d2c64cf 100644
--- a/LayoutTests/fast/filesystem/file-from-file-entry-expected.txt
+++ b/LayoutTests/fast/filesystem/file-from-file-entry-expected.txt
@@ -1,4 +1,4 @@
-Obtaining File from FileEntry
+Obtaining File from FileEntry.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/LayoutTests/fast/filesystem/file-from-file-entry.html b/LayoutTests/fast/filesystem/file-from-file-entry.html
index dae708c..ba462d0 100644
--- a/LayoutTests/fast/filesystem/file-from-file-entry.html
+++ b/LayoutTests/fast/filesystem/file-from-file-entry.html
@@ -7,7 +7,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/file-from-file-entry.js"></script>
+<script src="resources/file-from-file-entry.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/filesystem/resources/file-from-file-entry-sync.js b/LayoutTests/fast/filesystem/resources/file-from-file-entry-sync.js
new file mode 100644
index 0000000..ddd9f5f
--- /dev/null
+++ b/LayoutTests/fast/filesystem/resources/file-from-file-entry-sync.js
@@ -0,0 +1,20 @@
+// FIXME: move this under workers/resources
+importScripts('fs-worker-common.js');
+
+description("Obtaining File from FileEntrySync.");
+
+var fileSystem = requestFileSystemSync(this.TEMPORARY, 100);
+removeAllInDirectorySync(fileSystem.root);
+
+var testFileName = '/testFileEntry.txt';
+
+var testFileEntry = fileSystem.root.getFile(testFileName, {create:true});
+var testFile = testFileEntry.file();
+
+shouldBe("testFile.name", "testFileEntry.name");
+shouldBe("testFile.type", "'text/plain'");
+shouldBe("testFile.size", "0");
+
+removeAllInDirectorySync(fileSystem.root);
+finishJSTest();
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/filesystem/resources/file-from-file-entry.js b/LayoutTests/fast/filesystem/resources/file-from-file-entry.js
new file mode 100644
index 0000000..72ec82f
--- /dev/null
+++ b/LayoutTests/fast/filesystem/resources/file-from-file-entry.js
@@ -0,0 +1,42 @@
+if (this.importScripts) {
+ importScripts('fs-worker-common.js');
+ importScripts('fs-test-util.js');
+}
+
+description("Obtaining File from FileEntry.");
+
+var fileSystem = null;
+var testFileName = '/testFileEntry.txt';
+var testFileEntry = null;
+var testFile = null;
+
+function errorCallback(error) {
+ testFailed("Error occured:" + error.code);
+ finishJSTest();
+}
+
+function fileCallback(file) {
+ testFile = file;
+ shouldBe("testFile.name", "testFileEntry.name");
+ shouldBe("testFile.type", "'text/plain'");
+ shouldBe("testFile.size", "0");
+ finishJSTest();
+}
+
+function getFileFromEntry(entry) {
+ testFileEntry = entry;
+ entry.file(fileCallback, errorCallback);
+}
+
+function createTestFile() {
+ fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);
+}
+
+function fileSystemCallback(fs) {
+ fileSystem = fs;
+ removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);
+}
+
+var jsTestIsAsync = true;
+requestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/filesystem/script-tests/file-from-file-entry.js b/LayoutTests/fast/filesystem/script-tests/file-from-file-entry.js
deleted file mode 100644
index d7f86e6..0000000
--- a/LayoutTests/fast/filesystem/script-tests/file-from-file-entry.js
+++ /dev/null
@@ -1,41 +0,0 @@
-description("Obtaining File from FileEntry");
-
-var fileSystem = null;
-var testFileName = '/testFileEntry.txt';
-var testFileEntry = null;
-var testFile = null;
-
-function errorCallback(error) {
- testFailed("Error occured:" + error.code);
- finishJSTest();
-}
-
-function fileCallback(file) {
- testFile = file;
- shouldBe("testFile.name", "testFileEntry.name");
- shouldBe("testFile.type", "'text/plain'");
- shouldBe("testFile.size", "0");
- finishJSTest();
-}
-
-function getFileFromEntry(entry) {
- testFileEntry = entry;
- entry.file(fileCallback, errorCallback);
-}
-
-function createTestFile() {
- fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);
-}
-
-function fileSystemCallback(fs) {
- fileSystem = fs;
- removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);
-}
-
-if (window.requestFileSystem) {
- window.jsTestIsAsync = true;
- requestFileSystem(window.TEMPORARY, 100, fileSystemCallback, errorCallback);
-} else
- debug("This test requires FileSystem API support.");
-
-window.successfullyParsed = true;
diff --git a/LayoutTests/fast/filesystem/workers/file-from-file-entry-expected.txt b/LayoutTests/fast/filesystem/workers/file-from-file-entry-expected.txt
new file mode 100644
index 0000000..a3bdb55
--- /dev/null
+++ b/LayoutTests/fast/filesystem/workers/file-from-file-entry-expected.txt
@@ -0,0 +1,11 @@
+This tests returning File from FileEntry in workers.
+
+Starting worker: ../resources/file-from-file-entry.js
+Description: Obtaining File from FileEntry.
+PASS: testFile.name is testFileEntry.name
+PASS: testFile.type is 'text/plain'
+PASS: testFile.size is 0
+DONE
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync-expected.txt b/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync-expected.txt
new file mode 100644
index 0000000..7b5982f
--- /dev/null
+++ b/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync-expected.txt
@@ -0,0 +1,11 @@
+This tests returning File from FileEntrySync in workers.
+
+Starting worker: ../resources/file-from-file-entry-sync.js
+Description: Obtaining File from FileEntrySync.
+PASS: testFile.name is testFileEntry.name
+PASS: testFile.type is 'text/plain'
+PASS: testFile.size is 0
+DONE
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync.html b/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync.html
new file mode 100644
index 0000000..4751fdf
--- /dev/null
+++ b/LayoutTests/fast/filesystem/workers/file-from-file-entry-sync.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script src="../resources/fs-worker-common.js"></script>
+<script src="../resources/fs-worker-test-pre.js"></script>
+</head>
+<body>
+<p id="description">This tests returning File from FileEntrySync in workers.</p>
+<div id="console"></div>
+<script>
+startWorker('../resources/file-from-file-entry-sync.js');
+</script>
+<script src="../resources/fs-worker-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/filesystem/workers/file-from-file-entry.html b/LayoutTests/fast/filesystem/workers/file-from-file-entry.html
new file mode 100644
index 0000000..03e7415
--- /dev/null
+++ b/LayoutTests/fast/filesystem/workers/file-from-file-entry.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script src="../resources/fs-worker-common.js"></script>
+<script src="../resources/fs-worker-test-pre.js"></script>
+</head>
+<body>
+<p id="description">This tests returning File from FileEntry in workers.</p>
+<div id="console"></div>
+<script>
+startWorker('../resources/file-from-file-entry.js');
+</script>
+<script src="../resources/fs-worker-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 35845a9..006a078 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-10-15 Kinuko Yasuda <kinuko at google.com>
+
+ Reviewed by Jian Li.
+
+ Implement FileEntrySync.file() in FileSystem API
+ https://bugs.webkit.org/show_bug.cgi?id=47310
+
+ Tests: fast/filesystem/workers/file-from-file-entry-sync.html
+ fast/filesystem/workers/file-from-file-entry.html
+
+ * fileapi/DOMFileSystem.cpp:
+ (WebCore::DOMFileSystem::createFile): Added.
+ * fileapi/DOMFileSystem.h:
+ * fileapi/DOMFileSystemSync.cpp:
+ (WebCore::DOMFileSystemSync::createFile): Added.
+ * fileapi/DOMFileSystemSync.h:
+ * fileapi/DirectoryReaderBase.h: Added 'virtual path' comment.
+ * fileapi/EntryBase.h: Added 'virtual path' comment.
+ * fileapi/FileEntry.cpp:
+ (WebCore::FileEntry::file): Changed to use DOMFileSystem::createFile.
+ * fileapi/FileEntrySync.cpp:
+ (WebCore::FileEntrySync::file): Implemented.
+ * fileapi/FileEntrySync.h:
+ * fileapi/FileEntrySync.idl: Added file().
+
2010-10-15 Nico Weber <thakis at chromium.org>
Reviewed by Eric Carlson.
diff --git a/WebCore/fileapi/DOMFileSystem.cpp b/WebCore/fileapi/DOMFileSystem.cpp
index b2df13b..f38acaa 100644
--- a/WebCore/fileapi/DOMFileSystem.cpp
+++ b/WebCore/fileapi/DOMFileSystem.cpp
@@ -37,6 +37,7 @@
#include "DOMFilePath.h"
#include "DirectoryEntry.h"
#include "ErrorCallback.h"
+#include "File.h"
#include "FileEntry.h"
#include "FileSystemCallbacks.h"
#include "FileWriter.h"
@@ -74,17 +75,23 @@ void DOMFileSystem::contextDestroyed()
ActiveDOMObject::contextDestroyed();
}
-void DOMFileSystem::createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- ASSERT(file);
+ ASSERT(fileEntry);
- String platformPath = m_asyncFileSystem->virtualToPlatformPath(file->fullPath());
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
RefPtr<FileWriter> fileWriter = FileWriter::create(scriptExecutionContext());
OwnPtr<FileWriterCallbacks> callbacks = FileWriterCallbacks::create(fileWriter, successCallback, errorCallback);
m_asyncFileSystem->createWriter(fileWriter.get(), platformPath, callbacks.release());
}
+void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback>)
+{
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
+ scheduleCallback(successCallback, File::create(platformPath));
+}
+
} // namespace
#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/fileapi/DOMFileSystem.h b/WebCore/fileapi/DOMFileSystem.h
index 5f44afa..1d820f1 100644
--- a/WebCore/fileapi/DOMFileSystem.h
+++ b/WebCore/fileapi/DOMFileSystem.h
@@ -40,6 +40,8 @@
namespace WebCore {
class DirectoryEntry;
+class File;
+class FileCallback;
class FileEntry;
class FileWriterCallback;
@@ -57,7 +59,8 @@ public:
virtual bool hasPendingActivity() const;
virtual void contextDestroyed();
- void createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
+ void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
+ void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback>);
// Schedule a callback. This should not cross threads (should be called on the same context thread).
// FIXME: move this to a more generic place.
diff --git a/WebCore/fileapi/DOMFileSystemSync.cpp b/WebCore/fileapi/DOMFileSystemSync.cpp
index 96c76fe..3de64a7 100644
--- a/WebCore/fileapi/DOMFileSystemSync.cpp
+++ b/WebCore/fileapi/DOMFileSystemSync.cpp
@@ -35,6 +35,8 @@
#include "DOMFilePath.h"
#include "DirectoryEntrySync.h"
+#include "File.h"
+#include "FileEntrySync.h"
namespace WebCore {
@@ -57,6 +59,13 @@ PassRefPtr<DirectoryEntrySync> DOMFileSystemSync::root()
return DirectoryEntrySync::create(this, DOMFilePath::root);
}
+PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, ExceptionCode& ec)
+{
+ ec = 0;
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
+ return File::create(platformPath);
+}
+
}
#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/fileapi/DOMFileSystemSync.h b/WebCore/fileapi/DOMFileSystemSync.h
index 9aeafc8..1856747 100644
--- a/WebCore/fileapi/DOMFileSystemSync.h
+++ b/WebCore/fileapi/DOMFileSystemSync.h
@@ -38,6 +38,8 @@
namespace WebCore {
class DirectoryEntrySync;
+class File;
+class FileEntrySync;
typedef int ExceptionCode;
@@ -54,6 +56,8 @@ public:
PassRefPtr<DirectoryEntrySync> root();
+ PassRefPtr<File> createFile(const FileEntrySync*, ExceptionCode&);
+
private:
DOMFileSystemSync(const String& name, PassOwnPtr<AsyncFileSystem>);
};
diff --git a/WebCore/fileapi/DirectoryReaderBase.h b/WebCore/fileapi/DirectoryReaderBase.h
index 7f73c6b..5a2c048 100644
--- a/WebCore/fileapi/DirectoryReaderBase.h
+++ b/WebCore/fileapi/DirectoryReaderBase.h
@@ -54,7 +54,10 @@ protected:
}
DOMFileSystemBase* m_fileSystem;
+
+ // This is a virtual path.
String m_fullPath;
+
bool m_hasMoreEntries;
};
diff --git a/WebCore/fileapi/EntryBase.h b/WebCore/fileapi/EntryBase.h
index 6abf74f..2aaeba8 100644
--- a/WebCore/fileapi/EntryBase.h
+++ b/WebCore/fileapi/EntryBase.h
@@ -67,7 +67,10 @@ protected:
friend class EntrySync;
DOMFileSystemBase* m_fileSystem;
+
+ // This is a virtual path.
String m_fullPath;
+
String m_name;
};
diff --git a/WebCore/fileapi/FileEntry.cpp b/WebCore/fileapi/FileEntry.cpp
index 80ae0d0..29cbd33 100644
--- a/WebCore/fileapi/FileEntry.cpp
+++ b/WebCore/fileapi/FileEntry.cpp
@@ -51,9 +51,9 @@ void FileEntry::createWriter(PassRefPtr<FileWriterCallback> successCallback, Pas
filesystem()->createWriter(this, successCallback, errorCallback);
}
-void FileEntry::file(PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback>)
+void FileEntry::file(PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- filesystem()->scheduleCallback(successCallback, File::create(filesystem()->asyncFileSystem()->virtualToPlatformPath(m_fullPath)));
+ filesystem()->createFile(this, successCallback, errorCallback);
}
} // namespace
diff --git a/WebCore/fileapi/FileEntrySync.cpp b/WebCore/fileapi/FileEntrySync.cpp
index 1d1760d..8fc5a77 100644
--- a/WebCore/fileapi/FileEntrySync.cpp
+++ b/WebCore/fileapi/FileEntrySync.cpp
@@ -33,6 +33,8 @@
#if ENABLE(FILE_SYSTEM)
+#include "File.h"
+
namespace WebCore {
FileEntrySync::FileEntrySync(DOMFileSystemBase* fileSystem, const String& fullPath)
@@ -40,6 +42,11 @@ FileEntrySync::FileEntrySync(DOMFileSystemBase* fileSystem, const String& fullPa
{
}
+PassRefPtr<File> FileEntrySync::file(ExceptionCode& ec)
+{
+ return filesystem()->createFile(this, ec);
+}
+
}
#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/fileapi/FileEntrySync.h b/WebCore/fileapi/FileEntrySync.h
index c222afc..d027f63 100644
--- a/WebCore/fileapi/FileEntrySync.h
+++ b/WebCore/fileapi/FileEntrySync.h
@@ -40,6 +40,8 @@
namespace WebCore {
+class File;
+
class FileEntrySync : public EntrySync {
public:
static PassRefPtr<FileEntrySync> create(DOMFileSystemBase* fileSystem, const String& fullPath)
@@ -49,6 +51,8 @@ public:
virtual bool isFile() const { return true; }
+ PassRefPtr<File> file(ExceptionCode&);
+
private:
friend class EntrySync;
FileEntrySync(DOMFileSystemBase*, const String& fullPath);
diff --git a/WebCore/fileapi/FileEntrySync.idl b/WebCore/fileapi/FileEntrySync.idl
index d88c897..e2d2871 100644
--- a/WebCore/fileapi/FileEntrySync.idl
+++ b/WebCore/fileapi/FileEntrySync.idl
@@ -35,5 +35,6 @@ module storage {
GenerateToJS,
NoStaticTables
] FileEntrySync : EntrySync {
+ File file() raises (FileException);
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list