Changeset 227282 in webkit
- Timestamp:
- Jan 21, 2018 10:41:05 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r227281 r227282 1 2018-01-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 Turning off custom pasteboard data doesn't actually turn it off in WK2 4 https://bugs.webkit.org/show_bug.cgi?id=181920 5 <rdar://problem/36686429> 6 7 Reviewed by Wenson Hsieh. 8 9 Replaced the global settings for custom pasteboard data by regular runtime enabled flags. 10 11 * dom/DataTransfer.cpp: 12 (WebCore::DataTransfer::getDataForItem const): 13 (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): 14 (WebCore::DataTransfer::setDataFromItemList): 15 (WebCore::DataTransfer::types const): 16 (WebCore::DataTransfer::commitToPasteboard): 17 * dom/DataTransferItemList.cpp: 18 (WebCore::shouldExposeTypeInItemList): 19 * editing/Editor.cpp: 20 (WebCore::createDataTransferForClipboardEvent): 21 * editing/cocoa/WebContentReaderCocoa.mm: 22 (WebCore::createFragmentAndAddResources): 23 (WebCore::WebContentReader::readWebArchive): 24 * page/DeprecatedGlobalSettings.cpp: 25 (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted. 26 * page/DeprecatedGlobalSettings.h: 27 (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted. 28 (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted. 29 * page/RuntimeEnabledFeatures.h: 30 (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled): 31 (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const): 32 * testing/InternalSettings.cpp: 33 (WebCore::InternalSettings::Backup::Backup): 34 (WebCore::InternalSettings::Backup::restoreTo): 35 (WebCore::InternalSettings::setCustomPasteboardDataEnabled): 36 1 37 2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 38 -
trunk/Source/WebCore/dom/DataTransfer.cpp
r225117 r227282 31 31 #include "DataTransferItem.h" 32 32 #include "DataTransferItemList.h" 33 #include "DeprecatedGlobalSettings.h"34 33 #include "DocumentFragment.h" 35 34 #include "DragData.h" … … 42 41 #include "Image.h" 43 42 #include "Pasteboard.h" 43 #include "RuntimeEnabledFeatures.h" 44 44 #include "Settings.h" 45 45 #include "StaticPasteboard.h" … … 158 158 } 159 159 160 if (! DeprecatedGlobalSettings::customPasteboardDataEnabled())160 if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) 161 161 return m_pasteboard->readString(lowercaseType); 162 162 … … 189 189 bool DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths() const 190 190 { 191 if (!forFileDrag() && ! DeprecatedGlobalSettings::customPasteboardDataEnabled())191 if (!forFileDrag() && !RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) 192 192 return false; 193 193 return m_pasteboard->containsFiles(); … … 213 213 RELEASE_ASSERT(is<StaticPasteboard>(*m_pasteboard)); 214 214 215 if (! DeprecatedGlobalSettings::customPasteboardDataEnabled()) {215 if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 216 216 m_pasteboard->writeString(type, data); 217 217 return; … … 275 275 return { }; 276 276 277 if (! DeprecatedGlobalSettings::customPasteboardDataEnabled()) {277 if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 278 278 auto types = m_pasteboard->typesForLegacyUnsafeBindings(); 279 279 ASSERT(!types.contains("Files")); … … 383 383 ASSERT(is<StaticPasteboard>(*m_pasteboard) && !is<StaticPasteboard>(nativePasteboard)); 384 384 PasteboardCustomData customData = downcast<StaticPasteboard>(*m_pasteboard).takeCustomData(); 385 if ( DeprecatedGlobalSettings::customPasteboardDataEnabled()) {385 if (RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 386 386 customData.origin = m_originIdentifier; 387 387 nativePasteboard.writeCustomData(customData); -
trunk/Source/WebCore/dom/DataTransferItemList.cpp
r223728 r227282 28 28 29 29 #include "DataTransferItem.h" 30 #include "DeprecatedGlobalSettings.h"31 30 #include "FileList.h" 32 31 #include "Pasteboard.h" 32 #include "RuntimeEnabledFeatures.h" 33 33 #include "Settings.h" 34 34 … … 57 57 static bool shouldExposeTypeInItemList(const String& type) 58 58 { 59 return DeprecatedGlobalSettings::customPasteboardDataEnabled() || Pasteboard::isSafeTypeForDOMToReadAndWrite(type);59 return RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled() || Pasteboard::isSafeTypeForDOMToReadAndWrite(type); 60 60 } 61 61 -
trunk/Source/WebCore/editing/Editor.cpp
r227068 r227282 39 39 #include "DataTransfer.h" 40 40 #include "DeleteSelectionCommand.h" 41 #include "DeprecatedGlobalSettings.h"42 41 #include "DictationAlternative.h" 43 42 #include "DictationCommand.h" … … 84 83 #include "ReplaceRangeWithTextCommand.h" 85 84 #include "ReplaceSelectionCommand.h" 85 #include "RuntimeEnabledFeatures.h" 86 86 #include "Settings.h" 87 87 #include "ShadowRoot.h" … … 361 361 return DataTransfer::createForCopyAndPaste(document, DataTransfer::StoreMode::ReadWrite, std::make_unique<StaticPasteboard>()); 362 362 case ClipboardEventKind::PasteAsPlainText: 363 if ( DeprecatedGlobalSettings::customPasteboardDataEnabled()) {363 if (RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 364 364 auto plainTextType = ASCIILiteral("text/plain"); 365 365 auto plainText = Pasteboard::createForCopyAndPaste()->readString(plainTextType); -
trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm
r227084 r227282 32 32 #import "CachedResourceLoader.h" 33 33 #import "DOMURL.h" 34 #import "DeprecatedGlobalSettings.h"35 34 #import "Document.h" 36 35 #import "DocumentFragment.h" … … 327 326 return nullptr; 328 327 329 if (! DeprecatedGlobalSettings::customPasteboardDataEnabled()) {328 if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 330 329 if (DocumentLoader* loader = frame.loader().documentLoader()) { 331 330 for (auto& resource : fragmentAndResources.resources) … … 458 457 return false; 459 458 460 if (! DeprecatedGlobalSettings::customPasteboardDataEnabled()) {459 if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { 461 460 fragment = createFragmentFromMarkup(*frame.document(), result->markup, result->mainResource->url(), DisallowScriptingAndPluginContent); 462 461 if (DocumentLoader* loader = frame.loader().documentLoader()) -
trunk/Source/WebCore/page/DeprecatedGlobalSettings.cpp
r226156 r227282 40 40 #endif 41 41 42 #if PLATFORM(COCOA)43 #include <wtf/spi/darwin/dyldSPI.h>44 #endif45 46 42 namespace WebCore { 47 43 … … 83 79 #endif 84 80 bool DeprecatedGlobalSettings::gManageAudioSession = false; 85 bool DeprecatedGlobalSettings::gCustomPasteboardDataEnabled = false;86 87 bool DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled()88 {89 if (!isInWebProcess())90 return false;91 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 11030092 return IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3;93 #elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 10130094 return MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13;95 #elif PLATFORM(MAC)96 return MacApplication::isSafari();97 #else98 return false;99 #endif100 }101 81 102 82 #if PLATFORM(WIN) -
trunk/Source/WebCore/page/DeprecatedGlobalSettings.h
r223720 r227282 109 109 static bool shouldManageAudioSessionCategory() { return gManageAudioSession; } 110 110 #endif 111 112 static void setCustomPasteboardDataEnabled(bool enabled) { gCustomPasteboardDataEnabled = enabled; }113 static bool customPasteboardDataEnabled() { return gCustomPasteboardDataEnabled; }114 WEBCORE_EXPORT static bool defaultCustomPasteboardDataEnabled();115 111 116 112 #if ENABLE(MEDIA_STREAM) -
trunk/Source/WebCore/page/RuntimeEnabledFeatures.h
r227079 r227282 83 83 bool dataTransferItemsEnabled() const { return m_areDataTransferItemsEnabled; } 84 84 85 void setCustomPasteboardDataEnabled(bool isEnabled) { m_isCustomPasteboardDataEnabled = isEnabled; } 86 bool customPasteboardDataEnabled() const { return m_isCustomPasteboardDataEnabled; } 87 85 88 #if ENABLE(ATTACHMENT_ELEMENT) 86 89 void setAttachmentElementEnabled(bool areEnabled) { m_isAttachmentElementEnabled = areEnabled; } … … 263 266 bool m_isDirectoryUploadEnabled { false }; 264 267 bool m_areDataTransferItemsEnabled { false }; 268 bool m_isCustomPasteboardDataEnabled { false }; 265 269 bool m_inputEventsEnabled { true }; 266 270 -
trunk/Source/WebCore/testing/InternalSettings.cpp
r226211 r227282 120 120 , m_shouldManageAudioSessionCategory(DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) 121 121 #endif 122 , m_customPasteboardDataEnabled( DeprecatedGlobalSettings::customPasteboardDataEnabled())122 , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) 123 123 { 124 124 } … … 217 217 RuntimeEnabledFeatures::sharedFeatures().setScreenCaptureEnabled(m_setScreenCaptureEnabled); 218 218 #endif 219 RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled); 219 220 220 221 #if USE(AUDIO_SESSION) 221 222 DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory); 222 223 #endif 223 DeprecatedGlobalSettings::setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled);224 224 } 225 225 … … 880 880 ExceptionOr<void> InternalSettings::setCustomPasteboardDataEnabled(bool enabled) 881 881 { 882 DeprecatedGlobalSettings::setCustomPasteboardDataEnabled(enabled);882 RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(enabled); 883 883 return { }; 884 884 } -
trunk/Source/WebKit/ChangeLog
r227281 r227282 1 2018-01-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 Turning off custom pasteboard data doesn't actually turn it off in WK2 4 https://bugs.webkit.org/show_bug.cgi?id=181920 5 <rdar://problem/36686429> 6 7 Reviewed by Wenson Hsieh. 8 9 Moved the code to decide when to enable custom pasteboard data from WebCore 10 since we never enable this feature in WebKit1. 11 12 * Shared/WebPreferences.yaml: 13 * Shared/WebPreferencesDefaultValues.cpp: 14 (defaultCustomPasteboardDataEnabled): Added. 15 * Shared/WebPreferencesDefaultValues.h: 16 1 17 2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 18 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r227240 r227282 780 780 CustomPasteboardDataEnabled: 781 781 type: bool 782 defaultValue: WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled()782 defaultValue: defaultCustomPasteboardDataEnabled() 783 783 humanReadableName: "Custom pateboard data" 784 784 humanReadableDescription: "Enable custom clipboard types and better security model for clipboard API." 785 webcoreBinding: DeprecatedGlobalSettings785 webcoreBinding: RuntimeEnabledFeatures 786 786 787 787 WebVREnabled: -
trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp
r227240 r227282 26 26 #include "config.h" 27 27 #include "WebPreferencesDefaultValues.h" 28 #import <WebCore/RuntimeApplicationChecks.h> 29 30 #if PLATFORM(COCOA) 31 #include <wtf/spi/darwin/dyldSPI.h> 32 #endif 28 33 29 34 #if PLATFORM(IOS) … … 39 44 #endif 40 45 } 46 47 bool defaultCustomPasteboardDataEnabled() 48 { 49 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300 50 return WebCore::IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3; 51 #elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 52 return WebCore::MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13; 53 #elif PLATFORM(MAC) 54 return WebCore::MacApplication::isSafari(); 55 #else 56 return false; 57 #endif 58 } 59 -
trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h
r227240 r227282 187 187 188 188 bool defaultPassiveTouchListenersAsDefaultOnDocument(); 189 bool defaultCustomPasteboardDataEnabled(); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r227281 r227282 1 2018-01-21 Ryosuke Niwa <rniwa@webkit.org> 2 3 Turning off custom pasteboard data doesn't actually turn it off in WK2 4 https://bugs.webkit.org/show_bug.cgi?id=181920 5 <rdar://problem/36686429> 6 7 Reviewed by Wenson Hsieh. 8 9 Always disable custom pasteboard data in WebKit1. See r226156 for details. 10 11 * WebView/WebPreferences.mm: 12 (+[WebPreferences initialize]): 13 * WebView/WebView.mm: 14 (-[WebView _preferencesChanged:]): 15 1 16 2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 17 -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
r227079 r227282 623 623 [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey, 624 624 [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey, 625 [NSNumber numberWithBool: DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled()], WebKitCustomPasteboardDataEnabledPreferenceKey,625 [NSNumber numberWithBool:NO], WebKitCustomPasteboardDataEnabledPreferenceKey, 626 626 [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey, 627 627 #if ENABLE(WEBGL2) -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r227240 r227282 2995 2995 RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]); 2996 2996 RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled([preferences dataTransferItemsEnabled]); 2997 RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled([preferences customPasteboardDataEnabled]); 2997 2998 2998 2999 #if ENABLE(ATTACHMENT_ELEMENT) … … 3073 3074 [WAKView _setInterpolationQuality:[preferences _interpolationQuality]]; 3074 3075 #endif 3075 3076 DeprecatedGlobalSettings::setCustomPasteboardDataEnabled([preferences customPasteboardDataEnabled]);3077 3076 3078 3077 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
Note: See TracChangeset
for help on using the changeset viewer.