Title: [290595] trunk
Revision
290595
Author
[email protected]
Date
2022-02-28 06:50:05 -0800 (Mon, 28 Feb 2022)

Log Message

FTP EPLF does not handle directory
https://bugs.webkit.org/show_bug.cgi?id=45113

Patch by Pascal Abresch <[email protected]> on 2022-02-28
Reviewed by Darin Adler.

The code used "!result.type" to check for an invalid type. However,
the first type in the FTPEntryType enum is FTPDirectoryEntry, so this
was actually returning true for directories, turning them into "junk"
entries which would not be listed.

Since the code for EPLF can only result in either files, directories,
or uninitialized/junk entries, the check can be removed, returning
result.type is the correct thing to do in all 3 cases.
Source/WebCore:

Test: http/tests/misc/ftp-eplf-directory.py

* loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine):

LayoutTests:

* http/tests/misc/ftp-eplf-directory-expected.txt: Added.
* http/tests/misc/ftp-eplf-directory.py: Added.
* platform/gtk/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290594 => 290595)


--- trunk/LayoutTests/ChangeLog	2022-02-28 14:01:27 UTC (rev 290594)
+++ trunk/LayoutTests/ChangeLog	2022-02-28 14:50:05 UTC (rev 290595)
@@ -1,3 +1,23 @@
+2022-02-28  Pascal Abresch  <[email protected]>
+
+        FTP EPLF does not handle directory
+        https://bugs.webkit.org/show_bug.cgi?id=45113
+
+        Reviewed by Darin Adler.
+
+        The code used "!result.type" to check for an invalid type. However,
+        the first type in the FTPEntryType enum is FTPDirectoryEntry, so this
+        was actually returning true for directories, turning them into "junk"
+        entries which would not be listed.
+
+        Since the code for EPLF can only result in either files, directories,
+        or uninitialized/junk entries, the check can be removed, returning
+        result.type is the correct thing to do in all 3 cases.
+    
+        * http/tests/misc/ftp-eplf-directory-expected.txt: Added.
+        * http/tests/misc/ftp-eplf-directory.py: Added.
+        * platform/gtk/TestExpectations:
+
 2022-02-28  Carlos Garcia Campos  <[email protected]>
 
         [ATSPI] Always expose table cells (layout and CSS) that have rendered text content

Added: trunk/LayoutTests/http/tests/misc/ftp-eplf-directory-expected.txt (0 => 290595)


