- Revision
- 223118
- Author
- [email protected]
- Date
- 2017-10-09 21:10:02 -0700 (Mon, 09 Oct 2017)
Log Message
Calling fileSystemDirectoryEntry.getDirectory() with empty path should not fail
https://bugs.webkit.org/show_bug.cgi?id=178114
Reviewed by Ryosuke Niwa.
Source/WebCore:
Calling fileSystemDirectoryEntry.getDirectory() with empty/null/undefined path should not fail as per:
- https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getdirectory
The empty string is a valid path as per:
- https://wicg.github.io/entries-api/#valid-path
This aligns out behavior with Chrome.
No new tests, updated existing test.
* Modules/entriesapi/DOMFileSystem.cpp:
(WebCore::isValidVirtualPath):
(WebCore::resolveRelativeVirtualPath):
LayoutTests:
Extend layout test coverage.
* editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory-expected.txt:
* editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (223117 => 223118)
--- trunk/LayoutTests/ChangeLog 2017-10-10 03:19:22 UTC (rev 223117)
+++ trunk/LayoutTests/ChangeLog 2017-10-10 04:10:02 UTC (rev 223118)
@@ -1,3 +1,15 @@
+2017-10-09 Chris Dumez <[email protected]>
+
+ Calling fileSystemDirectoryEntry.getDirectory() with empty path should not fail
+ https://bugs.webkit.org/show_bug.cgi?id=178114
+
+ Reviewed by Ryosuke Niwa.
+
+ Extend layout test coverage.
+
+ * editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory-expected.txt:
+ * editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory.html:
+
2017-10-09 Ryan Haddad <[email protected]>
Mark http/tests/paymentrequest/payment-request-abort-method.https.html as flaky.
Modified: trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory-expected.txt (223117 => 223118)
--- trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory-expected.txt 2017-10-10 03:19:22 UTC (rev 223117)
+++ trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory-expected.txt 2017-10-10 04:10:02 UTC (rev 223118)
@@ -42,8 +42,26 @@
PASS subfolder1Entry.name is "subfolder1"
PASS subfolder1Entry.fullPath is "/testFiles/subfolder1"
PASS subfolder1Entry.isDirectory is true
-* Error case: calling getDirectory() with empty path
-PASS ex.name is "TypeMismatchError"
+* Edge case: calling getDirectory() with empty path
+PASS testFilesEntry.isFile is false
+PASS testFilesEntry.isDirectory is true
+PASS testFilesEntry.name is "testFiles"
+PASS testFilesEntry.fullPath is "/testFiles"
+* Edge case: calling getDirectory() with null path
+PASS testFilesEntry.isFile is false
+PASS testFilesEntry.isDirectory is true
+PASS testFilesEntry.name is "testFiles"
+PASS testFilesEntry.fullPath is "/testFiles"
+* Edge case: calling getDirectory() with undefined path
+PASS testFilesEntry.isFile is false
+PASS testFilesEntry.isDirectory is true
+PASS testFilesEntry.name is "testFiles"
+PASS testFilesEntry.fullPath is "/testFiles"
+* Edge case: calling getDirectory() with path '.'
+PASS testFilesEntry.isFile is false
+PASS testFilesEntry.isDirectory is true
+PASS testFilesEntry.name is "testFiles"
+PASS testFilesEntry.fullPath is "/testFiles"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory.html (223117 => 223118)
--- trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory.html 2017-10-10 03:19:22 UTC (rev 223117)
+++ trunk/LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getDirectory.html 2017-10-10 04:10:02 UTC (rev 223118)
@@ -152,15 +152,57 @@
}
function test13() {
- debug("* Error case: calling getDirectory() with empty path");
+ debug("* Edge case: calling getDirectory() with empty path");
return getDirectoryAsPromise(directoryEntry, "", {}).then(entry => {
- testFailed("Should fail when path is invalid");
+ testFilesEntry = entry;
+ shouldBeFalse("testFilesEntry.isFile");
+ shouldBeTrue("testFilesEntry.isDirectory");
+ shouldBeEqualToString("testFilesEntry.name", "testFiles");
+ shouldBeEqualToString("testFilesEntry.fullPath", "/testFiles");
}, e => {
- ex = e;
- shouldBeEqualToString("ex.name", "TypeMismatchError");
+ testFailed("getDirectory('') should succeed");
});
}
+function test14() {
+ debug("* Edge case: calling getDirectory() with null path");
+ return getDirectoryAsPromise(directoryEntry, null, {}).then(entry => {
+ testFilesEntry = entry;
+ shouldBeFalse("testFilesEntry.isFile");
+ shouldBeTrue("testFilesEntry.isDirectory");
+ shouldBeEqualToString("testFilesEntry.name", "testFiles");
+ shouldBeEqualToString("testFilesEntry.fullPath", "/testFiles");
+ }, e => {
+ testFailed("getDirectory(null) should succeed");
+ });
+}
+
+function test15() {
+ debug("* Edge case: calling getDirectory() with undefined path");
+ return getDirectoryAsPromise(directoryEntry, undefined, {}).then(entry => {
+ testFilesEntry = entry;
+ shouldBeFalse("testFilesEntry.isFile");
+ shouldBeTrue("testFilesEntry.isDirectory");
+ shouldBeEqualToString("testFilesEntry.name", "testFiles");
+ shouldBeEqualToString("testFilesEntry.fullPath", "/testFiles");
+ }, e => {
+ testFailed("getDirectory(undefined) should succeed");
+ });
+}
+
+function test16() {
+ debug("* Edge case: calling getDirectory() with path '.'");
+ return getDirectoryAsPromise(directoryEntry, '.', {}).then(entry => {
+ testFilesEntry = entry;
+ shouldBeFalse("testFilesEntry.isFile");
+ shouldBeTrue("testFilesEntry.isDirectory");
+ shouldBeEqualToString("testFilesEntry.name", "testFiles");
+ shouldBeEqualToString("testFilesEntry.fullPath", "/testFiles");
+ }, e => {
+ testFailed("getDirectory('.') should succeed");
+ });
+}
+
var dropzone = document.getElementById('dropzone');
dropzone._ondrop_ = function(e) {
e.preventDefault();
@@ -182,6 +224,9 @@
.then(test11)
.then(test12)
.then(test13)
+ .then(test14)
+ .then(test15)
+ .then(test16)
.then(finishJSTest);
};
Modified: trunk/Source/WebCore/ChangeLog (223117 => 223118)
--- trunk/Source/WebCore/ChangeLog 2017-10-10 03:19:22 UTC (rev 223117)
+++ trunk/Source/WebCore/ChangeLog 2017-10-10 04:10:02 UTC (rev 223118)
@@ -1,5 +1,26 @@
2017-10-09 Chris Dumez <[email protected]>
+ Calling fileSystemDirectoryEntry.getDirectory() with empty path should not fail
+ https://bugs.webkit.org/show_bug.cgi?id=178114
+
+ Reviewed by Ryosuke Niwa.
+
+ Calling fileSystemDirectoryEntry.getDirectory() with empty/null/undefined path should not fail as per:
+ - https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getdirectory
+
+ The empty string is a valid path as per:
+ - https://wicg.github.io/entries-api/#valid-path
+
+ This aligns out behavior with Chrome.
+
+ No new tests, updated existing test.
+
+ * Modules/entriesapi/DOMFileSystem.cpp:
+ (WebCore::isValidVirtualPath):
+ (WebCore::resolveRelativeVirtualPath):
+
+2017-10-09 Chris Dumez <[email protected]>
+
It should not be possible to submit a form that is disconnected
https://bugs.webkit.org/show_bug.cgi?id=178099
Modified: trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp (223117 => 223118)
--- trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-10-10 03:19:22 UTC (rev 223117)
+++ trunk/Source/WebCore/Modules/entriesapi/DOMFileSystem.cpp 2017-10-10 04:10:02 UTC (rev 223118)
@@ -128,7 +128,7 @@
static bool isValidVirtualPath(StringView virtualPath)
{
if (virtualPath.isEmpty())
- return false;
+ return true;
if (virtualPath[0] == '/')
return virtualPath.length() == 1 || isValidRelativeVirtualPath(virtualPath.substring(1));
return isValidRelativeVirtualPath(virtualPath);
@@ -185,7 +185,7 @@
static String resolveRelativeVirtualPath(StringView baseVirtualPath, StringView relativeVirtualPath)
{
ASSERT(baseVirtualPath[0] == '/');
- if (relativeVirtualPath[0] == '/')
+ if (!relativeVirtualPath.isEmpty() && relativeVirtualPath[0] == '/')
return relativeVirtualPath.length() == 1 ? relativeVirtualPath.toString() : resolveRelativeVirtualPath("/", relativeVirtualPath.substring(1));
Vector<StringView> virtualPathSegments;