Diff
Modified: trunk/LayoutTests/ChangeLog (221301 => 221302)
--- trunk/LayoutTests/ChangeLog 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/LayoutTests/ChangeLog 2017-08-29 17:00:09 UTC (rev 221302)
@@ -1,3 +1,21 @@
+2017-08-29 Chris Dumez <cdu...@apple.com>
+
+ Add initial support for dataTransferItem.webkitGetAsEntry()
+ https://bugs.webkit.org/show_bug.cgi?id=176038
+ <rdar://problem/34121095>
+
+ Reviewed by Wenson Hsieh.
+
+ * editing/pasteboard/datatransfer-items-drop-getAsEntry-expected.txt: Added.
+ * editing/pasteboard/datatransfer-items-drop-getAsEntry.html: Added.
+ Add layout test coverage.
+
+ * http/wpt/entries-api/interfaces-expected.txt:
+ Rebaseline test now that we support more of the API.
+
+ * platform/wk2/TestExpectations:
+ Skip new test on WK2 because it relies on beginDragWithFiles().
+
2017-08-29 Matt Lewis <jlew...@apple.com>
Marked media/video-controls-no-display-with-text-track.html and media/video-controls-in-media-document.html as flaky.
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry-expected.txt (0 => 221302)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry-expected.txt 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,32 @@
+Basic test coverage for dataTransferItem.webkitGetAsEntry()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS dataTransfer.items.length is 2
+PASS firstDataTransferItem.kind is "file"
+PASS firstDataTransferItem.type is "text/plain"
+PASS firstFile.name is "test.txt"
+PASS firstFile.size is 5
+PASS firstFile.type is "text/plain"
+PASS firstEntry.isDirectory is false
+PASS firstEntry.isFile is true
+PASS firstEntry.name is "test.txt"
+PASS firstEntry.fullPath is "/test.txt"
+PASS secondDataTransferItem.kind is "file"
+PASS secondDataTransferItem.type is ""
+PASS secondFile.name is "testFiles"
+PASS secondFile.size is 204
+PASS secondFile.type is ""
+PASS secondEntry.isDirectory is true
+PASS secondEntry.isFile is false
+PASS secondEntry.name is "testFiles"
+PASS secondEntry.fullPath is "/testFiles"
+PASS fileSystemRoot.isDirectory is true
+PASS fileSystemRoot.isFile is false
+PASS fileSystemRoot.name is ""
+PASS fileSystemRoot.fullPath is "/"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry.html (0 => 221302)
--- trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/datatransfer-items-drop-getAsEntry.html 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="dropzone" style="width: 200px; height: 200px; background-color: grey;"></div>
+<script>
+description("Basic test coverage for dataTransferItem.webkitGetAsEntry()");
+jsTestIsAsync = true;
+
+function moveMouseToCenterOfElement(element) {
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoElement(element, files) {
+ if (!window.eventSender)
+ return;
+
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(element);
+ eventSender.mouseUp();
+}
+
+var dropzone = document.getElementById('dropzone');
+dropzone._ondrop_ = function(e) {
+ e.preventDefault();
+ dataTransfer = e.dataTransfer;
+
+ shouldBe("dataTransfer.items.length", "2");
+
+ firstDataTransferItem = dataTransfer.items[0];
+ shouldBeEqualToString("firstDataTransferItem.kind", "file");
+ shouldBeEqualToString("firstDataTransferItem.type", "text/plain");
+ firstFile = firstDataTransferItem.getAsFile();
+ shouldBeEqualToString("firstFile.name", "test.txt");
+ shouldBe("firstFile.size", "5");
+ shouldBeEqualToString("firstFile.type", "text/plain");
+
+ firstEntry = firstDataTransferItem.webkitGetAsEntry();
+ shouldBeFalse("firstEntry.isDirectory");
+ shouldBeTrue("firstEntry.isFile");
+ shouldBeEqualToString("firstEntry.name", "test.txt");
+ shouldBeEqualToString("firstEntry.fullPath", "/test.txt");
+
+ // Second item.
+ secondDataTransferItem = dataTransfer.items[1];
+ shouldBeEqualToString("secondDataTransferItem.kind", "file");
+ shouldBeEqualToString("secondDataTransferItem.type", "");
+ secondFile = secondDataTransferItem.getAsFile();
+ shouldBeEqualToString("secondFile.name", "testFiles");
+ shouldBe("secondFile.size", "204"); // Chrome returns folder size, Firefox returns 0.
+ shouldBeEqualToString("secondFile.type", "");
+
+ secondEntry = secondDataTransferItem.webkitGetAsEntry();
+ shouldBeTrue("secondEntry.isDirectory");
+ shouldBeFalse("secondEntry.isFile");
+ shouldBeEqualToString("secondEntry.name", "testFiles");
+ shouldBeEqualToString("secondEntry.fullPath", "/testFiles");
+
+ fileSystemRoot = secondEntry.filesystem.root;
+ shouldBeTrue("fileSystemRoot.isDirectory");
+ shouldBeFalse("fileSystemRoot.isFile");
+ shouldBeEqualToString("fileSystemRoot.name", "");
+ shouldBeEqualToString("fileSystemRoot.fullPath", "/");
+
+ finishJSTest();
+};
+
+dropzone._ondragover_ = function(ev) {
+ ev.preventDefault();
+}
+
+_onload_ = function() {
+ dragFilesOntoElement(dropzone, ['../../fast/forms/resources/test.txt', '../../fast/forms/file/resources/testFiles']);
+}
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/http/wpt/entries-api/interfaces-expected.txt (221301 => 221302)
--- trunk/LayoutTests/http/wpt/entries-api/interfaces-expected.txt 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/LayoutTests/http/wpt/entries-api/interfaces-expected.txt 2017-08-29 17:00:09 UTC (rev 221302)
@@ -21,7 +21,7 @@
PASS FileSystemDirectoryEntry interface object name
PASS FileSystemDirectoryEntry interface: existence and properties of interface prototype object
PASS FileSystemDirectoryEntry interface: existence and properties of interface prototype object's "constructor" property
-FAIL FileSystemDirectoryEntry interface: operation createReader() assert_own_property: interface prototype object missing non-static operation expected property "createReader" missing
+PASS FileSystemDirectoryEntry interface: operation createReader()
PASS FileSystemDirectoryEntry interface: operation getFile(USVString,FileSystemFlags,FileSystemEntryCallback,ErrorCallback)
PASS FileSystemDirectoryEntry interface: operation getDirectory(USVString,FileSystemFlags,FileSystemEntryCallback,ErrorCallback)
PASS FileSystemEntryCallback interface: existence and properties of interface object
@@ -28,12 +28,12 @@
PASS FileSystemEntryCallback interface: existence and properties of interface prototype object
PASS FileSystemEntryCallback interface: existence and properties of interface prototype object's "constructor" property
PASS FileSystemEntryCallback interface: operation handleEvent(FileSystemEntry)
-FAIL FileSystemDirectoryReader interface: existence and properties of interface object assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
-FAIL FileSystemDirectoryReader interface object length assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
-FAIL FileSystemDirectoryReader interface object name assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
-FAIL FileSystemDirectoryReader interface: existence and properties of interface prototype object assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
-FAIL FileSystemDirectoryReader interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
-FAIL FileSystemDirectoryReader interface: operation readEntries(FileSystemEntriesCallback,ErrorCallback) assert_own_property: self does not have own property "FileSystemDirectoryReader" expected property "FileSystemDirectoryReader" missing
+PASS FileSystemDirectoryReader interface: existence and properties of interface object
+PASS FileSystemDirectoryReader interface object length
+PASS FileSystemDirectoryReader interface object name
+PASS FileSystemDirectoryReader interface: existence and properties of interface prototype object
+PASS FileSystemDirectoryReader interface: existence and properties of interface prototype object's "constructor" property
+PASS FileSystemDirectoryReader interface: operation readEntries(FileSystemEntriesCallback,ErrorCallback)
PASS FileSystemEntriesCallback interface: existence and properties of interface object
PASS FileSystemEntriesCallback interface: existence and properties of interface prototype object
PASS FileSystemEntriesCallback interface: existence and properties of interface prototype object's "constructor" property
@@ -65,5 +65,5 @@
PASS Stringification of file_input
PASS HTMLInputElement interface: file_input must inherit property "webkitdirectory" with the proper type (0)
FAIL HTMLInputElement interface: file_input must inherit property "webkitEntries" with the proper type (1) assert_inherits: property "webkitEntries" not found in prototype chain
-FAIL DataTransferItem interface: operation webkitGetAsEntry() assert_own_property: interface prototype object missing non-static operation expected property "webkitGetAsEntry" missing
+PASS DataTransferItem interface: operation webkitGetAsEntry()
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (221301 => 221302)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2017-08-29 17:00:09 UTC (rev 221302)
@@ -563,6 +563,7 @@
# WebKitTestRunner needs an implementation of eventSender.beginDragWithFiles
# https://bugs.webkit.org/show_bug.cgi?id=64285
+editing/pasteboard/datatransfer-items-drop-getAsEntry.html
editing/pasteboard/datatransfer-items-drop-plaintext-file.html
editing/pasteboard/file-drag-to-editable.html [ Skip ]
editing/pasteboard/file-input-files-access.html
Modified: trunk/Source/_javascript_Core/ChangeLog (221301 => 221302)
--- trunk/Source/_javascript_Core/ChangeLog 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-08-29 17:00:09 UTC (rev 221302)
@@ -1,3 +1,15 @@
+2017-08-29 Chris Dumez <cdu...@apple.com>
+
+ Add initial support for dataTransferItem.webkitGetAsEntry()
+ https://bugs.webkit.org/show_bug.cgi?id=176038
+ <rdar://problem/34121095>
+
+ Reviewed by Wenson Hsieh.
+
+ Add CommonIdentifier needed by [EnabledAtRuntime].
+
+ * runtime/CommonIdentifiers.h:
+
2017-08-27 Devin Rousso <web...@devinrousso.com>
Web Inspector: Record actions performed on WebGLRenderingContext
Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (221301 => 221302)
--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -51,6 +51,7 @@
macro(FederatedCredential) \
macro(FileSystem) \
macro(FileSystemDirectoryEntry) \
+ macro(FileSystemDirectoryReader) \
macro(FileSystemEntry) \
macro(FileSystemFileEntry) \
macro(Function) \
Modified: trunk/Source/WebCore/CMakeLists.txt (221301 => 221302)
--- trunk/Source/WebCore/CMakeLists.txt 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-08-29 17:00:09 UTC (rev 221302)
@@ -204,6 +204,8 @@
Modules/entriesapi/ErrorCallback.idl
Modules/entriesapi/FileCallback.idl
Modules/entriesapi/FileSystemDirectoryEntry.idl
+ Modules/entriesapi/FileSystemDirectoryReader.idl
+ Modules/entriesapi/FileSystemEntriesCallback.idl
Modules/entriesapi/FileSystemEntry.idl
Modules/entriesapi/FileSystemEntryCallback.idl
Modules/entriesapi/FileSystemFileEntry.idl
@@ -919,8 +921,11 @@
Modules/credentials/NavigatorCredentials.cpp
Modules/credentials/PasswordCredential.cpp
+ Modules/entriesapi/ErrorCallback.cpp
Modules/entriesapi/DOMFileSystem.cpp
Modules/entriesapi/FileSystemDirectoryEntry.cpp
+ Modules/entriesapi/FileSystemDirectoryReader.cpp
+ Modules/entriesapi/FileSystemEntriesCallback.cpp
Modules/entriesapi/FileSystemEntry.cpp
Modules/entriesapi/FileSystemFileEntry.cpp
@@ -1230,6 +1235,7 @@
bindings/js/JSEventCustom.cpp
bindings/js/JSEventListener.cpp
bindings/js/JSEventTargetCustom.cpp
+ bindings/js/JSFileSystemEntryCustom.cpp
bindings/js/JSHTMLCollectionCustom.cpp
bindings/js/JSHTMLDocumentCustom.cpp
bindings/js/JSHTMLElementCustom.cpp
Modified: trunk/Source/WebCore/ChangeLog (221301 => 221302)
--- trunk/Source/WebCore/ChangeLog 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/ChangeLog 2017-08-29 17:00:09 UTC (rev 221302)
@@ -1,3 +1,110 @@
+2017-08-29 Chris Dumez <cdu...@apple.com>
+
+ Add initial support for dataTransferItem.webkitGetAsEntry()
+ https://bugs.webkit.org/show_bug.cgi?id=176038
+ <rdar://problem/34121095>
+
+ Reviewed by Wenson Hsieh.
+
+ Add initial support for dataTransferItem.webkitGetAsEntry() as per:
+ - https://wicg.github.io/entries-api/#html-data
+
+ The method works as expected and returns a FileSystemEntry. The entry
+ can be either a file or a directory. All of the attributes exposed on
+ the FileSystemEntry return correct values.
+
+ What remains to be implemented for this new API to actually be useful:
+ - directory.getFile() / directory.getDirectory()
+ - file.file()
+ - entry.getParent()
+ - directoryReader.readEntries()
+
+ Test: editing/pasteboard/datatransfer-items-drop-getAsEntry.html
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ Add new files to projects.
+
+ * Modules/entriesapi/DOMFileSystem.cpp:
+ (WebCore::DOMFileSystem::DOMFileSystem):
+ * Modules/entriesapi/DOMFileSystem.h:
+ (WebCore::DOMFileSystem::create):
+ DOMFileSystem factory now takes a name parameter. This name is a UUID, as suggested in
+ the specification and implemented by Firefox.
+
+ * Modules/entriesapi/ErrorCallback.cpp: Added.
+ * Modules/entriesapi/ErrorCallback.h:
+ Add scheduleCallback() convenience method as we often need to call this callback
+ asynchronously.
+
+ * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
+ (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
+ (WebCore::FileSystemDirectoryEntry::createReader):
+ (WebCore::FileSystemDirectoryEntry::getFile):
+ (WebCore::FileSystemDirectoryEntry::getDirectory):
+ * Modules/entriesapi/FileSystemDirectoryEntry.h:
+ - Add implementation for createReader().
+ - Update getFile() / getDirectory() to call the error callback for now as they are
+ unimplemented.
+ - Have the factory take the virtual path of the entry so that it can be
+ exposed via the fullPath attribute in IDL.
+
+ * Modules/entriesapi/FileSystemDirectoryEntry.idl:
+ Expose createReader() now that we have stubs for FileSystemDirectoryReader.
+
+ * Modules/entriesapi/FileSystemDirectoryReader.cpp: Added.
+ * Modules/entriesapi/FileSystemDirectoryReader.h: Added.
+ * Modules/entriesapi/FileSystemDirectoryReader.idl: Added.
+ * Modules/entriesapi/FileSystemEntriesCallback.cpp: Added.
+ * Modules/entriesapi/FileSystemEntriesCallback.h: Added.
+ * Modules/entriesapi/FileSystemEntriesCallback.idl: Added.
+ Land stubs for FileSystemDirectoryReader and its FileSystemEntriesCallback.
+
+ * Modules/entriesapi/FileSystemEntry.cpp:
+ (WebCore::FileSystemEntry::FileSystemEntry):
+ * Modules/entriesapi/FileSystemEntry.h:
+ (WebCore::FileSystemEntry::virtualPath const):
+ * Modules/entriesapi/FileSystemEntry.idl:
+ Update constructor to take a virtual path, which is exposed via fullPath
+ attribute in IDL.
+
+ * Modules/entriesapi/FileSystemFileEntry.cpp:
+ (WebCore::FileSystemFileEntry::FileSystemFileEntry):
+ (WebCore::FileSystemFileEntry::file):
+ * Modules/entriesapi/FileSystemFileEntry.h:
+ (isType):
+ * Modules/entriesapi/FileSystemFileEntry.idl:
+ - Update file() to call the error callback for now as they are
+ unimplemented.
+ - Have the factory take the virtual path of the entry so that it can be
+ exposed via the fullPath attribute in IDL.
+
+ * bindings/js/JSFileSystemEntryCustom.cpp: Added.
+ (WebCore::toJSNewlyCreated):
+ (WebCore::toJS):
+ Add custom implementation of FileSystemEntry's toJS() function. This is
+ needed because FileSystemEntry has 2 subclasses and we need to type check
+ at runtime to construct the right wrapper.
+
+ * dom/DataTransferItem.cpp:
+ (WebCore::DataTransferItem::getAsEntry const):
+ * dom/DataTransferItem.h:
+ * dom/DataTransferItem.idl:
+ Add initial implementation for getAsEntry(), currently exposed as
+ webkitGetAsEntry().
+
+ * dom/DataTransferItemList.cpp:
+ (WebCore::DataTransferItemList::ensureItems const):
+ Construct a DataTransferItem if the file is a directory now that we
+ support getAsEntry().
+
+ * fileapi/File.cpp:
+ (WebCore::File::isDirectory const):
+ * fileapi/File.h:
+ Add convenience method to query if a File is a directory.
+
2017-08-29 Zan Dobersek <zdober...@igalia.com>
[WebCrypto] Push WorkQueue dispatches for HKDF, HMAC, PBKDF2 algorithms into shared code
Modified: trunk/Source/WebCore/DerivedSources.make (221301 => 221302)
--- trunk/Source/WebCore/DerivedSources.make 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/DerivedSources.make 2017-08-29 17:00:09 UTC (rev 221302)
@@ -138,6 +138,8 @@
$(WebCore)/Modules/entriesapi/ErrorCallback.idl \
$(WebCore)/Modules/entriesapi/FileCallback.idl \
$(WebCore)/Modules/entriesapi/FileSystemDirectoryEntry.idl \
+ $(WebCore)/Modules/entriesapi/FileSystemDirectoryReader.idl \
+ $(WebCore)/Modules/entriesapi/FileSystemEntriesCallback.idl \
$(WebCore)/Modules/entriesapi/FileSystemEntry.idl \
$(WebCore)/Modules/entriesapi/FileSystemEntryCallback.idl \
$(WebCore)/Modules/entriesapi/FileSystemFileEntry.idl \
Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -30,8 +30,9 @@
namespace WebCore {
-DOMFileSystem::DOMFileSystem()
- : m_root(FileSystemDirectoryEntry::create(*this))
+DOMFileSystem::DOMFileSystem(const String& name)
+ : m_name(name)
+ , m_root(FileSystemDirectoryEntry::create(*this, ASCIILiteral("/")))
{
}
Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -32,12 +32,13 @@
namespace WebCore {
class FileSystemDirectoryEntry;
+class FileSystemEntry;
class DOMFileSystem : public ScriptWrappable, public RefCounted<DOMFileSystem> {
public:
- static Ref<DOMFileSystem> create()
+ static Ref<DOMFileSystem> create(const String& name)
{
- return adoptRef(*new DOMFileSystem);
+ return adoptRef(*new DOMFileSystem(name));
}
~DOMFileSystem();
@@ -46,7 +47,7 @@
FileSystemDirectoryEntry& root() const { return m_root; }
private:
- DOMFileSystem();
+ explicit DOMFileSystem(const String& name);
String m_name;
Ref<FileSystemDirectoryEntry> m_root;
Copied: trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.cpp (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ErrorCallback.h"
+
+#include "DOMException.h"
+#include "ScriptExecutionContext.h"
+
+namespace WebCore {
+
+void ErrorCallback::scheduleCallback(ScriptExecutionContext& context, Ref<DOMException>&& exception)
+{
+ context.postTask([protectedThis = makeRef(*this), exception = WTFMove(exception)] (ScriptExecutionContext&) {
+ protectedThis->handleEvent(exception);
+ });
+}
+
+}
Modified: trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.h (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -39,6 +39,9 @@
using ActiveDOMCallback::ActiveDOMCallback;
virtual CallbackResult<void> handleEvent(DOMException&) = 0;
+
+ // Helper to post callback task.
+ void scheduleCallback(ScriptExecutionContext&, Ref<DOMException>&&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -26,20 +26,32 @@
#include "config.h"
#include "FileSystemDirectoryEntry.h"
+#include "DOMException.h"
+#include "ErrorCallback.h"
+#include "FileSystemDirectoryReader.h"
+
namespace WebCore {
-FileSystemDirectoryEntry::FileSystemDirectoryEntry(DOMFileSystem& filesystem)
- : FileSystemEntry(filesystem)
+FileSystemDirectoryEntry::FileSystemDirectoryEntry(DOMFileSystem& filesystem, const String& virtualPath)
+ : FileSystemEntry(filesystem, virtualPath)
{
}
-void FileSystemDirectoryEntry::getFile(const String&, const Flags&, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&)
+Ref<FileSystemDirectoryReader> FileSystemDirectoryEntry::createReader()
{
+ return FileSystemDirectoryReader::create(*this);
}
-void FileSystemDirectoryEntry::getDirectory(const String&, const Flags&, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&)
+void FileSystemDirectoryEntry::getFile(ScriptExecutionContext& context, const String&, const Flags&, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&& errorCallback)
{
+ if (errorCallback)
+ errorCallback->scheduleCallback(context, DOMException::create(NotSupportedError));
+}
+void FileSystemDirectoryEntry::getDirectory(ScriptExecutionContext& context, const String&, const Flags&, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&& errorCallback)
+{
+ if (errorCallback)
+ errorCallback->scheduleCallback(context, DOMException::create(NotSupportedError));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.h (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -30,27 +30,35 @@
namespace WebCore {
class ErrorCallback;
+class FileSystemDirectoryReader;
class FileSystemEntryCallback;
+class ScriptExecutionContext;
class FileSystemDirectoryEntry final : public FileSystemEntry {
public:
- static Ref<FileSystemDirectoryEntry> create(DOMFileSystem& filesystem)
+ static Ref<FileSystemDirectoryEntry> create(DOMFileSystem& filesystem, const String& virtualPath)
{
- return adoptRef(*new FileSystemDirectoryEntry(filesystem));
+ return adoptRef(*new FileSystemDirectoryEntry(filesystem, virtualPath));
}
+ Ref<FileSystemDirectoryReader> createReader();
+
struct Flags {
bool create { false };
bool exclusive { false };
};
- void getFile(const String& path, const Flags& options, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&);
- void getDirectory(const String& path, const Flags& options, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&);
+ void getFile(ScriptExecutionContext&, const String& path, const Flags& options, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&);
+ void getDirectory(ScriptExecutionContext&, const String& path, const Flags& options, RefPtr<FileSystemEntryCallback>&&, RefPtr<ErrorCallback>&&);
private:
bool isDirectory() const final { return true; }
- explicit FileSystemDirectoryEntry(DOMFileSystem&);
+ FileSystemDirectoryEntry(DOMFileSystem&, const String& virtualPath);
};
} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::FileSystemDirectoryEntry)
+ static bool isType(const WebCore::FileSystemEntry& entry) { return entry.isDirectory(); }
+SPECIALIZE_TYPE_TRAITS_END()
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.idl (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.idl 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -26,14 +26,14 @@
[
EnabledAtRuntime=DirectoryUpload,
] interface FileSystemDirectoryEntry : FileSystemEntry {
- // FileSystemDirectoryReader createReader();
+ FileSystemDirectoryReader createReader();
- void getFile(optional USVString? path,
+ [CallWith=ScriptExecutionContext] void getFile(optional USVString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback? successCallback,
optional ErrorCallback? errorCallback);
- void getDirectory(optional USVString? path,
+ [CallWith=ScriptExecutionContext] void getDirectory(optional USVString? path,
optional FileSystemFlags options,
optional FileSystemEntryCallback? successCallback,
optional ErrorCallback? errorCallback);
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.cpp (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FileSystemDirectoryReader.h"
+
+#include "DOMException.h"
+#include "ErrorCallback.h"
+#include "FileSystemDirectoryEntry.h"
+#include "FileSystemEntriesCallback.h"
+
+namespace WebCore {
+
+FileSystemDirectoryReader::FileSystemDirectoryReader(FileSystemDirectoryEntry& directory)
+ : m_directory(directory)
+{
+}
+
+FileSystemDirectoryReader::~FileSystemDirectoryReader()
+{
+}
+
+void FileSystemDirectoryReader::readEntries(ScriptExecutionContext& context, Ref<FileSystemEntriesCallback>&&, RefPtr<ErrorCallback>&& errorCallback)
+{
+ if (errorCallback)
+ errorCallback->scheduleCallback(context, DOMException::create(NotSupportedError));
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.h) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ScriptWrappable.h"
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class ErrorCallback;
+class FileSystemDirectoryEntry;
+class FileSystemEntriesCallback;
+class ScriptExecutionContext;
+
+class FileSystemDirectoryReader : public ScriptWrappable, public RefCounted<FileSystemDirectoryReader> {
+public:
+ static Ref<FileSystemDirectoryReader> create(FileSystemDirectoryEntry& directory)
+ {
+ return adoptRef(*new FileSystemDirectoryReader(directory));
+ }
+
+ ~FileSystemDirectoryReader();
+
+ void readEntries(ScriptExecutionContext&, Ref<FileSystemEntriesCallback>&&, RefPtr<ErrorCallback>&&);
+
+private:
+ explicit FileSystemDirectoryReader(FileSystemDirectoryEntry&);
+
+ Ref<FileSystemDirectoryEntry> m_directory;
+};
+
+}
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.idl (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.idl) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.idl (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ EnabledAtRuntime=DirectoryUpload,
+ ImplementationLacksVTable,
+] interface FileSystemDirectoryReader {
+ [CallWith=ScriptExecutionContext] void readEntries(FileSystemEntriesCallback successCallback, optional ErrorCallback? errorCallback);
+};
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.cpp (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FileSystemEntriesCallback.h"
+
+#include "FileSystemEntry.h"
+#include "ScriptExecutionContext.h"
+
+namespace WebCore {
+
+static Vector<Ref<FileSystemEntry>> copyVector(const Vector<Ref<FileSystemEntry>>& entries)
+{
+ Vector<Ref<FileSystemEntry>> entriesCopy;
+ entriesCopy.reserveInitialCapacity(entries.size());
+ for (auto& entry : entries)
+ entriesCopy.uncheckedAppend(entry.copyRef());
+ return entriesCopy;
+}
+
+void FileSystemEntriesCallback::scheduleCallback(ScriptExecutionContext& context, const Vector<Ref<FileSystemEntry>>& entries)
+{
+ context.postTask([protectedThis = makeRef(*this), entries = copyVector(entries)] (ScriptExecutionContext&) {
+ protectedThis->handleEvent(entries);
+ });
+}
+
+}
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.h (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/ErrorCallback.h) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.h (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ActiveDOMCallback.h"
+#include "CallbackResult.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class FileSystemEntry;
+
+class FileSystemEntriesCallback : public RefCounted<FileSystemEntriesCallback>, public ActiveDOMCallback {
+public:
+ using ActiveDOMCallback::ActiveDOMCallback;
+
+ virtual CallbackResult<void> handleEvent(const Vector<Ref<FileSystemEntry>>&) = 0;
+
+ // Helper to post callback task.
+ void scheduleCallback(ScriptExecutionContext&, const Vector<Ref<FileSystemEntry>>&);
+};
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.idl (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.idl) (0 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.idl (rev 0)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntriesCallback.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+callback FileSystemEntriesCallback = void (sequence<FileSystemEntry> entries);
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -26,10 +26,14 @@
#include "config.h"
#include "FileSystemEntry.h"
+#include "FileSystem.h"
+
namespace WebCore {
-FileSystemEntry::FileSystemEntry(DOMFileSystem& filesystem)
+FileSystemEntry::FileSystemEntry(DOMFileSystem& filesystem, const String& virtualPath)
: m_filesystem(filesystem)
+ , m_name(pathGetFileName(virtualPath))
+ , m_virtualPath(virtualPath)
{
}
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.h (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -41,16 +41,16 @@
virtual bool isDirectory() const { return false; }
const String& name() const { return m_name; }
- const String& fullPath() const { return m_fullPath; }
+ const String& virtualPath() const { return m_virtualPath; }
DOMFileSystem& filesystem() const { return m_filesystem; }
protected:
- explicit FileSystemEntry(DOMFileSystem&);
+ FileSystemEntry(DOMFileSystem&, const String& virtualPath);
private:
+ DOMFileSystem& m_filesystem;
String m_name;
- String m_fullPath;
- DOMFileSystem& m_filesystem;
+ String m_virtualPath;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.idl (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.idl 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemEntry.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -24,12 +24,13 @@
*/
[
+ CustomToJSObject,
EnabledAtRuntime=DirectoryUpload,
] interface FileSystemEntry {
readonly attribute boolean isFile;
readonly attribute boolean isDirectory;
readonly attribute USVString name;
- readonly attribute USVString fullPath;
+ [ImplementedAs=virtualPath] readonly attribute USVString fullPath;
readonly attribute DOMFileSystem filesystem;
// void getParent(optional FileSystemEntryCallback successCallback, optional ErrorCallback errorCallback);
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -26,15 +26,20 @@
#include "config.h"
#include "FileSystemFileEntry.h"
+#include "DOMException.h"
+#include "ErrorCallback.h"
+
namespace WebCore {
-FileSystemFileEntry::FileSystemFileEntry(DOMFileSystem& filesystem)
- : FileSystemEntry(filesystem)
+FileSystemFileEntry::FileSystemFileEntry(DOMFileSystem& filesystem, const String& virtualPath)
+ : FileSystemEntry(filesystem, virtualPath)
{
}
-void FileSystemFileEntry::file(RefPtr<FileCallback>&&, RefPtr<ErrorCallback>&&)
+void FileSystemFileEntry::file(ScriptExecutionContext& context, RefPtr<FileCallback>&&, RefPtr<ErrorCallback>&& errorCallback)
{
+ if (errorCallback)
+ errorCallback->scheduleCallback(context, DOMException::create(NotSupportedError));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.h (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -31,20 +31,25 @@
class ErrorCallback;
class FileCallback;
+class ScriptExecutionContext;
class FileSystemFileEntry final : public FileSystemEntry {
public:
- static Ref<FileSystemFileEntry> create(DOMFileSystem& filesystem)
+ static Ref<FileSystemFileEntry> create(DOMFileSystem& filesystem, const String& virtualPath)
{
- return adoptRef(*new FileSystemFileEntry(filesystem));
+ return adoptRef(*new FileSystemFileEntry(filesystem, virtualPath));
}
- void file(RefPtr<FileCallback>&&, RefPtr<ErrorCallback>&& = nullptr);
+ void file(ScriptExecutionContext&, RefPtr<FileCallback>&&, RefPtr<ErrorCallback>&& = nullptr);
private:
bool isFile() const final { return true; }
- explicit FileSystemFileEntry(DOMFileSystem&);
+ FileSystemFileEntry(DOMFileSystem&, const String& virtualPath);
};
} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::FileSystemFileEntry)
+ static bool isType(const WebCore::FileSystemEntry& entry) { return entry.isFile(); }
+SPECIALIZE_TYPE_TRAITS_END()
Modified: trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.idl (221301 => 221302)
--- trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.idl 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/Modules/entriesapi/FileSystemFileEntry.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -26,5 +26,5 @@
[
EnabledAtRuntime=DirectoryUpload,
] interface FileSystemFileEntry : FileSystemEntry {
- void file(FileCallback? successCallback, optional ErrorCallback? errorCallback);
+ [CallWith=ScriptExecutionContext] void file(FileCallback? successCallback, optional ErrorCallback? errorCallback);
};
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (221301 => 221302)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-08-29 17:00:09 UTC (rev 221302)
@@ -3407,6 +3407,9 @@
830030F51B7D33B500ED3AAC /* GenericCachedHTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */; };
830030F61B7D33B500ED3AAC /* GenericCachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */; };
830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 830335011F549057004DF707 /* FileSystemDirectoryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830334FB1F549052004DF707 /* FileSystemDirectoryReader.cpp */; };
+ 830335021F549057004DF707 /* FileSystemDirectoryReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 830334FC1F549052004DF707 /* FileSystemDirectoryReader.h */; };
+ 830335031F54905A004DF707 /* FileSystemEntriesCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 830334FE1F549052004DF707 /* FileSystemEntriesCallback.h */; };
830519951BB0F11000F3772E /* HTMLTimeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830519921BB0F0E700F3772E /* HTMLTimeElement.cpp */; };
830519961BB0F11000F3772E /* HTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 830519931BB0F0E700F3772E /* HTMLTimeElement.h */; };
8306EFF11B8BCEA50031D032 /* NativeNodeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8306EFF01B8BCE7C0031D032 /* NativeNodeFilter.cpp */; };
@@ -3435,9 +3438,14 @@
835657C71ECAB10700CDE72D /* JSDOMMatrixInit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835657C61ECAB0E800CDE72D /* JSDOMMatrixInit.cpp */; };
8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */; };
8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F570AD1C53268E007FD6CB /* JSXMLDocument.h */; };
+ 835B68101F548BE10071F7F6 /* JSFileSystemEntryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835B680E1F548BDE0071F7F6 /* JSFileSystemEntryCustom.cpp */; };
835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
835D54C41F4DE53800E60671 /* FileListCreator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835D54C11F4DE53400E60671 /* FileListCreator.cpp */; };
835D54C51F4DE53800E60671 /* FileListCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D54C21F4DE53400E60671 /* FileListCreator.h */; };
+ 836589DD1F54A76600DC31F4 /* JSFileSystemDirectoryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836589DB1F54A76200DC31F4 /* JSFileSystemDirectoryReader.cpp */; };
+ 836589DE1F54A76900DC31F4 /* JSFileSystemDirectoryReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 836589D91F54A76200DC31F4 /* JSFileSystemDirectoryReader.h */; };
+ 836589DF1F54A76C00DC31F4 /* JSFileSystemEntriesCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836589DA1F54A76200DC31F4 /* JSFileSystemEntriesCallback.cpp */; };
+ 836589E01F54A76E00DC31F4 /* JSFileSystemEntriesCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 836589D81F54A76200DC31F4 /* JSFileSystemEntriesCallback.h */; };
8367587E1C56E99B008A1087 /* JSHTMLDataElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834B86A91C56E93E00F3F0E3 /* JSHTMLDataElement.cpp */; };
8367587F1C56E99B008A1087 /* JSHTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A81C56E93E00F3F0E3 /* JSHTMLDataElement.h */; };
836ACEC21ECA62C8004BD012 /* DOMMatrixReadOnly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836ACEBF1ECA62B0004BD012 /* DOMMatrixReadOnly.cpp */; };
@@ -3465,6 +3473,7 @@
837056901F50915C00D93425 /* JSFileSystemEntryCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 837056891F50915000D93425 /* JSFileSystemEntryCallback.h */; };
8371AC3B1F509BE400FBF284 /* ErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 8371AC391F509BDD00FBF284 /* ErrorCallback.h */; };
8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 837609CA1F54CC18000C122D /* ErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 837609C81F54CC13000C122D /* ErrorCallback.cpp */; };
83765F951DAC522F00C06537 /* MouseEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83765F941DAC521800C06537 /* MouseEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
837A80131E1E127300026B9F /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 837A80111E1E127300026B9F /* Localizable.stringsdict */; };
837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 837B7D1F1DC3F54C00D051FC /* ValidationBubbleIOS.mm */; };
@@ -3477,6 +3486,7 @@
838EF53C1DC14A7C008F0C39 /* JSIDBTransactionMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */; };
838F86DA1F509E7400E8CFC5 /* FileCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 838F86D81F509E6C00E8CFC5 /* FileCallback.h */; };
838F86DB1F509E7B00E8CFC5 /* FileSystemEntryCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 838F86D71F509E6C00E8CFC5 /* FileSystemEntryCallback.h */; };
+ 839680B41F54C6AD00752690 /* FileSystemEntriesCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839680B21F54C6A800752690 /* FileSystemEntriesCallback.cpp */; };
8399470B1F50B63E00E9D86B /* DOMFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839947091F50B63800E9D86B /* DOMFileSystem.cpp */; };
8399470C1F50B63E00E9D86B /* DOMFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 839947071F50B63800E9D86B /* DOMFileSystem.h */; };
8399470F1F50B6FA00E9D86B /* JSDOMFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8399470D1F50B6F300E9D86B /* JSDOMFileSystem.cpp */; };
@@ -11558,6 +11568,11 @@
830030F31B7D33A600ED3AAC /* GenericCachedHTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericCachedHTMLCollection.cpp; sourceTree = "<group>"; };
830030F41B7D33A600ED3AAC /* GenericCachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericCachedHTMLCollection.h; sourceTree = "<group>"; };
830030F71B7D398800ED3AAC /* CachedHTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedHTMLCollection.h; sourceTree = "<group>"; };
+ 830334FB1F549052004DF707 /* FileSystemDirectoryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemDirectoryReader.cpp; sourceTree = "<group>"; };
+ 830334FC1F549052004DF707 /* FileSystemDirectoryReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemDirectoryReader.h; sourceTree = "<group>"; };
+ 830334FD1F549052004DF707 /* FileSystemEntriesCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileSystemEntriesCallback.idl; sourceTree = "<group>"; };
+ 830334FE1F549052004DF707 /* FileSystemEntriesCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemEntriesCallback.h; sourceTree = "<group>"; };
+ 830334FF1F549052004DF707 /* FileSystemDirectoryReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileSystemDirectoryReader.idl; sourceTree = "<group>"; };
830519921BB0F0E700F3772E /* HTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTimeElement.cpp; sourceTree = "<group>"; };
830519931BB0F0E700F3772E /* HTMLTimeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTimeElement.h; sourceTree = "<group>"; };
830519941BB0F0E700F3772E /* HTMLTimeElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTimeElement.idl; sourceTree = "<group>"; };
@@ -11592,10 +11607,15 @@
8350C3E81DA59B6200356446 /* ScrollToOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollToOptions.idl; sourceTree = "<group>"; };
83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontFamily.h; sourceTree = "<group>"; };
835657C61ECAB0E800CDE72D /* JSDOMMatrixInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMatrixInit.cpp; sourceTree = "<group>"; };
+ 835B680E1F548BDE0071F7F6 /* JSFileSystemEntryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemEntryCustom.cpp; sourceTree = "<group>"; };
835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; };
835D54C11F4DE53400E60671 /* FileListCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileListCreator.cpp; sourceTree = "<group>"; };
835D54C21F4DE53400E60671 /* FileListCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileListCreator.h; sourceTree = "<group>"; };
835F8B261D2D90BA00E408EC /* Slotable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Slotable.idl; sourceTree = "<group>"; };
+ 836589D81F54A76200DC31F4 /* JSFileSystemEntriesCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileSystemEntriesCallback.h; sourceTree = "<group>"; };
+ 836589D91F54A76200DC31F4 /* JSFileSystemDirectoryReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileSystemDirectoryReader.h; sourceTree = "<group>"; };
+ 836589DA1F54A76200DC31F4 /* JSFileSystemEntriesCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemEntriesCallback.cpp; sourceTree = "<group>"; };
+ 836589DB1F54A76200DC31F4 /* JSFileSystemDirectoryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemDirectoryReader.cpp; sourceTree = "<group>"; };
8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
836ACEBF1ECA62B0004BD012 /* DOMMatrixReadOnly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMatrixReadOnly.cpp; sourceTree = "<group>"; };
836ACEC01ECA62B0004BD012 /* DOMMatrixReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMatrixReadOnly.h; sourceTree = "<group>"; };
@@ -11630,6 +11650,7 @@
8371AC381F509BDD00FBF284 /* FileCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileCallback.idl; sourceTree = "<group>"; };
8371AC391F509BDD00FBF284 /* ErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorCallback.h; sourceTree = "<group>"; };
8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingResultType.h; sourceTree = "<group>"; };
+ 837609C81F54CC13000C122D /* ErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorCallback.cpp; sourceTree = "<group>"; };
83765F931DAC521800C06537 /* MouseEventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MouseEventInit.idl; sourceTree = "<group>"; };
83765F941DAC521800C06537 /* MouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseEventInit.h; sourceTree = "<group>"; };
837A80121E1E127300026B9F /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = English; path = English.lproj/Localizable.stringsdict; sourceTree = SOURCE_ROOT; };
@@ -11645,6 +11666,7 @@
838EF53A1DC14A75008F0C39 /* JSIDBTransactionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransactionMode.h; sourceTree = "<group>"; };
838F86D71F509E6C00E8CFC5 /* FileSystemEntryCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemEntryCallback.h; sourceTree = "<group>"; };
838F86D81F509E6C00E8CFC5 /* FileCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCallback.h; sourceTree = "<group>"; };
+ 839680B21F54C6A800752690 /* FileSystemEntriesCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemEntriesCallback.cpp; sourceTree = "<group>"; };
839947071F50B63800E9D86B /* DOMFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileSystem.h; sourceTree = "<group>"; };
839947081F50B63800E9D86B /* DOMFileSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFileSystem.idl; sourceTree = "<group>"; };
839947091F50B63800E9D86B /* DOMFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMFileSystem.cpp; sourceTree = "<group>"; };
@@ -19883,6 +19905,7 @@
E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */,
BC60901E0E91B8EC000C68B5 /* JSEventTargetCustom.cpp */,
46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */,
+ 835B680E1F548BDE0071F7F6 /* JSFileSystemEntryCustom.cpp */,
BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */,
BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
@@ -20061,6 +20084,7 @@
839947091F50B63800E9D86B /* DOMFileSystem.cpp */,
839947071F50B63800E9D86B /* DOMFileSystem.h */,
839947081F50B63800E9D86B /* DOMFileSystem.idl */,
+ 837609C81F54CC13000C122D /* ErrorCallback.cpp */,
8371AC391F509BDD00FBF284 /* ErrorCallback.h */,
8371AC371F509BDD00FBF284 /* ErrorCallback.idl */,
838F86D81F509E6C00E8CFC5 /* FileCallback.h */,
@@ -20068,6 +20092,12 @@
83FB336B1F508A4E00986E54 /* FileSystemDirectoryEntry.cpp */,
83FB336D1F508A4E00986E54 /* FileSystemDirectoryEntry.h */,
83FB336A1F508A4E00986E54 /* FileSystemDirectoryEntry.idl */,
+ 830334FB1F549052004DF707 /* FileSystemDirectoryReader.cpp */,
+ 830334FC1F549052004DF707 /* FileSystemDirectoryReader.h */,
+ 830334FF1F549052004DF707 /* FileSystemDirectoryReader.idl */,
+ 839680B21F54C6A800752690 /* FileSystemEntriesCallback.cpp */,
+ 830334FE1F549052004DF707 /* FileSystemEntriesCallback.h */,
+ 830334FD1F549052004DF707 /* FileSystemEntriesCallback.idl */,
83FB336E1F508A4E00986E54 /* FileSystemEntry.cpp */,
83FB336F1F508A4E00986E54 /* FileSystemEntry.h */,
83FB33681F508A4E00986E54 /* FileSystemEntry.idl */,
@@ -20091,6 +20121,10 @@
8370568B1F50915000D93425 /* JSFileCallback.h */,
833B9E2B1F508D8000E0E428 /* JSFileSystemDirectoryEntry.cpp */,
833B9E2F1F508D8000E0E428 /* JSFileSystemDirectoryEntry.h */,
+ 836589DB1F54A76200DC31F4 /* JSFileSystemDirectoryReader.cpp */,
+ 836589D91F54A76200DC31F4 /* JSFileSystemDirectoryReader.h */,
+ 836589DA1F54A76200DC31F4 /* JSFileSystemEntriesCallback.cpp */,
+ 836589D81F54A76200DC31F4 /* JSFileSystemEntriesCallback.h */,
833B9E2E1F508D8000E0E428 /* JSFileSystemEntry.cpp */,
833B9E2A1F508D8000E0E428 /* JSFileSystemEntry.h */,
8370568A1F50915000D93425 /* JSFileSystemEntryCallback.cpp */,
@@ -27545,6 +27579,8 @@
2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */,
514B3F730C722047000530DF /* FileSystem.h in Headers */,
83FB33711F508A5400986E54 /* FileSystemDirectoryEntry.h in Headers */,
+ 830335021F549057004DF707 /* FileSystemDirectoryReader.h in Headers */,
+ 830335031F54905A004DF707 /* FileSystemEntriesCallback.h in Headers */,
83FB33731F508A5800986E54 /* FileSystemEntry.h in Headers */,
838F86DB1F509E7B00E8CFC5 /* FileSystemEntryCallback.h in Headers */,
83FB33751F508A5B00986E54 /* FileSystemFileEntry.h in Headers */,
@@ -28237,6 +28273,8 @@
2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */,
898785F5122E1EAC003AABDA /* JSFileReaderSync.h in Headers */,
833B9E321F508D8500E0E428 /* JSFileSystemDirectoryEntry.h in Headers */,
+ 836589DE1F54A76900DC31F4 /* JSFileSystemDirectoryReader.h in Headers */,
+ 836589E01F54A76E00DC31F4 /* JSFileSystemEntriesCallback.h in Headers */,
833B9E341F508D8500E0E428 /* JSFileSystemEntry.h in Headers */,
837056901F50915C00D93425 /* JSFileSystemEntryCallback.h in Headers */,
833B9E361F508D8500E0E428 /* JSFileSystemFileEntry.h in Headers */,
@@ -31485,6 +31523,7 @@
F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */,
515BE18F1D54F5FB00DD7C68 /* EmptyGamepadProvider.cpp in Sources */,
FD31609212B026F700C1A359 /* EqualPowerPanner.cpp in Sources */,
+ 837609CA1F54CC18000C122D /* ErrorCallback.cpp in Sources */,
2ECF7AE110162B5800427DE7 /* ErrorEvent.cpp in Sources */,
85031B410A44EFC700F992E0 /* Event.cpp in Sources */,
4138D3361244054800323D33 /* EventContext.cpp in Sources */,
@@ -31557,6 +31596,8 @@
5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */,
514B3F760C722055000530DF /* FileSystemCocoa.mm in Sources */,
83FB33701F508A5400986E54 /* FileSystemDirectoryEntry.cpp in Sources */,
+ 830335011F549057004DF707 /* FileSystemDirectoryReader.cpp in Sources */,
+ 839680B41F54C6AD00752690 /* FileSystemEntriesCallback.cpp in Sources */,
83FB33721F508A5800986E54 /* FileSystemEntry.cpp in Sources */,
83FB33741F508A5B00986E54 /* FileSystemFileEntry.cpp in Sources */,
26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */,
@@ -32230,8 +32271,11 @@
2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */,
898785F4122E1EAC003AABDA /* JSFileReaderSync.cpp in Sources */,
833B9E311F508D8500E0E428 /* JSFileSystemDirectoryEntry.cpp in Sources */,
+ 836589DD1F54A76600DC31F4 /* JSFileSystemDirectoryReader.cpp in Sources */,
+ 836589DF1F54A76C00DC31F4 /* JSFileSystemEntriesCallback.cpp in Sources */,
833B9E331F508D8500E0E428 /* JSFileSystemEntry.cpp in Sources */,
8370568F1F50915900D93425 /* JSFileSystemEntryCallback.cpp in Sources */,
+ 835B68101F548BE10071F7F6 /* JSFileSystemEntryCustom.cpp in Sources */,
833B9E351F508D8500E0E428 /* JSFileSystemFileEntry.cpp in Sources */,
B6D9D27C14EAC0860090D75E /* JSFocusEvent.cpp in Sources */,
C28083401C6DC275001451B6 /* JSFontFace.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (221301 => 221302)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -63,6 +63,7 @@
#include "JSEventCustom.cpp"
#include "JSEventListener.cpp"
#include "JSEventTargetCustom.cpp"
+#include "JSFileSystemEntryCustom.cpp"
#include "JSHTMLCollectionCustom.cpp"
#include "JSHTMLDocumentCustom.cpp"
#include "JSHTMLElementCustom.cpp"
Copied: trunk/Source/WebCore/bindings/js/JSFileSystemEntryCustom.cpp (from rev 221300, trunk/Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp) (0 => 221302)
--- trunk/Source/WebCore/bindings/js/JSFileSystemEntryCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSFileSystemEntryCustom.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSFileSystemEntry.h"
+
+#include "FileSystemDirectoryEntry.h"
+#include "FileSystemFileEntry.h"
+#include "JSDOMBinding.h"
+#include "JSFileSystemDirectoryEntry.h"
+#include "JSFileSystemFileEntry.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<FileSystemEntry>&& entry)
+{
+ if (is<FileSystemDirectoryEntry>(entry))
+ return createWrapper<FileSystemDirectoryEntry>(globalObject, WTFMove(entry));
+ return createWrapper<FileSystemFileEntry>(globalObject, WTFMove(entry));
+}
+
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, FileSystemEntry& entry)
+{
+ return wrap(state, globalObject, entry);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/dom/DataTransferItem.cpp (221301 => 221302)
--- trunk/Source/WebCore/dom/DataTransferItem.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/dom/DataTransferItem.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -32,10 +32,15 @@
#include "config.h"
#include "DataTransferItem.h"
+#include "DOMFileSystem.h"
#include "DataTransferItemList.h"
#include "File.h"
+#include "FileSystem.h"
+#include "FileSystemDirectoryEntry.h"
+#include "FileSystemFileEntry.h"
#include "ScriptExecutionContext.h"
#include "StringCallback.h"
+#include <wtf/UUID.h>
namespace WebCore {
@@ -101,4 +106,19 @@
return m_file.copyRef();
}
+RefPtr<FileSystemEntry> DataTransferItem::getAsEntry() const
+{
+ auto file = getAsFile();
+ if (!file)
+ return nullptr;
+
+ if (!m_fileSystem)
+ m_fileSystem = DOMFileSystem::create(createCanonicalUUIDString());
+
+ String virtualPath = "/" + file->name();
+ if (file->isDirectory())
+ return FileSystemDirectoryEntry::create(*m_fileSystem, virtualPath);
+ return FileSystemFileEntry::create(*m_fileSystem, virtualPath);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/DataTransferItem.h (221301 => 221302)
--- trunk/Source/WebCore/dom/DataTransferItem.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/dom/DataTransferItem.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -40,8 +40,10 @@
namespace WebCore {
+class DOMFileSystem;
class DataTransferListItem;
class File;
+class FileSystemEntry;
class ScriptExecutionContext;
class StringCallback;
@@ -59,6 +61,7 @@
String type() const;
void getAsString(ScriptExecutionContext&, RefPtr<StringCallback>&&) const;
RefPtr<File> getAsFile() const;
+ RefPtr<FileSystemEntry> getAsEntry() const;
private:
DataTransferItem(WeakPtr<DataTransferItemList>&&, const String&);
@@ -69,6 +72,7 @@
WeakPtr<DataTransferItemList> m_list;
const String m_type;
RefPtr<File> m_file;
+ mutable RefPtr<DOMFileSystem> m_fileSystem;
};
}
Modified: trunk/Source/WebCore/dom/DataTransferItem.idl (221301 => 221302)
--- trunk/Source/WebCore/dom/DataTransferItem.idl 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/dom/DataTransferItem.idl 2017-08-29 17:00:09 UTC (rev 221302)
@@ -38,5 +38,8 @@
[CallWith=ScriptExecutionContext] void getAsString(StringCallback? callback);
File getAsFile();
+
+ // https://wicg.github.io/entries-api/#html-data
+ [ImplementedAs=getAsEntry] FileSystemEntry? webkitGetAsEntry();
};
Modified: trunk/Source/WebCore/dom/DataTransferItemList.cpp (221301 => 221302)
--- trunk/Source/WebCore/dom/DataTransferItemList.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/dom/DataTransferItemList.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -134,7 +134,7 @@
for (unsigned i = 0, length = files.length(); i < length; ++i) {
File& file = *files.item(i);
String type = File::contentTypeForFile(file.path()).convertToASCIILowercase();
- if (isSupportedType(type))
+ if (isSupportedType(type) || file.isDirectory())
items.append(DataTransferItem::create(m_weakPtrFactory.createWeakPtr(), type, file));
}
Modified: trunk/Source/WebCore/fileapi/File.cpp (221301 => 221302)
--- trunk/Source/WebCore/fileapi/File.cpp 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/fileapi/File.cpp 2017-08-29 17:00:09 UTC (rev 221302)
@@ -127,4 +127,11 @@
return type;
}
+bool File::isDirectory() const
+{
+ if (!m_isDirectory)
+ m_isDirectory = fileIsDirectory(m_path);
+ return *m_isDirectory;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/fileapi/File.h (221301 => 221302)
--- trunk/Source/WebCore/fileapi/File.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebCore/fileapi/File.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -81,6 +81,8 @@
static bool shouldReplaceFile(const String& path);
#endif
+ bool isDirectory() const;
+
private:
WEBCORE_EXPORT explicit File(const String& path);
File(const String& path, const String& nameOverride);
@@ -98,6 +100,7 @@
String m_name;
std::optional<int64_t> m_overrideLastModifiedDate;
+ mutable std::optional<bool> m_isDirectory;
};
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (221301 => 221302)
--- trunk/Source/WebKit/ChangeLog 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebKit/ChangeLog 2017-08-29 17:00:09 UTC (rev 221302)
@@ -1,3 +1,16 @@
+2017-08-29 Chris Dumez <cdu...@apple.com>
+
+ Add initial support for dataTransferItem.webkitGetAsEntry()
+ https://bugs.webkit.org/show_bug.cgi?id=176038
+ <rdar://problem/34121095>
+
+ Reviewed by Wenson Hsieh.
+
+ Make dataTransfer.items an experimental feature so that it can be easily
+ turned on from the Develop menu, for testing convenience.
+
+ * Shared/WebPreferencesDefinitions.h:
+
2017-08-29 Andy Estes <aes...@apple.com>
[Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
Modified: trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h (221301 => 221302)
--- trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h 2017-08-29 17:00:04 UTC (rev 221301)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h 2017-08-29 17:00:09 UTC (rev 221302)
@@ -277,7 +277,6 @@
macro(LargeImageAsyncDecodingEnabled, largeImageAsyncDecodingEnabled, Bool, bool, true, "", "") \
macro(AnimatedImageAsyncDecodingEnabled, animatedImageAsyncDecodingEnabled, Bool, bool, true, "", "") \
macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, true, "", "") \
- macro(DataTransferItemsEnabled, dataTransferItemsEnabled, Bool, bool, false, "Data Transfer Items", "Enables DataTransferItem in the clipboard API") \
macro(EncryptedMediaAPIEnabled, encryptedMediaAPIEnabled, Bool, bool, false, "", "") \
macro(MediaPreloadingEnabled, mediaPreloadingEnabled, Bool, bool, false, "", "") \
macro(IntersectionObserverEnabled, intersectionObserverEnabled, Bool, bool, false, "Intersection Observer", "Enable Intersection Observer support") \
@@ -376,6 +375,7 @@
macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false, "WebGL 2.0", "WebGL 2 prototype") \
macro(WebGPUEnabled, webGPUEnabled, Bool, bool, false, "WebGPU", "WebGPU prototype") \
macro(DirectoryUploadEnabled, directoryUploadEnabled, Bool, bool, false, "Directory Upload", "input.webkitdirectory") \
+ macro(DataTransferItemsEnabled, dataTransferItemsEnabled, Bool, bool, false, "Data Transfer Items", "Enables DataTransferItem in the clipboard API") \
macro(AsyncFrameScrollingEnabled, asyncFrameScrollingEnabled, Bool, bool, false, "Async Frame Scrolling", "Perform frame scrolling in a dedicated thread or process") \
\