--- trunk/LayoutTests/http/tests/misc/ftp-eplf-directory-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/ftp-eplf-directory-expected.txt	2022-02-28 14:50:05 UTC (rev 290595)
@@ -0,0 +1,50 @@
+layer at (0,0) size 785x1184
+  RenderView at (0,0) size 785x600
+    RenderBlock {HTML} at (0,600) size 785x584
+      RenderBody {BODY} at (8,0) size 769x584
+layer at (8,8) size 769x584
+  RenderBody {BODY} at (8,8) size 769x584
+    RenderTable {TABLE} at (0,0) size 769x68
+      RenderTableSection {TBODY} at (0,0) size 769x68
+        RenderTableRow {TR} at (0,2) size 769x20
+          RenderTableCell {TD} at (2,2) size 8x20 [r=0 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x18
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,2) size 480x20 [r=0 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 374x18 [color=#0000EE]
+              RenderText {#text} at (1,1) size 374x18
+                text run at (1,1) width 374: "In order to pass there must be a directory entry below here"
+          RenderTableCell {TD} at (492,2) size 202x20 [r=0 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 151x18
+              text run at (1,1) width 151: "Mar 1, 1996, 10:15 PM"
+          RenderTableCell {TD} at (695,2) size 73x20 [r=0 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 55x18
+              text run at (1,1) width 55: "0.28 KB"
+        RenderTableRow {TR} at (0,24) size 769x20
+          RenderTableCell {TD} at (2,24) size 8x20 [r=1 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x18
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,24) size 480x20 [r=1 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 63x18 [color=#0000EE]
+              RenderText {#text} at (1,1) size 63x18
+                text run at (1,1) width 63: "directory/"
+          RenderTableCell {TD} at (492,24) size 202x20 [r=1 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 155x18
+              text run at (1,1) width 155: "Feb 13, 1996, 11:58 PM"
+          RenderTableCell {TD} at (695,24) size 73x20 [r=1 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 11x18
+              text run at (1,1) width 11: "--"
+        RenderTableRow {TR} at (0,46) size 769x20
+          RenderTableCell {TD} at (2,46) size 8x20 [r=2 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x18
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,46) size 480x20 [r=2 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 68x18 [color=#0000EE]
+              RenderText {#text} at (1,1) size 68x18
+                text run at (1,1) width 68: "third entry"
+          RenderTableCell {TD} at (492,46) size 202x20 [r=2 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 155x18
+              text run at (1,1) width 155: "Feb 13, 1996, 11:14 PM"
+          RenderTableCell {TD} at (695,46) size 73x20 [r=2 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 55x18
+              text run at (1,1) width 55: "0.61 KB"

Added: trunk/LayoutTests/http/tests/misc/ftp-eplf-directory.py (0 => 290595)


--- trunk/LayoutTests/http/tests/misc/ftp-eplf-directory.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/ftp-eplf-directory.py	2022-02-28 14:50:05 UTC (rev 290595)
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+
+sys.stdout.write(
+    'Content-type: application/x-ftp-directory\n\n'
+    '+i8388621.48594,m825718503,r,s280,\tIn order to pass there must be a directory entry below here\r\n'
+    '+i8388621.50690,m824255907,/,\tdirectory\r\n'
+    '+i8388621.48598,m824253270,r,s612,\tthird entry\r\n'
+)
Property changes on: trunk/LayoutTests/http/tests/misc/ftp-eplf-directory.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (290594 => 290595)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2022-02-28 14:01:27 UTC (rev 290594)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2022-02-28 14:50:05 UTC (rev 290595)
@@ -1881,3 +1881,6 @@
 http/tests/push-api/subscribe-default-permissions.html [ Failure ]
 http/tests/push-api/subscribe-deny-permissions.html [ Failure ]
 http/tests/push-api/subscribe-grant-permissions.html [ Failure ]
+
+# Ftp code is disabled in gtk port
+http/tests/misc/ftp-eplf-directory.py [ Skip ]

Added: trunk/LayoutTests/platform/ios/http/tests/misc/ftp-eplf-directory-expected.txt (0 => 290595)


--- trunk/LayoutTests/platform/ios/http/tests/misc/ftp-eplf-directory-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios/http/tests/misc/ftp-eplf-directory-expected.txt	2022-02-28 14:50:05 UTC (rev 290595)
@@ -0,0 +1,50 @@
+layer at (0,0) size 800x1184
+  RenderView at (0,0) size 800x600
+    RenderBlock {HTML} at (0,600) size 800x584
+      RenderBody {BODY} at (8,0) size 784x584
+layer at (8,8) size 784x584
+  RenderBody {BODY} at (8,8) size 784x584
+    RenderTable {TABLE} at (0,0) size 784x74
+      RenderTableSection {TBODY} at (0,0) size 784x74
+        RenderTableRow {TR} at (0,2) size 784x22
+          RenderTableCell {TD} at (2,2) size 8x22 [r=0 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x19
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,2) size 490x22 [r=0 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 374x19 [color=#0000EE]
+              RenderText {#text} at (1,1) size 374x19
+                text run at (1,1) width 374: "In order to pass there must be a directory entry below here"
+          RenderTableCell {TD} at (502,2) size 205x22 [r=0 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 151x19
+              text run at (1,1) width 151: "Mar 1, 1996, 10:15 PM"
+          RenderTableCell {TD} at (708,2) size 75x22 [r=0 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 55x19
+              text run at (1,1) width 55: "0.28 KB"
+        RenderTableRow {TR} at (0,26) size 784x22
+          RenderTableCell {TD} at (2,26) size 8x22 [r=1 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x19
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,26) size 490x22 [r=1 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 63x19 [color=#0000EE]
+              RenderText {#text} at (1,1) size 63x19
+                text run at (1,1) width 63: "directory/"
+          RenderTableCell {TD} at (502,26) size 205x22 [r=1 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 155x19
+              text run at (1,1) width 155: "Feb 13, 1996, 11:58 PM"
+          RenderTableCell {TD} at (708,26) size 75x22 [r=1 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 11x19
+              text run at (1,1) width 11: "--"
+        RenderTableRow {TR} at (0,50) size 784x22
+          RenderTableCell {TD} at (2,50) size 8x22 [r=2 c=0 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 4x19
+              text run at (1,1) width 4: " "
+          RenderTableCell {TD} at (11,50) size 490x22 [r=2 c=1 rs=1 cs=1]
+            RenderInline {A} at (0,0) size 68x19 [color=#0000EE]
+              RenderText {#text} at (1,1) size 68x19
+                text run at (1,1) width 68: "third entry"
+          RenderTableCell {TD} at (502,50) size 205x22 [r=2 c=2 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 155x19
+              text run at (1,1) width 155: "Feb 13, 1996, 11:14 PM"
+          RenderTableCell {TD} at (708,50) size 75x22 [r=2 c=3 rs=1 cs=1]
+            RenderText {#text} at (1,1) size 55x19
+              text run at (1,1) width 55: "0.61 KB"

Modified: trunk/Source/WebCore/ChangeLog (290594 => 290595)


--- trunk/Source/WebCore/ChangeLog	2022-02-28 14:01:27 UTC (rev 290594)
+++ trunk/Source/WebCore/ChangeLog	2022-02-28 14:50:05 UTC (rev 290595)
@@ -1,3 +1,24 @@
+2022-02-28  Pascal Abresch  <[email protected]>
+
+        FTP EPLF does not handle directory
+        https://bugs.webkit.org/show_bug.cgi?id=45113
+
+        Reviewed by Darin Adler.
+
+        The code used "!result.type" to check for an invalid type. However,
+        the first type in the FTPEntryType enum is FTPDirectoryEntry, so this
+        was actually returning true for directories, turning them into "junk"
+        entries which would not be listed.
+
+        Since the code for EPLF can only result in either files, directories,
+        or uninitialized/junk entries, the check can be removed, returning
+        result.type is the correct thing to do in all 3 cases.
+
+        Test: http/tests/misc/ftp-eplf-directory.py
+
+        * loader/FTPDirectoryParser.cpp:
+        (WebCore::parseOneFTPLine):
+
 2022-02-28  Youenn Fablet  <[email protected]>
 
         Ensure RemoteMediaPlayerProxy sets its resource owner to pixel buffers created by its player

Modified: trunk/Source/WebCore/loader/FTPDirectoryParser.cpp (290594 => 290595)


--- trunk/Source/WebCore/loader/FTPDirectoryParser.cpp	2022-02-28 14:01:27 UTC (rev 290594)
+++ trunk/Source/WebCore/loader/FTPDirectoryParser.cpp	2022-02-28 14:50:05 UTC (rev 290595)
@@ -189,11 +189,6 @@
             result.filename = tokens[1];
             result.filenameLength = p - tokens[1];
 
-            if (!result.type) /* access denied */
-            {
-              result.type = FTPFileEntry; /* is assuming 'f'ile correct? */
-              return FTPJunkEntry;            /* NO! junk it. */
-            }
             return result.type;
           }
           if (pos >= (linelen-1) || line[pos] != ',')
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to