Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 04:12:30 +0000 (04:12 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 04:12:30 +0000 (04:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178154

Reviewed by Wenson Hsieh.

Source/WebCore:

Extracted the logic to compute the default enabled-ness of custom pasteboard data as
Settings::defaultCustomPasteboardDataEnabled() to be called by WebKit1 and WebKit2 layers.

* page/Settings.cpp:
(WebCore::Settings::defaultCustomPasteboardDataEnabled): Extracted from customPasteboardDataEnabled.
(WebCore::Settings::customPasteboardDataEnabled): Deleted. Now inlined in the header file.
* page/Settings.h:
(WebCore::Settings::customPasteboardDataEnabled):
* platform/cocoa/PasteboardCocoa.mm:
(WebCore::Pasteboard::read): Fixed a bug that we were adding MIME type to the map before checking that
we could actually read the buffer. We shouldn't skip a type (NSTIFFPboardType and kUTTypeTIFF for now)
if an equivalent type had failed to read.

Source/WebKit:

Plumbed customPasteboardDataEnabled flag to be used in WebKitTestRunner.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetCustomPasteboardDataEnabled):
(WKPreferencesGetCustomPasteboardDataEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WebKitLegacy/mac:

Enable custom pasteboard data by default.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences customPasteboardDataEnabled]): Added.
(-[WebPreferences setCustomPasteboardDataEnabled:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

Fixed the bug that LocalPasteboard would fail to load the promise type if data is set after declaring types
by delaying the call to provideDataForType until when dataForType is called.

Without this fix, fast/events/dropzone-002.html would start failing after enabling custom pasteboard data.
With this fix, fast/events/dropzone-005.html also starts passing.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
(-[LocalPasteboard addTypes:owner:]):
(-[LocalPasteboard dataForType:]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

* editing/pasteboard/dataTransfer-setData-getData-expected.txt: Rebaselined. One more test case is passing now.
* fast/events/dropzone-002.html: Fixed the test to accept an image since we no longer drop URLs when dropping
an image avoid leaking local file paths.
* platform/mac/TestExpectations: Enabled dropzone-005.html since it started passing after fixing LocalPasteboard.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223167 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt
LayoutTests/fast/events/dropzone-002.html
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/cocoa/PasteboardCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesDefinitions.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm
Tools/WebKitTestRunner/TestController.cpp

index 30688ae..40e85a5 100644 (file)
@@ -1,3 +1,15 @@
+2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=178154
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/pasteboard/dataTransfer-setData-getData-expected.txt: Rebaselined. One more test case is passing now.
+        * fast/events/dropzone-002.html: Fixed the test to accept an image since we no longer drop URLs when dropping
+        an image avoid leaking local file paths.
+        * platform/mac/TestExpectations: Enabled dropzone-005.html since it started passing after fixing LocalPasteboard.
+
 2017-10-10  Andy Estes  <aestes@apple.com>
 
         [Payment Request] Validate that all PaymentCurrencyAmounts use the same currency code when using Apple Pay
index 0bf7d6f..f0da65e 100644 (file)
@@ -5,7 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 --- Test set/get 'URL':
 PASS getDataResultType is "string"
-FAIL getDataResult should be http://test.com/. Was http://test.com.
+PASS getDataResult is "http://test.com/"
 --- Test set/get 'URL' with multiple URLs:
 PASS getDataResultType is "string"
 FAIL getDataResult should be http://test.com/. Was .
index 37344a7..5f62ea9 100644 (file)
@@ -32,7 +32,7 @@ window.onload = function()
 
 function changeDropZone()
 {
-    dropTarget.setAttribute("webkitdropzone", " StRinG:tExT/pLaIn sTrING:TeXt/UrI-lIsT " + dropEffectElem.options[dropEffectElem.selectedIndex].value);
+    dropTarget.setAttribute("webkitdropzone", " StRinG:tExT/pLaIn sTrING:TeXt/UrI-lIsT file:image/png " + dropEffectElem.options[dropEffectElem.selectedIndex].value);
 }
 
 function printDropEvent(e)
@@ -55,7 +55,7 @@ function runTest()
     var endY = dropTarget.offsetTop + dropTarget.offsetHeight / 2
     
     var numEffects = dropEffectElem.options.length;
-    
+
     for (var j = 0; j < numEffects; ++j) {
         dropEffectElem.options[j].selected = true;
         changeDropZone();
index 69698be..267442f 100644 (file)
@@ -276,9 +276,6 @@ webkit.org/b/81289 canvas/philip/tests/2d.line.cap.round.html [ Failure ]
 
 webkit.org/b/81410 scrollbars/scrollbar-middleclick-nopaste.html
 
-# Has failed since its introduction in r105826.
-webkit.org/b/61630 fast/events/dropzone-005.html [ Failure ]
-
 # Spelling tests that are flakey.
 webkit.org/b/82555 editing/spelling/spellcheck-async-mutation.html [ Pass Failure ]
 
index eb1de4c..d712600 100644 (file)
@@ -1,3 +1,23 @@
+2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=178154
+
+        Reviewed by Wenson Hsieh.
+
+        Extracted the logic to compute the default enabled-ness of custom pasteboard data as
+        Settings::defaultCustomPasteboardDataEnabled() to be called by WebKit1 and WebKit2 layers.
+
+        * page/Settings.cpp:
+        (WebCore::Settings::defaultCustomPasteboardDataEnabled): Extracted from customPasteboardDataEnabled.
+        (WebCore::Settings::customPasteboardDataEnabled): Deleted. Now inlined in the header file.
+        * page/Settings.h:
+        (WebCore::Settings::customPasteboardDataEnabled):
+        * platform/cocoa/PasteboardCocoa.mm:
+        (WebCore::Pasteboard::read): Fixed a bug that we were adding MIME type to the map before checking that
+        we could actually read the buffer. We shouldn't skip a type (NSTIFFPboardType and kUTTypeTIFF for now)
+        if an equivalent type had failed to read.
+
 2017-10-10  Andy Estes  <aestes@apple.com>
 
         [Payment Request] Validate that all PaymentCurrencyAmounts use the same currency code when using Apple Pay
index e6d7495..129c6dc 100644 (file)
@@ -144,21 +144,17 @@ static EditingBehaviorType editingBehaviorTypeForPlatform()
     ;
 }
 
-bool Settings::customPasteboardDataEnabled()
+bool Settings::defaultCustomPasteboardDataEnabled()
 {
-    static std::once_flag initializeCustomPasteboardDataToDefaultValue;
-    std::call_once(initializeCustomPasteboardDataToDefaultValue, [] {
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300
-        gCustomPasteboardDataEnabled = IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3;
+    return IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3;
 #elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
-        gCustomPasteboardDataEnabled = MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13;
+    return MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13;
 #elif PLATFORM(MAC)
-        gCustomPasteboardDataEnabled = MacApplication::isSafari();
+    return MacApplication::isSafari();
 #else
-        gCustomPasteboardDataEnabled = false;
+    return false;
 #endif
-    });
-    return gCustomPasteboardDataEnabled;
 }
 
 #if PLATFORM(COCOA)
index 4b5998c..735f4ee 100644 (file)
@@ -304,7 +304,8 @@ public:
 #endif
 
     static void setCustomPasteboardDataEnabled(bool enabled) { gCustomPasteboardDataEnabled = enabled; }
-    WEBCORE_EXPORT static bool customPasteboardDataEnabled();
+    static bool customPasteboardDataEnabled() { return gCustomPasteboardDataEnabled; }
+    WEBCORE_EXPORT static bool defaultCustomPasteboardDataEnabled();
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     void setMediaKeysStorageDirectory(const String& directory) { m_mediaKeysStorageDirectory = directory; }
index 05cebbb..0777e48 100644 (file)
@@ -195,7 +195,7 @@ void Pasteboard::read(PasteboardFileReader& reader)
         const char* mimeType = imageTypeToMIMEType(imageType);
         if (!mimeType)
             continue;
-        if (!existingMIMEs.add(mimeType).isNewEntry)
+        if (existingMIMEs.contains(mimeType))
             continue;
         auto buffer = readBufferForTypeWithSecurityCheck(cocoaType);
 #if PLATFORM(MAC)
@@ -204,6 +204,7 @@ void Pasteboard::read(PasteboardFileReader& reader)
 #endif
         if (!buffer)
             continue;
+        existingMIMEs.add(mimeType);
         reader.readBuffer(imageTypeToFakeFilename(imageType), mimeType, buffer.releaseNonNull());
     }
 }
index 6c111ba..5f5b291 100644 (file)
@@ -1,3 +1,20 @@
+2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=178154
+
+        Reviewed by Wenson Hsieh.
+
+        Plumbed customPasteboardDataEnabled flag to be used in WebKitTestRunner.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetCustomPasteboardDataEnabled):
+        (WKPreferencesGetCustomPasteboardDataEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-10-10  Adrian Perez de Castro  <aperez@igalia.com>
 
         [WPE] Remove the possibility of installing the old WebKit2 C API
index 55bc01a..7e598a5 100644 (file)
     macro(InspectorAdditionsEnabled, inspectorAdditionsEnabled, Bool, bool, false, "Web Inspector Additions", "Enable additional page APIs used by the Web Inspector frontend page") \
     macro(DirectoryUploadEnabled, directoryUploadEnabled, Bool, bool, DEFAULT_DIRECTORY_UPLOAD_ENABLED, "Directory Upload", "input.webkitdirectory / dataTransferItem.webkitGetAsEntry()") \
     macro(DataTransferItemsEnabled, dataTransferItemsEnabled, Bool, bool, DEFAULT_DATA_TRANSFER_ITEMS_ENABLED, "Data Transfer Items", "Enables DataTransferItem in the clipboard API") \
+    macro(CustomPasteboardDataEnabled, customPasteboardDataEnabled, Bool, bool, WebCore::Settings::defaultCustomPasteboardDataEnabled(), "Custom pateboard data", "Enable custom clipboard types and better security model for clipboard API.") \
     macro(WebVREnabled, webVREnabled, Bool, bool, false, "WebVR", "WebVR Module support") \
     macro(ViewportFitEnabled, viewportFitEnabled, Bool, bool, true, "Viewport Fit", "Enable viewport-fit viewport parameter") \
     \
index f4d450f..afc8df5 100644 (file)
@@ -1680,6 +1680,16 @@ bool WKPreferencesGetDataTransferItemsEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->dataTransferItemsEnabled();
 }
 
