Title: [266187] trunk
Revision
266187
Author
[email protected]
Date
2020-08-26 13:18:23 -0700 (Wed, 26 Aug 2020)

Log Message

Implement DataTransfer constructor and multipart form filename encoding as other browsers do
https://bugs.webkit.org/show_bug.cgi?id=215837

Patch by Alex Christensen <[email protected]> on 2020-08-26
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* web-platform-tests/FileAPI/file/send-file-form-expected.txt:
* web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative-expected.txt:
* web-platform-tests/FileAPI/file/send-file-form-utf-8-expected.txt:
* web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative-expected.txt:
* web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative-expected.txt:
* web-platform-tests/html/editing/dnd/datastore/datatransfer-constructor-001-expected.txt:
* web-platform-tests/html/editing/dnd/datastore/datatransfer-types-expected.txt:
This test still fails because of bindings issues.  DataTransfer.types should apparently return
a cached JSValue that is updated whenever the contents change, which I don't think our bindings
generator can handle right now, so these tests are now failing in a different way.
I think that's fine because I think most uses of DataTransfer.types will just be checking the contents,
not whether its === to a stored reference like these tests do.  We should fix this later.
* web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub-expected.txt:
* web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub.html:
Updated to successfully submit the form to a listening server in our test infrastructure,
so that we see PASS like we do now on wpt.live
* web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt:

Source/WebCore:

Covered by newly passing WPT tests that Chrome and Firefox both pass.

* dom/DataTransfer.cpp:
(WebCore::DataTransfer::create):
* dom/DataTransfer.h:
* dom/DataTransfer.idl:
* platform/network/FormDataBuilder.cpp:
(WebCore::FormDataBuilder::addFilenameToMultiPartHeader):

LayoutTests:

* fast/dom/dom-constructors-expected.txt:
* fast/dom/dom-constructors.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (266186 => 266187)


--- trunk/LayoutTests/ChangeLog	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/ChangeLog	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,3 +1,13 @@
+2020-08-26  Alex Christensen  <[email protected]>
+
+        Implement DataTransfer constructor and multipart form filename encoding as other browsers do
+        https://bugs.webkit.org/show_bug.cgi?id=215837
+
+        Reviewed by Youenn Fablet.
+
+        * fast/dom/dom-constructors-expected.txt:
+        * fast/dom/dom-constructors.html:
+
 2020-08-26  Chris Dumez  <[email protected]>
 
         REGRESSION (r265908): Crash under Blob::arrayBuffer() / Blob::text() in stress GC

Modified: trunk/LayoutTests/fast/dom/dom-constructors-expected.txt (266186 => 266187)


--- trunk/LayoutTests/fast/dom/dom-constructors-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/fast/dom/dom-constructors-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -80,7 +80,6 @@
 PASS TryAllocate('CSSStyleSheet') is 'exception'
 PASS TryAllocate('CSSValue') is 'exception'
 PASS TryAllocate('CSSValueList') is 'exception'
-PASS TryAllocate('DataTransfer') is 'exception'
 PASS TryAllocate('DOMImplementation') is 'exception'
 PASS TryAllocate('HTMLCollection') is 'exception'
 PASS TryAllocate('MediaList') is 'exception'
@@ -124,6 +123,9 @@
 PASS TryAllocate('DOMParser') is '[object DOMParser]'
 PASS TryAllocate('DOMParser') is '[object DOMParser]'
 PASS TryAllocate('DOMParser') is '[object DOMParser]'
+PASS TryAllocate('DataTransfer') is '[object DataTransfer]'
+PASS TryAllocate('DataTransfer') is '[object DataTransfer]'
+PASS TryAllocate('DataTransfer') is '[object DataTransfer]'
 PASS TryAllocate('Document') is '[object Document]'
 PASS TryAllocate('Document') is '[object Document]'
 PASS TryAllocate('Document') is '[object Document]'

Modified: trunk/LayoutTests/fast/dom/dom-constructors.html (266186 => 266187)


--- trunk/LayoutTests/fast/dom/dom-constructors.html	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/fast/dom/dom-constructors.html	2020-08-26 20:18:23 UTC (rev 266187)
@@ -90,7 +90,6 @@
     'CSSStyleSheet',
     'CSSValue',
     'CSSValueList',
