Diff
Modified: trunk/LayoutTests/ChangeLog (111568 => 111569)
--- trunk/LayoutTests/ChangeLog 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/ChangeLog 2012-03-21 17:26:40 UTC (rev 111569)
@@ -1,3 +1,18 @@
+2012-03-21 Alexey Proskuryakov <[email protected]>
+
+ Remove obsolete File attributes
+ https://bugs.webkit.org/show_bug.cgi?id=79383
+
+ Reviewed by Hajime Morita.
+
+ * editing/pasteboard/file-input-files-access-expected.txt:
+ * editing/pasteboard/file-input-files-access.html:
+ * editing/pasteboard/script-tests/file-input-files-access.js: Removed.
+ * http/tests/security/clipboard/clipboard-file-access-expected.txt:
+ * http/tests/security/clipboard/clipboard-file-access.html:
+ * http/tests/security/clipboard/script-tests/clipboard-file-access.js: Removed.
+ Updated the tests to not use removed attributes, and consolidated files for easier access.
+
2012-03-21 Xiaomei Ji <[email protected]>
Skipped editing/selection/move-by-word-visually-crash-test-5.html due to isWordTextBreak() is not implemented.
Modified: trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt (111568 => 111569)
--- trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt 2012-03-21 17:26:40 UTC (rev 111569)
@@ -9,16 +9,12 @@
PASS fileInput.files[0].name is "DRTFakeFile"
PASS fileInput.files[0].type is ""
PASS fileInput.files[0].size is 0
-PASS fileInput.files[0].fileName is "DRTFakeFile"
-PASS fileInput.files[0].fileSize is 0
Dragging a real file to a file input control:
PASS fileInput.value is "C:\\fakepath\\apple.gif"
PASS fileInput.files.length is 1
PASS fileInput.files[0].name is "apple.gif"
PASS fileInput.files[0].type is "image/gif"
PASS fileInput.files[0].size is 1476
-PASS fileInput.files[0].fileName is "apple.gif"
-PASS fileInput.files[0].fileSize is 1476
Dragging a directory onto an file input control:
FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
FAIL fileInput.files.length should be 0. Was 1.
@@ -38,18 +34,12 @@
PASS fileInput.files[0].name is "apple.gif"
PASS fileInput.files[0].type is "image/gif"
PASS fileInput.files[0].size is 1476
-PASS fileInput.files[0].fileName is "apple.gif"
-PASS fileInput.files[0].fileSize is 1476
PASS fileInput.files[1].name is "mozilla.gif"
PASS fileInput.files[1].type is "image/gif"
PASS fileInput.files[1].size is 2593
-PASS fileInput.files[1].fileName is "mozilla.gif"
-PASS fileInput.files[1].fileSize is 2593
PASS fileInput.files[2].name is "file.invalidext"
PASS fileInput.files[2].type is ""
PASS fileInput.files[2].size is 10
-PASS fileInput.files[2].fileName is "file.invalidext"
-PASS fileInput.files[2].fileSize is 10
Dragging a file and a directory onto a mutli-file input control:
FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
FAIL fileInput.files.length should be 0. Was 2.
Modified: trunk/LayoutTests/editing/pasteboard/file-input-files-access.html (111568 => 111569)
--- trunk/LayoutTests/editing/pasteboard/file-input-files-access.html 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/editing/pasteboard/file-input-files-access.html 2012-03-21 17:26:40 UTC (rev 111569)
@@ -6,7 +6,129 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src=""
+<script>
+description("Tests for multi-file drag onto file input elements for https://bugs.webkit.org/show_bug.cgi?id=25862");
+
+var fileInput = document.createElement("input");
+fileInput.type = 'file';
+fileInput.style.width = "100%"; // So that any manual testing will show full file names
+// Important that we put this at the top of the doc so that logging does not cause it to go out of view (where it can't be dragged to)
+document.body.insertBefore(fileInput, document.body.firstChild);
+
+function moveMouseToCenterOfElement(element)
+{
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoInput(files) {
+ fileInput.value = ""; // Clear the <input>
+
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(fileInput);
+ eventSender.mouseUp();
+}
+
+function fileListShouldBe(fileListString, filesArray)
+{
+ shouldBe(fileListString + ".length", "" + filesArray.length);
+ for (var x = 0; x < filesArray.length; x++) {
+ var fileValueString = fileListString + "[" + x + "]";
+ shouldBeEqualToString(fileValueString + ".name", filesArray[x]['name']);
+ shouldBeEqualToString(fileValueString + ".type", filesArray[x]['type']);
+ shouldBe(fileValueString + ".size", "" + filesArray[x]['size']);
+ }
+}
+
+function filesShouldBe(filesArray)
+{
+ fileListShouldBe("fileInput.files", filesArray);
+}
+
+function draggingPathsShouldResultInFiles(pathsArray, filesArray)
+{
+ dragFilesOntoInput(pathsArray);
+ // WebKit seems to always take the first file in the dragged list as .value:
+ shouldBeEqualToString("fileInput.value", filesArray[0] ? "C:\\fakepath\\" + filesArray[0]['name'] : '');
+ filesShouldBe(filesArray);
+}
+
+function testDraggingFiles(filesArray)
+{
+ // We could make a way to parse the filename from the path, and then only need to pass
+ // the path in the filesArray.
+ var pathsOnly = filesArray.map(function(fileSpec) { return fileSpec['path']; });
+ draggingPathsShouldResultInFiles(pathsOnly, filesArray);
+}
+
+function testOrderedDraggingWithDirectory()
+{
+ var inputType = fileInput.multiple ? "mutli-file" : "single-file";
+
+ // Note: The order of selection in the Finder changes the order of file paths in the pasteboard
+ // thus it's important that we test different orders here as well (at least on the Mac)
+ debug("Dragging a file and a directory onto a " + inputType + " input control:")
+ draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/directory-for-dragging'], []);
+
+ debug("FIXME: <input> elements should refuse drags including directories: https://bugs.webkit.org/show_bug.cgi?id=25879. The page is given File objects corresponding to directories, but form submission will fail.");
+
+ debug("Dragging a directory and a file onto a " + inputType + " input control:")
+ draggingPathsShouldResultInFiles(['resources/directory-for-dragging', 'resources/apple.gif'], []);
+}
+
+function runTest()
+{
+ debug("Dragging a single (non-existant) file to a file input control:");
+ testDraggingFiles([
+ { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0, 'type' : '' }
+ ]);
+
+ debug("Dragging a real file to a file input control:");
+ testDraggingFiles([
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' }
+ ]);
+
+ // Directory dragging behavior is covered by
+ // https://bugs.webkit.org/show_bug.cgi?id=25852
+ debug("Dragging a directory onto an file input control:");
+ draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
+
+ debug("Dragging two files to a single-file input control:")
+ draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/mozilla.gif'], []);
+
+ testOrderedDraggingWithDirectory();
+
+ fileInput.multiple = true;
+
+ debug("Dragging three files to a multi-file input control:");
+ testDraggingFiles([
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' },
+ { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593, 'type' : 'image/gif' },
+ { 'path': 'resources/file.invalidext', 'name' : 'file.invalidext', 'size' : 10, 'type' : '' }
+ ]);
+
+ testOrderedDraggingWithDirectory();
+
+ debug("Dragging to a disabled file input control:");
+ fileInput.disabled = true;
+ draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
+
+ // Clean up after ourselves
+ fileInput.parentNode.removeChild(fileInput);
+
+ layoutTestController.notifyDone();
+}
+
+var successfullyParsed = true;
+
+if (window.eventSender) {
+ runTest();
+} else {
+ testFailed("This test is not interactive, please run using run-webkit-tests");
+}
+
+</script>
<script src=""
</body>
</html>
Deleted: trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js (111568 => 111569)
--- trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js 2012-03-21 17:26:40 UTC (rev 111569)
@@ -1,124 +0,0 @@
-description("Tests for multi-file drag onto file input elements for https://bugs.webkit.org/show_bug.cgi?id=25862");
-
-var fileInput = document.createElement("input");
-fileInput.type = 'file';
-fileInput.style.width = "100%"; // So that any manual testing will show full file names
-// Important that we put this at the top of the doc so that logging does not cause it to go out of view (where it can't be dragged to)
-document.body.insertBefore(fileInput, document.body.firstChild);
-
-function moveMouseToCenterOfElement(element)
-{
- var centerX = element.offsetLeft + element.offsetWidth / 2;
- var centerY = element.offsetTop + element.offsetHeight / 2;
- eventSender.mouseMoveTo(centerX, centerY);
-}
-
-function dragFilesOntoInput(files) {
- fileInput.value = ""; // Clear the <input>
-
- eventSender.beginDragWithFiles(files);
- moveMouseToCenterOfElement(fileInput);
- eventSender.mouseUp();
-}
-
-function fileListShouldBe(fileListString, filesArray)
-{
- shouldBe(fileListString + ".length", "" + filesArray.length);
- for (var x = 0; x < filesArray.length; x++) {
- var fileValueString = fileListString + "[" + x + "]";
- shouldBeEqualToString(fileValueString + ".name", filesArray[x]['name']);
- shouldBeEqualToString(fileValueString + ".type", filesArray[x]['type']);
- shouldBe(fileValueString + ".size", "" + filesArray[x]['size']);
-
- // FIXME: to be removed after legacy attributes are removed.
- shouldBeEqualToString(fileValueString + ".fileName", filesArray[x]['name']);
- shouldBe(fileValueString + ".fileSize", "" + filesArray[x]['size']);
- }
-}
-
-function filesShouldBe(filesArray)
-{
- fileListShouldBe("fileInput.files", filesArray);
-}
-
-function draggingPathsShouldResultInFiles(pathsArray, filesArray)
-{
- dragFilesOntoInput(pathsArray);
- // WebKit seems to always take the first file in the dragged list as .value:
- shouldBeEqualToString("fileInput.value", filesArray[0] ? "C:\\fakepath\\" + filesArray[0]['name'] : '');
- filesShouldBe(filesArray);
-}
-
-function testDraggingFiles(filesArray)
-{
- // We could make a way to parse the filename from the path, and then only need to pass
- // the path in the filesArray.
- var pathsOnly = filesArray.map(function(fileSpec) { return fileSpec['path']; });
- draggingPathsShouldResultInFiles(pathsOnly, filesArray);
-}
-
-function testOrderedDraggingWithDirectory()
-{
- var inputType = fileInput.multiple ? "mutli-file" : "single-file";
-
- // Note: The order of selection in the Finder changes the order of file paths in the pasteboard
- // thus it's important that we test different orders here as well (at least on the Mac)
- debug("Dragging a file and a directory onto a " + inputType + " input control:")
- draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/directory-for-dragging'], []);
-
- debug("FIXME: <input> elements should refuse drags including directories: https://bugs.webkit.org/show_bug.cgi?id=25879. The page is given File objects corresponding to directories, but form submission will fail.");
-
- debug("Dragging a directory and a file onto a " + inputType + " input control:")
- draggingPathsShouldResultInFiles(['resources/directory-for-dragging', 'resources/apple.gif'], []);
-}
-
-function runTest()
-{
- debug("Dragging a single (non-existant) file to a file input control:");
- testDraggingFiles([
- { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0, 'type' : '' }
- ]);
-
- debug("Dragging a real file to a file input control:");
- testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' }
- ]);
-
- // Directory dragging behavior is covered by
- // https://bugs.webkit.org/show_bug.cgi?id=25852
- debug("Dragging a directory onto an file input control:");
- draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
-
- debug("Dragging two files to a single-file input control:")
- draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/mozilla.gif'], []);
-
- testOrderedDraggingWithDirectory();
-
- fileInput.multiple = true;
-
- debug("Dragging three files to a multi-file input control:");
- testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' },
- { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593, 'type' : 'image/gif' },
- { 'path': 'resources/file.invalidext', 'name' : 'file.invalidext', 'size' : 10, 'type' : '' }
- ]);
-
- testOrderedDraggingWithDirectory();
-
- debug("Dragging to a disabled file input control:");
- fileInput.disabled = true;
- draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
-
- // Clean up after ourselves
- fileInput.parentNode.removeChild(fileInput);
-
- layoutTestController.notifyDone();
-}
-
-var successfullyParsed = true;
-
-if (window.eventSender) {
- runTest();
-} else {
- testFailed("This test is not interactive, please run using DumpRenderTree");
-}
Modified: trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access-expected.txt (111568 => 111569)
--- trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access-expected.txt 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access-expected.txt 2012-03-21 17:26:40 UTC (rev 111569)
@@ -26,9 +26,9 @@
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 1
-PASS event.dataTransfer.files[0].fileName is "DRTFakeFile"
-PASS event.dataTransfer.files[0].fileSize is 0
-FIXME: File.fileSize always returns 0 for files dropped by eventSender.beginDragWithFiles from http tests: https://bugs.webkit.org/show_bug.cgi?id=25909
+PASS event.dataTransfer.files[0].name is "DRTFakeFile"
+PASS event.dataTransfer.files[0].size is 0
+FIXME: File.size always returns 0 for files dropped by eventSender.beginDragWithFiles from http tests: https://bugs.webkit.org/show_bug.cgi?id=25909
Drag files over an element, leave that element and release the mouse:
On dragenter:
PASS event.dataTransfer.types contains Files.
@@ -49,8 +49,8 @@
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 1
-PASS event.dataTransfer.files[0].fileName is "apple.gif"
-FAIL event.dataTransfer.files[0].fileSize should be 1476. Was 0.
+PASS event.dataTransfer.files[0].name is "apple.gif"
+FAIL event.dataTransfer.files[0].size should be 1476. Was 0.
Drag drop two files onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
@@ -64,10 +64,10 @@
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 2
-PASS event.dataTransfer.files[0].fileName is "apple.gif"
-FAIL event.dataTransfer.files[0].fileSize should be 1476. Was 0.
-PASS event.dataTransfer.files[1].fileName is "mozilla.gif"
-FAIL event.dataTransfer.files[1].fileSize should be 2593. Was 0.
+PASS event.dataTransfer.files[0].name is "apple.gif"
+FAIL event.dataTransfer.files[0].size should be 1476. Was 0.
+PASS event.dataTransfer.files[1].name is "mozilla.gif"
+FAIL event.dataTransfer.files[1].size should be 2593. Was 0.
Drag drop two files in reverse alphabetical order onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
@@ -81,10 +81,10 @@
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 2
-PASS event.dataTransfer.files[0].fileName is "mozilla.gif"
-FAIL event.dataTransfer.files[0].fileSize should be 2593. Was 0.
-PASS event.dataTransfer.files[1].fileName is "apple.gif"
-FAIL event.dataTransfer.files[1].fileSize should be 1476. Was 0.
+PASS event.dataTransfer.files[0].name is "mozilla.gif"
+FAIL event.dataTransfer.files[0].size should be 2593. Was 0.
+PASS event.dataTransfer.files[1].name is "apple.gif"
+FAIL event.dataTransfer.files[1].size should be 1476. Was 0.
FIXME: We should not allow element to accept drops including directories unless https://bugs.webkit.org/show_bug.cgi?id=25879 is fixed to make directory File objects useful from _javascript_. The page is given File objects corresponding to directories, but form submission and xhr.send() will fail.
Drag drop a directory onto an element:
On dragenter:
Modified: trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access.html (111568 => 111569)
--- trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access.html 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/http/tests/security/clipboard/clipboard-file-access.html 2012-03-21 17:26:40 UTC (rev 111569)
@@ -6,7 +6,180 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src=""
+<script>
+description("Tests access to event.dataTransfer.files and .types");
+
+var dragTarget = document.createElement("div");
+dragTarget.innerHTML = "Drag here"
+dragTarget.style.backgroundColor = "blue";
+dragTarget.style.width = "100px";
+dragTarget.style.height = "100px";
+// Important that we put this at the top of the doc so that logging does not cause it to go out of view (and be undragable)
+document.body.insertBefore(dragTarget, document.body.firstChild);
+
+var filesToDrag;
+dragTarget.addEventListener("dragenter", function() {
+ debug("On dragenter:")
+ event.dataTransfer.dropEffect = "copy";
+ var shouldContainType = (filesToDrag.length > 0);
+ checkForEventTransferType(event, "Files", shouldContainType);
+ fileListShouldBe("event.dataTransfer.files", []);
+ event.preventDefault();
+}, false);
+
+dragTarget.addEventListener("dragover", function() {
+ debug("On dragover:")
+ event.dataTransfer.dropEffect = "copy";
+ var shouldContainType = (filesToDrag.length > 0);
+ checkForEventTransferType(event, "Files", shouldContainType);
+ fileListShouldBe("event.dataTransfer.files", []);
+ event.preventDefault();
+}, false);
+
+dragTarget.addEventListener("dragleave", function() {
+ debug("On dragleave:")
+ var shouldContainType = (filesToDrag.length > 0);
+ checkForEventTransferType(event, "Files", shouldContainType);
+ fileListShouldBe("event.dataTransfer.files", []);
+}, false);
+
+var expectedFilesOnDrop;
+dragTarget.addEventListener("drop", function() {
+ debug("On drop:")
+ var shouldContainType = (filesToDrag.length > 0);
+ checkForEventTransferType(event, "Files", shouldContainType);
+ fileListShouldBe("event.dataTransfer.files", expectedFilesOnDrop);
+ event.preventDefault();
+}, false);
+
+// Some tests don't end up dropping the draggee over the drag target. Catch any
+// leftover drop events bubbling up through the tree so they don't cause page
+// navigation.
+document.body.addEventListener("dragover", function() {
+ event.preventDefault();
+});
+
+function moveMouseToCenterOfElement(element) {
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function moveMouseToOutsideOfElement(element) {
+ var outsideX = element.offsetLeft + element.offsetWidth + 42;
+ var outsideY = element.offsetTop + element.offsetHeight + 42;
+ eventSender.mouseMoveTo(outsideX, outsideY);
+}
+
+function dragFilesOntoDragTarget(files, leave) {
+ filesToDrag = files;
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(dragTarget);
+ if (leave && leave === true)
+ moveMouseToOutsideOfElement(dragTarget);
+ eventSender.mouseUp();
+}
+
+function checkForEventTransferType(event, typeString, shouldContainType)
+{
+ var passedCheck;
+ var message;
+ if (event.dataTransfer.types && event.dataTransfer.types.indexOf(typeString) != -1) {
+ passedCheck = shouldContainType;
+ message = "event.dataTransfer.types contains " + typeString + ".";
+ } else {
+ passedCheck = !shouldContainType;
+ message = "event.dataTransfer.types does not contain " + typeString + ".";
+ }
+ if (passedCheck)
+ testPassed(message);
+ else
+ testFailed(message);
+}
+
+function fileListShouldBe(fileListString, filesArray)
+{
+ shouldBe(fileListString + ".length", "" + filesArray.length);
+ for (var x = 0; x < filesArray.length; x++) {
+ var fileValueString = fileListString + "[" + x + "]";
+ shouldBeEqualToString(fileValueString + ".name", filesArray[x]['name']);
+ shouldBe(fileValueString + ".size", "" + filesArray[x]['size']);
+ }
+}
+
+function draggingPathsShouldResultInFiles(pathsArray, filesArray, leave)
+{
+ expectedFilesOnDrop = filesArray;
+ dragFilesOntoDragTarget(pathsArray, leave || false);
+}
+
+function testDraggingFiles(filesArray, leave)
+{
+ // We could make a way to parse the filename from the path, and then only need to pass
+ // the path in the filesArray.
+ var pathsOnly = filesArray.map(function(fileSpec) { return fileSpec['path']; });
+ draggingPathsShouldResultInFiles(pathsOnly, filesArray, leave || false);
+}
+
+function runTest()
+{
+ debug("Dragging no files should return an empty file list (arbitrary implementation detail):");
+ testDraggingFiles([]);
+
+ debug("Drag drop a single (non-existant) file onto an element:");
+ testDraggingFiles([
+ { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0 }
+ ]);
+
+ debug("FIXME: File.size always returns 0 for files dropped by eventSender.beginDragWithFiles from http tests: https://bugs.webkit.org/show_bug.cgi?id=25909");
+
+ debug("Drag files over an element, leave that element and release the mouse:");
+ testDraggingFiles([
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
+ ], true);
+
+ debug("Drag drop a real file onto an element:");
+ testDraggingFiles([
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
+ ]);
+
+ debug("Drag drop two files onto an element:");
+ testDraggingFiles([
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 },
+ { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593 }
+ ]);
+
+ debug("Drag drop two files in reverse alphabetical order onto an element:");
+ testDraggingFiles([
+ { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593 },
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
+ ]);
+
+ // Directory dragging behavior is covered by https://bugs.webkit.org/show_bug.cgi?id=25852 and https://bugs.webkit.org/show_bug.cgi?id=25879
+ debug("FIXME: We should not allow element to accept drops including directories unless https://bugs.webkit.org/show_bug.cgi?id=25879 is fixed to make directory File objects useful from _javascript_. The page is given File objects corresponding to directories, but form submission and xhr.send() will fail.");
+ debug("Drag drop a directory onto an element:");
+ draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
+
+ // Note: The order of selection in the Finder changes the order of file paths in the pasteboard
+ // thus it's important that we test different orders here as well (at least on the Mac)
+ // Both drops should be refused or succeed based on how https://bugs.webkit.org/show_bug.cgi?id=25879 is resolved. Currently we expect drops to be refused.
+ debug("Drag drop a file and a directory onto an element:");
+ draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/directory-for-dragging'], []);
+
+ debug("Drag drop a directory and a file onto an element:")
+ draggingPathsShouldResultInFiles(['resources/directory-for-dragging', 'resources/apple.gif'], []);
+}
+
+if (window.eventSender) {
+ runTest();
+ // Clean up after ourselves
+ dragTarget.parentNode.removeChild(dragTarget);
+} else {
+ testFailed("This test is not interactive, please run using DumpRenderTree");
+}
+
+var successfullyParsed = true;
+</script>
<script src=""
</body>
</html>
Deleted: trunk/LayoutTests/http/tests/security/clipboard/script-tests/clipboard-file-access.js (111568 => 111569)
--- trunk/LayoutTests/http/tests/security/clipboard/script-tests/clipboard-file-access.js 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/LayoutTests/http/tests/security/clipboard/script-tests/clipboard-file-access.js 2012-03-21 17:26:40 UTC (rev 111569)
@@ -1,172 +0,0 @@
-description("Tests access to event.dataTransfer.files and .types");
-
-var dragTarget = document.createElement("div");
-dragTarget.innerHTML = "Drag here"
-dragTarget.style.backgroundColor = "blue";
-dragTarget.style.width = "100px";
-dragTarget.style.height = "100px";
-// Important that we put this at the top of the doc so that logging does not cause it to go out of view (and be undragable)
-document.body.insertBefore(dragTarget, document.body.firstChild);
-
-var filesToDrag;
-dragTarget.addEventListener("dragenter", function() {
- debug("On dragenter:")
- event.dataTransfer.dropEffect = "copy";
- var shouldContainType = (filesToDrag.length > 0);
- checkForEventTransferType(event, "Files", shouldContainType);
- fileListShouldBe("event.dataTransfer.files", []);
- event.preventDefault();
-}, false);
-
-dragTarget.addEventListener("dragover", function() {
- debug("On dragover:")
- event.dataTransfer.dropEffect = "copy";
- var shouldContainType = (filesToDrag.length > 0);
- checkForEventTransferType(event, "Files", shouldContainType);
- fileListShouldBe("event.dataTransfer.files", []);
- event.preventDefault();
-}, false);
-
-dragTarget.addEventListener("dragleave", function() {
- debug("On dragleave:")
- var shouldContainType = (filesToDrag.length > 0);
- checkForEventTransferType(event, "Files", shouldContainType);
- fileListShouldBe("event.dataTransfer.files", []);
-}, false);
-
-var expectedFilesOnDrop;
-dragTarget.addEventListener("drop", function() {
- debug("On drop:")
- var shouldContainType = (filesToDrag.length > 0);
- checkForEventTransferType(event, "Files", shouldContainType);
- fileListShouldBe("event.dataTransfer.files", expectedFilesOnDrop);
- event.preventDefault();
-}, false);
-
-// Some tests don't end up dropping the draggee over the drag target. Catch any
-// leftover drop events bubbling up through the tree so they don't cause page
-// navigation.
-document.body.addEventListener("dragover", function() {
- event.preventDefault();
-});
-
-function moveMouseToCenterOfElement(element) {
- var centerX = element.offsetLeft + element.offsetWidth / 2;
- var centerY = element.offsetTop + element.offsetHeight / 2;
- eventSender.mouseMoveTo(centerX, centerY);
-}
-
-function moveMouseToOutsideOfElement(element) {
- var outsideX = element.offsetLeft + element.offsetWidth + 42;
- var outsideY = element.offsetTop + element.offsetHeight + 42;
- eventSender.mouseMoveTo(outsideX, outsideY);
-}
-
-function dragFilesOntoDragTarget(files, leave) {
- filesToDrag = files;
- eventSender.beginDragWithFiles(files);
- moveMouseToCenterOfElement(dragTarget);
- if (leave && leave === true)
- moveMouseToOutsideOfElement(dragTarget);
- eventSender.mouseUp();
-}
-
-function checkForEventTransferType(event, typeString, shouldContainType)
-{
- var passedCheck;
- var message;
- if (event.dataTransfer.types && event.dataTransfer.types.indexOf(typeString) != -1) {
- passedCheck = shouldContainType;
- message = "event.dataTransfer.types contains " + typeString + ".";
- } else {
- passedCheck = !shouldContainType;
- message = "event.dataTransfer.types does not contain " + typeString + ".";
- }
- if (passedCheck)
- testPassed(message);
- else
- testFailed(message);
-}
-
-function fileListShouldBe(fileListString, filesArray)
-{
- shouldBe(fileListString + ".length", "" + filesArray.length);
- for (var x = 0; x < filesArray.length; x++) {
- var fileValueString = fileListString + "[" + x + "]";
- shouldBeEqualToString(fileValueString + ".fileName", filesArray[x]['name']);
- shouldBe(fileValueString + ".fileSize", "" + filesArray[x]['size']);
- }
-}
-
-function draggingPathsShouldResultInFiles(pathsArray, filesArray, leave)
-{
- expectedFilesOnDrop = filesArray;
- dragFilesOntoDragTarget(pathsArray, leave || false);
-}
-
-function testDraggingFiles(filesArray, leave)
-{
- // We could make a way to parse the filename from the path, and then only need to pass
- // the path in the filesArray.
- var pathsOnly = filesArray.map(function(fileSpec) { return fileSpec['path']; });
- draggingPathsShouldResultInFiles(pathsOnly, filesArray, leave || false);
-}
-
-function runTest()
-{
- debug("Dragging no files should return an empty file list (arbitrary implementation detail):");
- testDraggingFiles([]);
-
- debug("Drag drop a single (non-existant) file onto an element:");
- testDraggingFiles([
- { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0 }
- ]);
-
- debug("FIXME: File.fileSize always returns 0 for files dropped by eventSender.beginDragWithFiles from http tests: https://bugs.webkit.org/show_bug.cgi?id=25909");
-
- debug("Drag files over an element, leave that element and release the mouse:");
- testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
- ], true);
-
- debug("Drag drop a real file onto an element:");
- testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
- ]);
-
- debug("Drag drop two files onto an element:");
- testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 },
- { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593 }
- ]);
-
- debug("Drag drop two files in reverse alphabetical order onto an element:");
- testDraggingFiles([
- { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593 },
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
- ]);
-
- // Directory dragging behavior is covered by https://bugs.webkit.org/show_bug.cgi?id=25852 and https://bugs.webkit.org/show_bug.cgi?id=25879
- debug("FIXME: We should not allow element to accept drops including directories unless https://bugs.webkit.org/show_bug.cgi?id=25879 is fixed to make directory File objects useful from _javascript_. The page is given File objects corresponding to directories, but form submission and xhr.send() will fail.");
- debug("Drag drop a directory onto an element:");
- draggingPathsShouldResultInFiles(['resources/directory-for-dragging'], []);
-
- // Note: The order of selection in the Finder changes the order of file paths in the pasteboard
- // thus it's important that we test different orders here as well (at least on the Mac)
- // Both drops should be refused or succeed based on how https://bugs.webkit.org/show_bug.cgi?id=25879 is resolved. Currently we expect drops to be refused.
- debug("Drag drop a file and a directory onto an element:");
- draggingPathsShouldResultInFiles(['resources/apple.gif', 'resources/directory-for-dragging'], []);
-
- debug("Drag drop a directory and a file onto an element:")
- draggingPathsShouldResultInFiles(['resources/directory-for-dragging', 'resources/apple.gif'], []);
-}
-
-if (window.eventSender) {
- runTest();
- // Clean up after ourselves
- dragTarget.parentNode.removeChild(dragTarget);
-} else {
- testFailed("This test is not interactive, please run using DumpRenderTree");
-}
-
-var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (111568 => 111569)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 17:26:40 UTC (rev 111569)
@@ -1,3 +1,21 @@
+2012-03-21 Alexey Proskuryakov <[email protected]>
+
+ Remove obsolete File attributes
+ https://bugs.webkit.org/show_bug.cgi?id=79383
+
+ Reviewed by Hajime Morita.
+
+ * bindings/objc/PublicDOMInterfaces.h:
+ * fileapi/File.h:
+ * fileapi/File.idl:
+ Removed fileName and fileSize, they have different names now.
+
+ * html/FileInputType.cpp:
+ (WebCore::FileInputType::appendFormData):
+ (WebCore::FileInputType::getTypeSpecificValue):
+ (WebCore::FileInputType::defaultToolTip):
+ Updated to use new function names.
+
2012-03-21 Jocelyn Turcotte <[email protected]>
TiledBackingStore: Create the first round of tiles synchronously after setting the visible rect.
Modified: trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h (111568 => 111569)
--- trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h 2012-03-21 17:26:40 UTC (rev 111569)
@@ -244,10 +244,6 @@
@interface DOMFile : DOMBlob WEBKIT_VERSION_4_0
@property(readonly, copy) NSString *name;
-
-// FIXME: obsolete properties. To be removed.
-@property(readonly, copy) NSString *fileName;
-@property(readonly) unsigned long long fileSize;
@end
@interface DOMFileList : DOMObject WEBKIT_VERSION_4_0
Modified: trunk/Source/WebCore/fileapi/File.h (111568 => 111569)
--- trunk/Source/WebCore/fileapi/File.h 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/Source/WebCore/fileapi/File.h 2012-03-21 17:26:40 UTC (rev 111569)
@@ -74,10 +74,6 @@
// Note that this involves synchronous file operation. Think twice before calling this function.
void captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const;
- // FIXME: obsolete attributes. To be removed.
- const String& fileName() const { return name(); }
- unsigned long long fileSize() const { return size(); }
-
private:
File(const String& path);
Modified: trunk/Source/WebCore/fileapi/File.idl (111568 => 111569)
--- trunk/Source/WebCore/fileapi/File.idl 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/Source/WebCore/fileapi/File.idl 2012-03-21 17:26:40 UTC (rev 111569)
@@ -37,10 +37,6 @@
#if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD
readonly attribute DOMString webkitRelativePath;
#endif
-
- // FIXME: obsolete attributes. To be removed.
- readonly attribute DOMString fileName;
- readonly attribute unsigned long long fileSize;
};
}
Modified: trunk/Source/WebCore/html/FileInputType.cpp (111568 => 111569)
--- trunk/Source/WebCore/html/FileInputType.cpp 2012-03-21 17:25:54 UTC (rev 111568)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2012-03-21 17:26:40 UTC (rev 111569)
@@ -143,7 +143,7 @@
// submission of file inputs, and Firefox doesn't add "name=" query
// parameter.
for (unsigned i = 0; i < numFiles; ++i)
- encoding.appendData(element()->name(), fileList->item(i)->fileName());
+ encoding.appendData(element()->name(), fileList->item(i)->name());
return true;
}
@@ -240,7 +240,7 @@
// decided to try to parse the value by looking for backslashes
// (because that's what Windows file paths use). To be compatible
// with that code, we make up a fake path for the file.
- value = "C:\\fakepath\\" + m_fileList->item(0)->fileName();
+ value = "C:\\fakepath\\" + m_fileList->item(0)->name();
return true;
}
@@ -417,7 +417,7 @@
StringBuilder names;
for (size_t i = 0; i < listSize; ++i) {
- names.append(fileList->item(i)->fileName());
+ names.append(fileList->item(i)->name());
if (i != listSize - 1)
names.append('\n');
}