+void WKPreferencesSetCustomPasteboardDataEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setCustomPasteboardDataEnabled(flag);
+}
+
+bool WKPreferencesGetCustomPasteboardDataEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->customPasteboardDataEnabled();
+}
+
 void WKPreferencesSetDownloadAttributeEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setDownloadAttributeEnabled(flag);
index db8c51a..2677930 100644 (file)
@@ -474,6 +474,10 @@ WK_EXPORT void WKPreferencesSetDataTransferItemsEnabled(WKPreferencesRef, bool f
 WK_EXPORT bool WKPreferencesGetDataTransferItemsEnabled(WKPreferencesRef);
 
 // Defaults to false
+WK_EXPORT void WKPreferencesSetCustomPasteboardDataEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetCustomPasteboardDataEnabled(WKPreferencesRef);
+
+// Defaults to false
 WK_EXPORT void WKPreferencesSetUserTimingEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetUserTimingEnabled(WKPreferencesRef);
 
index 8d576ea..22a7263 100644 (file)
@@ -3336,6 +3336,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
     RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled(store.getBoolValueForKey(WebPreferencesKey::dataTransferItemsEnabledKey()));
 
+    settings.setCustomPasteboardDataEnabled(store.getBoolValueForKey(WebPreferencesKey::customPasteboardDataEnabledKey()));
+
 #if ENABLE(ATTACHMENT_ELEMENT)
     RuntimeEnabledFeatures::sharedFeatures().setAttachmentElementEnabled(store.getBoolValueForKey(WebPreferencesKey::attachmentElementEnabledKey()));
 #endif
index a01405b..f58af1a 100644 (file)
@@ -1,3 +1,21 @@
+2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=178154
+
+        Reviewed by Wenson Hsieh.
+
+        Enable custom pasteboard data by default.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences customPasteboardDataEnabled]): Added.
+        (-[WebPreferences setCustomPasteboardDataEnabled:]): Added.
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-10-10  Sam Weinig  <sam@webkit.org>
 
         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
