Implement FileSystemEntry.getParent()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Sep 2017 17:37:00 +0000 (17:37 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Sep 2017 17:37:00 +0000 (17:37 +0000)
commitb96f04187cabb4b380082a2d42df7d60537dae6f
tree2848abace63ea26fa7e498644fd1085e1133011d
parent48342dd13537662db86aae01933a1a9797f0d7f4
Implement FileSystemEntry.getParent()
https://bugs.webkit.org/show_bug.cgi?id=176165
<rdar://problem/34187743>

Reviewed by Andreas Kling.

Source/WebCore:

Implement FileSystemEntry.getParent():
- https://wicg.github.io/entries-api/#dom-filesystementry-getparent

Tests: editing/pasteboard/datatransfer-items-drop-getParent-root.html
       editing/pasteboard/datatransfer-items-drop-getParent.html
       editing/pasteboard/datatransfer-items-drop-getParent2.html

* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::toFileSystemEntries):
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

(WebCore::isAbsoluteVirtualPath):
Add utility function to determine if a virtual path is absolute:
- https://wicg.github.io/entries-api/#absolute-path

(WebCore::DOMFileSystem::root):
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

(WebCore::DOMFileSystem::fileAsEntry):
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

(WebCore::resolveRelativePath):
Add implementation for:
- https://wicg.github.io/entries-api/#resolve-a-relative-path

(WebCore::DOMFileSystem::listDirectory):
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

(WebCore::DOMFileSystem::getParent):
Add implementation of getParent() as per:
- https://wicg.github.io/entries-api/#dom-filesystementry-getparent

* Modules/entriesapi/DOMFileSystem.h:
(WebCore::DOMFileSystem::createEntryForFile):
* Modules/entriesapi/DOMFileSystem.idl:
* Modules/entriesapi/FileSystemDirectoryEntry.cpp:
(WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
* Modules/entriesapi/FileSystemDirectoryEntry.h:
* Modules/entriesapi/FileSystemDirectoryReader.cpp:
(WebCore::FileSystemDirectoryReader::readEntries):
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

* Modules/entriesapi/FileSystemEntry.cpp:
(WebCore::FileSystemEntry::FileSystemEntry):
(WebCore::FileSystemEntry::activeDOMObjectName const):
(WebCore::FileSystemEntry::canSuspendForDocumentSuspension const):
(WebCore::FileSystemEntry::getParent):
* Modules/entriesapi/FileSystemEntry.h:
* Modules/entriesapi/FileSystemEntry.idl:
- Add implementation of FileSystemEntry.getParent() which relies on
  DOMFileSystem::getParent()
- Make FileSystemEntry an ActiveDOMObject as getParent() is an asynchronous
  operation which causes delayed JS execution.

* Modules/entriesapi/FileSystemFileEntry.cpp:
(WebCore::FileSystemFileEntry::FileSystemFileEntry):
* Modules/entriesapi/FileSystemFileEntry.h:
* dom/DataTransferItem.cpp:
(WebCore::DataTransferItem::getAsEntry const):
* dom/DataTransferItem.h:
* dom/DataTransferItem.idl:
Take a ScriptExecutionContext now that FileSystemEntry is an ActiveDOMObject.

LayoutTests:

* editing/pasteboard/datatransfer-items-drop-getParent-expected.txt: Added.
* editing/pasteboard/datatransfer-items-drop-getParent-root-expected.txt: Added.
* editing/pasteboard/datatransfer-items-drop-getParent-root.html: Added.
* editing/pasteboard/datatransfer-items-drop-getParent.html: Added.
* editing/pasteboard/datatransfer-items-drop-getParent2-expected.txt: Added.
* editing/pasteboard/datatransfer-items-drop-getParent2.html: Added.
Add layout test coverage for FileSystemEntry.getParent().

* http/wpt/entries-api/interfaces-expected.txt:
Rebaseline test now that one more check is passing.

* platform/wk2/TestExpectations:
Skip new tests on WK2 since they rely on beginDragWithFiles.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@221481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent-root-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent-root.html [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent.html [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent2-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/datatransfer-items-drop-getParent2.html [new file with mode: 0644]
LayoutTests/http/wpt/entries-api/interfaces-expected.txt
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp
Source/WebCore/Modules/entriesapi/DOMFileSystem.h
Source/WebCore/Modules/entriesapi/DOMFileSystem.idl
Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.cpp
Source/WebCore/Modules/entriesapi/FileSystemDirectoryEntry.h
Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.cpp
Source/WebCore/Modules/entriesapi/FileSystemEntry.cpp
Source/WebCore/Modules/entriesapi/FileSystemEntry.h
Source/WebCore/Modules/entriesapi/FileSystemEntry.idl
Source/WebCore/Modules/entriesapi/FileSystemFileEntry.cpp
Source/WebCore/Modules/entriesapi/FileSystemFileEntry.h
Source/WebCore/dom/DataTransferItem.cpp
Source/WebCore/dom/DataTransferItem.h
Source/WebCore/dom/DataTransferItem.idl