-    'DataTransfer',
     'DOMImplementation',
     'HTMLCollection',
     'MediaList',
@@ -129,6 +128,7 @@
 var objects_constructor = [
     'Comment',
     'DOMParser',
+    'DataTransfer',
     'Document',
     'DocumentFragment',
     'EventTarget',

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,3 +1,28 @@
+2020-08-26  Alex Christensen  <[email protected]>
+
+        Implement DataTransfer constructor and multipart form filename encoding as other browsers do
+        https://bugs.webkit.org/show_bug.cgi?id=215837
+
+        Reviewed by Youenn Fablet.
+
+        * web-platform-tests/FileAPI/file/send-file-form-expected.txt:
+        * web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative-expected.txt:
+        * web-platform-tests/FileAPI/file/send-file-form-utf-8-expected.txt:
+        * web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative-expected.txt:
+        * web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative-expected.txt:
+        * web-platform-tests/html/editing/dnd/datastore/datatransfer-constructor-001-expected.txt:
+        * web-platform-tests/html/editing/dnd/datastore/datatransfer-types-expected.txt:
+        This test still fails because of bindings issues.  DataTransfer.types should apparently return
+        a cached JSValue that is updated whenever the contents change, which I don't think our bindings
+        generator can handle right now, so these tests are now failing in a different way.
+        I think that's fine because I think most uses of DataTransfer.types will just be checking the contents,
+        not whether its === to a stored reference like these tests do.  We should fix this later.
+        * web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub-expected.txt:
+        * web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub.html:
+        Updated to successfully submit the form to a listening server in our test infrastructure,
+        so that we see PASS like we do now on wpt.live
+        * web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt:
+
 2020-08-26  Chris Dumez  <[email protected]>
 
         IIRFilterNode interface is not supported

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,3 +1,3 @@
 
-FAIL Upload file-for-upload-in-form.txt (ASCII) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Upload file-for-upload-in-form.txt (ASCII) in UTF-8 form 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-iso-2022-jp.tentative-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,8 +1,8 @@
 
-FAIL Upload file-for-upload-in-form.txt (ASCII) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-.txt (x-user-defined) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (windows-1252) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (Unicode) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in ISO-2022-JP form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Upload file-for-upload-in-form.txt (ASCII) in ISO-2022-JP form 
+PASS Upload file-for-upload-in-form-.txt (x-user-defined) in ISO-2022-JP form 
+PASS Upload file-for-upload-in-form-☺😂.txt (windows-1252) in ISO-2022-JP form 
+PASS Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in ISO-2022-JP form 
+PASS Upload file-for-upload-in-form-☺😂.txt (Unicode) in ISO-2022-JP form 
+PASS Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in ISO-2022-JP form 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-utf-8-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,8 +1,8 @@
 
-FAIL Upload file-for-upload-in-form.txt (ASCII) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-.txt (x-user-defined) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (windows-1252) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (Unicode) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in UTF-8 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Upload file-for-upload-in-form.txt (ASCII) in UTF-8 form 
+PASS Upload file-for-upload-in-form-.txt (x-user-defined) in UTF-8 form 
+PASS Upload file-for-upload-in-form-☺😂.txt (windows-1252) in UTF-8 form 
+PASS Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in UTF-8 form 
+PASS Upload file-for-upload-in-form-☺😂.txt (Unicode) in UTF-8 form 
+PASS Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in UTF-8 form 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-windows-1252.tentative-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,8 +1,8 @@
 
-FAIL Upload file-for-upload-in-form.txt (ASCII) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-.txt (x-user-defined) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (windows-1252) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (Unicode) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in windows-1252 form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Upload file-for-upload-in-form.txt (ASCII) in windows-1252 form 
+PASS Upload file-for-upload-in-form-.txt (x-user-defined) in windows-1252 form 
+PASS Upload file-for-upload-in-form-☺😂.txt (windows-1252) in windows-1252 form 
+PASS Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in windows-1252 form 
+PASS Upload file-for-upload-in-form-☺😂.txt (Unicode) in windows-1252 form 
+PASS Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in windows-1252 form 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/file/send-file-form-x-user-defined.tentative-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,8 +1,8 @@
 
-FAIL Upload file-for-upload-in-form.txt (ASCII) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-.txt (x-user-defined) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (windows-1252) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-☺😂.txt (Unicode) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
-FAIL Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in x-user-defined form promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Upload file-for-upload-in-form.txt (ASCII) in x-user-defined form 
+PASS Upload file-for-upload-in-form-.txt (x-user-defined) in x-user-defined form 
+PASS Upload file-for-upload-in-form-☺😂.txt (windows-1252) in x-user-defined form 
+PASS Upload file-for-upload-in-form-★星★.txt (JIS X 0201 and JIS X 0208) in x-user-defined form 
+PASS Upload file-for-upload-in-form-☺😂.txt (Unicode) in x-user-defined form 
+PASS Upload file-for-upload-in-form-ABC~‾¥≈¤・・•∙·☼★星🌟星★☼·∙•・・¤≈¥‾~XYZ.txt (Unicode) in x-user-defined form 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-constructor-001-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-constructor-001-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-constructor-001-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,3 +1,3 @@
 
-FAIL Verify DataTransfer constructor Illegal constructor
+PASS Verify DataTransfer constructor 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-types-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-types-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/editing/dnd/datastore/datatransfer-types-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,6 +1,6 @@
 
-FAIL type's state on DataTransfer creation Illegal constructor
-FAIL Relationship between types and items Illegal constructor
-FAIL type's identity Illegal constructor
-FAIL Verify type is a read-only attribute Illegal constructor
+FAIL type's state on DataTransfer creation assert_equals: types must return the same object when the data store item list has not changed expected [] but got []
+FAIL Relationship between types and items assert_equals: expected ["text/plain"] but got ["text/plain"]
+FAIL type's identity assert_equals: expected ["text/plain"] but got ["text/plain"]
+FAIL Verify type is a read-only attribute assert_equals: expected [] but got []
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,5 +1,5 @@
 
 
 
-FAIL Posting a File Illegal constructor
+PASS Posting a File 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub.html (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub.html	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/submit-file.sub.html	2020-08-26 20:18:23 UTC (rev 266187)
@@ -4,7 +4,7 @@
 <script src=""
 <body>
 <iframe id=testframe name=testframe></iframe>
-<form id=testform method=post action="" target=testframe enctype="multipart/form-data">
+<form id=testform method=post action="" target=testframe enctype="multipart/form-data">
 <input name=testinput id=testinput type=file>
 </form>
 <script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt (266186 => 266187)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/data-transfer-files.https-expected.txt	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,5 +1,5 @@
 
 
 
-FAIL Posting a File in a navigation handled by a service worker promise_test: Unhandled rejection with value: object "TypeError: Illegal constructor"
+PASS Posting a File in a navigation handled by a service worker 
 

Modified: trunk/Source/WebCore/ChangeLog (266186 => 266187)


--- trunk/Source/WebCore/ChangeLog	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/Source/WebCore/ChangeLog	2020-08-26 20:18:23 UTC (rev 266187)
@@ -1,3 +1,19 @@
+2020-08-26  Alex Christensen  <[email protected]>
+
+        Implement DataTransfer constructor and multipart form filename encoding as other browsers do
+        https://bugs.webkit.org/show_bug.cgi?id=215837
+
+        Reviewed by Youenn Fablet.
+
+        Covered by newly passing WPT tests that Chrome and Firefox both pass.
+
+        * dom/DataTransfer.cpp:
+        (WebCore::DataTransfer::create):
+        * dom/DataTransfer.h:
+        * dom/DataTransfer.idl:
+        * platform/network/FormDataBuilder.cpp:
+        (WebCore::FormDataBuilder::addFilenameToMultiPartHeader):
+
 2020-08-26  Chris Dumez  <[email protected]>
 
         IIRFilterNode interface is not supported

Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (266186 => 266187)


--- trunk/Source/WebCore/dom/DataTransfer.cpp	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp	2020-08-26 20:18:23 UTC (rev 266187)
@@ -68,17 +68,18 @@
 
 #endif
 
-DataTransfer::DataTransfer(StoreMode mode, std::unique_ptr<Pasteboard> pasteboard, Type type)
+DataTransfer::DataTransfer(StoreMode mode, std::unique_ptr<Pasteboard> pasteboard, Type type, String&& effectAllowed)
     : m_storeMode(mode)
     , m_pasteboard(WTFMove(pasteboard))
 #if ENABLE(DRAG_SUPPORT)
     , m_type(type)
     , m_dropEffect("uninitialized"_s)
-    , m_effectAllowed("uninitialized"_s)
+    , m_effectAllowed(WTFMove(effectAllowed))
     , m_shouldUpdateDragImage(false)
 #endif
 {
 #if !ENABLE(DRAG_SUPPORT)
+    UNUSED_PARAM(effectAllowed);
     ASSERT_UNUSED(type, type != Type::DragAndDropData && type != Type::DragAndDropFiles);
 #endif
 }
@@ -90,6 +91,11 @@
     return dataTransfer;
 }
 
+Ref<DataTransfer> DataTransfer::create()
+{
+    return adoptRef(*new DataTransfer(StoreMode::ReadWrite, makeUnique<StaticPasteboard>(), Type::CopyAndPaste, "none"_s));
+}
+
 DataTransfer::~DataTransfer()
 {
 #if ENABLE(DRAG_SUPPORT)

Modified: trunk/Source/WebCore/dom/DataTransfer.h (266186 => 266187)


--- trunk/Source/WebCore/dom/DataTransfer.h	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/Source/WebCore/dom/DataTransfer.h	2020-08-26 20:18:23 UTC (rev 266187)
@@ -47,6 +47,7 @@
     // https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
     enum class StoreMode { Invalid, ReadWrite, Readonly, Protected };
 
+    static Ref<DataTransfer> create();
     static Ref<DataTransfer> createForCopyAndPaste(const Document&, StoreMode, std::unique_ptr<Pasteboard>&&);
     static Ref<DataTransfer> createForInputEvent(const String& plainText, const String& htmlText);
 
@@ -114,7 +115,7 @@
 
 private:
     enum class Type { CopyAndPaste, DragAndDropData, DragAndDropFiles, InputEvent };
-    DataTransfer(StoreMode, std::unique_ptr<Pasteboard>, Type = Type::CopyAndPaste);
+    DataTransfer(StoreMode, std::unique_ptr<Pasteboard>, Type = Type::CopyAndPaste, String&& effectAllowed = "uninitialized"_s);
 
 #if ENABLE(DRAG_SUPPORT)
     bool forDrag() const { return m_type == Type::DragAndDropData || m_type == Type::DragAndDropFiles; }

Modified: trunk/Source/WebCore/dom/DataTransfer.idl (266186 => 266187)


--- trunk/Source/WebCore/dom/DataTransfer.idl	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/Source/WebCore/dom/DataTransfer.idl	2020-08-26 20:18:23 UTC (rev 266187)
@@ -29,6 +29,8 @@
 [
     SkipVTableValidation,
 ] interface DataTransfer {
+    constructor();
+
     attribute DOMString dropEffect;
     attribute DOMString effectAllowed;
 

Modified: trunk/Source/WebCore/platform/network/FormDataBuilder.cpp (266186 => 266187)


--- trunk/Source/WebCore/platform/network/FormDataBuilder.cpp	2020-08-26 20:09:39 UTC (rev 266186)
+++ trunk/Source/WebCore/platform/network/FormDataBuilder.cpp	2020-08-26 20:18:23 UTC (rev 266187)
@@ -175,10 +175,8 @@
 
 void addFilenameToMultiPartHeader(Vector<char>& buffer, const TextEncoding& encoding, const String& filename)
 {
-    // FIXME: This loses data irreversibly if the filename includes characters you can't encode
-    // in the website's character set.
     append(buffer, "; filename=\"");
-    appendQuoted(buffer, encoding.encode(filename, UnencodableHandling::QuestionMarks));
+    appendQuoted(buffer, encoding.encode(filename, UnencodableHandling::Entities));
     append(buffer, '"');
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to