index f3da30c..bd94f64 100644 (file)
 #define WebKitShadowDOMEnabledPreferenceKey @"WebKitShadowDOMEnabled"
 #define WebKitCustomElementsEnabledPreferenceKey @"WebKitCustomElementsEnabled"
 #define WebKitDataTransferItemsEnabledPreferenceKey @"WebKitDataTransferItemsEnabled"
+#define WebKitCustomPasteboardDataEnabledPreferenceKey @"WebKitCustomPasteboardDataEnabled"
 #define WebKitCacheAPIEnabledPreferenceKey @"WebKitCacheAPIEnabled"
 #define WebKitFetchAPIEnabledPreferenceKey @"WebKitFetchAPIEnabled"
 #define WebKitWritableStreamAPIEnabledPreferenceKey @"WebKitWritableStreamAPIEnabled"
index 760ad20..a78df6e 100644 (file)
@@ -622,6 +622,7 @@ public:
         [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey,
+        [NSNumber numberWithBool:Settings::defaultCustomPasteboardDataEnabled()], WebKitCustomPasteboardDataEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey,
 #if ENABLE(WEBGL2)
         [NSNumber numberWithBool:NO], WebKitWebGL2EnabledPreferenceKey,
@@ -2983,6 +2984,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitDataTransferItemsEnabledPreferenceKey];
 }
 
+- (BOOL)customPasteboardDataEnabled
+{
+    return [self _boolValueForKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
+}
+
+- (void)setCustomPasteboardDataEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
+}
+
 - (BOOL)cacheAPIEnabled
 {
     return [self _boolValueForKey:WebKitCacheAPIEnabledPreferenceKey];
index f59c151..79084c9 100644 (file)
@@ -537,6 +537,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setDataTransferItemsEnabled:(BOOL)flag;
 - (BOOL)dataTransferItemsEnabled;
 
+- (void)setCustomPasteboardDataEnabled:(BOOL)flag;
+- (BOOL)customPasteboardDataEnabled;
+
 - (BOOL)cacheAPIEnabled;
 - (void)setCacheAPIEnabled:(BOOL)enabled;
 
index 799d9e2..8cdda5b 100644 (file)
@@ -3066,6 +3066,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
     [WAKView _setInterpolationQuality:[preferences _interpolationQuality]];
 #endif
 
+    settings.setCustomPasteboardDataEnabled([preferences customPasteboardDataEnabled]);
+
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     settings.setMediaKeysStorageDirectory([preferences mediaKeysStorageDirectory]);
 #endif
index 05adbec..3bd753b 100644 (file)
@@ -1,3 +1,24 @@
+2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=178154
+
+        Reviewed by Wenson Hsieh.
+
+        Fixed the bug that LocalPasteboard would fail to load the promise type if data is set after declaring types
+        by delaying the call to provideDataForType until when dataForType is called.
+
+        Without this fix, fast/events/dropzone-002.html would start failing after enabling custom pasteboard data.
+        With this fix, fast/events/dropzone-005.html also starts passing.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
+        (-[LocalPasteboard addTypes:owner:]):
+        (-[LocalPasteboard dataForType:]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2017-10-10  Joanmarie Diggs  <jdiggs@igalia.com>
 
         AX: [ATK] ARIA form role should be mapped to ATK_ROLE_LANDMARK; not ATK_ROLE_FORM
index fac2b24..0251f98 100644 (file)
@@ -952,6 +952,7 @@ static void resetWebPreferencesToConsistentValues()
     [preferences setCustomElementsEnabled:YES];
 
     [preferences setDataTransferItemsEnabled:YES];
+    [preferences setCustomPasteboardDataEnabled:YES];
 
     [preferences setWebGL2Enabled:YES];
     [preferences setWebGPUEnabled:YES];
index ad51dd4..e79bd87 100644 (file)
@@ -42,6 +42,7 @@
 #import <wtf/RetainPtr.h>
 
 @interface LocalPasteboard : NSPasteboard {
+    RetainPtr<id> _owner;
     RetainPtr<NSString> _pasteboardName;
     NSInteger _changeCount;
 
@@ -140,13 +141,10 @@ static RetainPtr<NSString> toUTI(NSString *type)
 
 - (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner
 {
-    for (NSString *type in newTypes) {
+    _owner = newOwner;
+    for (NSString *type in newTypes)
         _types.add(toUTI(type));
 
-        if (newOwner && [newOwner respondsToSelector:@selector(pasteboard:provideDataForType:)])
-            [newOwner pasteboard:self provideDataForType:type];
-    }
-
     return ++_changeCount;
 }
 
@@ -194,6 +192,12 @@ static RetainPtr<NSString> toUTI(NSString *type)
 
 - (NSData *)dataForType:(NSString *)dataType
 {
+    if (NSData *data = _data.get(toUTI(dataType)).get())
+        return data;
+
+    if (_owner && [_owner respondsToSelector:@selector(pasteboard:provideDataForType:)])
+        [_owner pasteboard:self provideDataForType:dataType];
+
     return _data.get(toUTI(dataType)).get();
 }
 
index 8e48f09..d0ae474 100644 (file)
@@ -683,6 +683,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetInteractiveFormValidationEnabled(preferences, true);
     WKPreferencesSetDisplayContentsEnabled(preferences, true);
     WKPreferencesSetDataTransferItemsEnabled(preferences, true);
+    WKPreferencesSetCustomPasteboardDataEnabled(preferences, true);
 
     WKPreferencesSetMockScrollbarsEnabled(preferences, options.useMockScrollbars);
     WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);