WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fixes the bug
bug-181920-20180121204952.patch (text/plain), 19.71 KB, created by
Ryosuke Niwa
on 2018-01-21 20:49:55 PST
(
hide
)
Description:
Fixes the bug
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-01-21 20:49:55 PST
Size:
19.71 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 227280) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,39 @@ >+2018-01-21 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Turning off custom pasteboard data doesn't actually turn it off in WK2 >+ https://bugs.webkit.org/show_bug.cgi?id=181920 >+ <rdar://problem/36686429> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Replaced the global settings for custom pasteboard data by regular runtime enabled flags. >+ >+ * dom/DataTransfer.cpp: >+ (WebCore::DataTransfer::getDataForItem const): >+ (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const): >+ (WebCore::DataTransfer::setDataFromItemList): >+ (WebCore::DataTransfer::types const): >+ (WebCore::DataTransfer::commitToPasteboard): >+ * dom/DataTransferItemList.cpp: >+ (WebCore::shouldExposeTypeInItemList): >+ * editing/Editor.cpp: >+ (WebCore::createDataTransferForClipboardEvent): >+ * editing/cocoa/WebContentReaderCocoa.mm: >+ (WebCore::createFragmentAndAddResources): >+ (WebCore::WebContentReader::readWebArchive): >+ * page/DeprecatedGlobalSettings.cpp: >+ (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled): Deleted. >+ * page/DeprecatedGlobalSettings.h: >+ (WebCore::DeprecatedGlobalSettings::setCustomPasteboardDataEnabled): Deleted. >+ (WebCore::DeprecatedGlobalSettings::customPasteboardDataEnabled): Deleted. >+ * page/RuntimeEnabledFeatures.h: >+ (WebCore::RuntimeEnabledFeatures::setCustomPasteboardDataEnabled): >+ (WebCore::RuntimeEnabledFeatures::customPasteboardDataEnabled const): >+ * testing/InternalSettings.cpp: >+ (WebCore::InternalSettings::Backup::Backup): >+ (WebCore::InternalSettings::Backup::restoreTo): >+ (WebCore::InternalSettings::setCustomPasteboardDataEnabled): >+ > 2018-01-19 Ryosuke Niwa <rniwa@webkit.org> > > Release assertion in canExecuteScript when executing scripts during page cache restore >Index: Source/WebCore/dom/DataTransfer.cpp >=================================================================== >--- Source/WebCore/dom/DataTransfer.cpp (revision 227280) >+++ Source/WebCore/dom/DataTransfer.cpp (working copy) >@@ -30,7 +30,6 @@ > #include "CachedImageClient.h" > #include "DataTransferItem.h" > #include "DataTransferItemList.h" >-#include "DeprecatedGlobalSettings.h" > #include "DocumentFragment.h" > #include "DragData.h" > #include "Editor.h" >@@ -41,6 +40,7 @@ > #include "HTMLParserIdioms.h" > #include "Image.h" > #include "Pasteboard.h" >+#include "RuntimeEnabledFeatures.h" > #include "Settings.h" > #include "StaticPasteboard.h" > #include "URLParser.h" >@@ -157,7 +157,7 @@ String DataTransfer::getDataForItem(Docu > return { }; > } > >- if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) >+ if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) > return m_pasteboard->readString(lowercaseType); > > // StaticPasteboard is only used to stage data written by websites before being committed to the system pasteboard. >@@ -188,7 +188,7 @@ String DataTransfer::getData(Document& d > > bool DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths() const > { >- if (!forFileDrag() && !DeprecatedGlobalSettings::customPasteboardDataEnabled()) >+ if (!forFileDrag() && !RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) > return false; > return m_pasteboard->containsFiles(); > } >@@ -212,7 +212,7 @@ void DataTransfer::setDataFromItemList(c > ASSERT(canWriteData()); > RELEASE_ASSERT(is<StaticPasteboard>(*m_pasteboard)); > >- if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > m_pasteboard->writeString(type, data); > return; > } >@@ -274,7 +274,7 @@ Vector<String> DataTransfer::types(AddFi > if (!canReadTypes()) > return { }; > >- if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > auto types = m_pasteboard->typesForLegacyUnsafeBindings(); > ASSERT(!types.contains("Files")); > if (m_pasteboard->containsFiles() && addFilesType == AddFilesType::Yes) >@@ -382,7 +382,7 @@ void DataTransfer::commitToPasteboard(Pa > { > ASSERT(is<StaticPasteboard>(*m_pasteboard) && !is<StaticPasteboard>(nativePasteboard)); > PasteboardCustomData customData = downcast<StaticPasteboard>(*m_pasteboard).takeCustomData(); >- if (DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > customData.origin = m_originIdentifier; > nativePasteboard.writeCustomData(customData); > return; >Index: Source/WebCore/dom/DataTransferItemList.cpp >=================================================================== >--- Source/WebCore/dom/DataTransferItemList.cpp (revision 227280) >+++ Source/WebCore/dom/DataTransferItemList.cpp (working copy) >@@ -27,9 +27,9 @@ > #include "DataTransferItemList.h" > > #include "DataTransferItem.h" >-#include "DeprecatedGlobalSettings.h" > #include "FileList.h" > #include "Pasteboard.h" >+#include "RuntimeEnabledFeatures.h" > #include "Settings.h" > > namespace WebCore { >@@ -56,7 +56,7 @@ RefPtr<DataTransferItem> DataTransferIte > > static bool shouldExposeTypeInItemList(const String& type) > { >- return DeprecatedGlobalSettings::customPasteboardDataEnabled() || Pasteboard::isSafeTypeForDOMToReadAndWrite(type); >+ return RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled() || Pasteboard::isSafeTypeForDOMToReadAndWrite(type); > } > > ExceptionOr<RefPtr<DataTransferItem>> DataTransferItemList::add(const String& data, const String& type) >Index: Source/WebCore/editing/Editor.cpp >=================================================================== >--- Source/WebCore/editing/Editor.cpp (revision 227280) >+++ Source/WebCore/editing/Editor.cpp (working copy) >@@ -38,7 +38,6 @@ > #include "CreateLinkCommand.h" > #include "DataTransfer.h" > #include "DeleteSelectionCommand.h" >-#include "DeprecatedGlobalSettings.h" > #include "DictationAlternative.h" > #include "DictationCommand.h" > #include "DocumentFragment.h" >@@ -83,6 +82,7 @@ > #include "RenderedPosition.h" > #include "ReplaceRangeWithTextCommand.h" > #include "ReplaceSelectionCommand.h" >+#include "RuntimeEnabledFeatures.h" > #include "Settings.h" > #include "ShadowRoot.h" > #include "SimplifyMarkupCommand.h" >@@ -360,7 +360,7 @@ static Ref<DataTransfer> createDataTrans > case ClipboardEventKind::Cut: > return DataTransfer::createForCopyAndPaste(document, DataTransfer::StoreMode::ReadWrite, std::make_unique<StaticPasteboard>()); > case ClipboardEventKind::PasteAsPlainText: >- if (DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > auto plainTextType = ASCIILiteral("text/plain"); > auto plainText = Pasteboard::createForCopyAndPaste()->readString(plainTextType); > auto pasteboard = std::make_unique<StaticPasteboard>(); >Index: Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >=================================================================== >--- Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (revision 227280) >+++ Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (working copy) >@@ -31,7 +31,6 @@ > #import "BlobURL.h" > #import "CachedResourceLoader.h" > #import "DOMURL.h" >-#import "DeprecatedGlobalSettings.h" > #import "Document.h" > #import "DocumentFragment.h" > #import "DocumentLoader.h" >@@ -326,7 +325,7 @@ RefPtr<DocumentFragment> createFragmentA > if (!fragmentAndResources.fragment) > return nullptr; > >- if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > if (DocumentLoader* loader = frame.loader().documentLoader()) { > for (auto& resource : fragmentAndResources.resources) > loader->addArchiveResource(resource.copyRef()); >@@ -457,7 +456,7 @@ bool WebContentReader::readWebArchive(Sh > if (!result) > return false; > >- if (!DeprecatedGlobalSettings::customPasteboardDataEnabled()) { >+ if (!RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) { > fragment = createFragmentFromMarkup(*frame.document(), result->markup, result->mainResource->url(), DisallowScriptingAndPluginContent); > if (DocumentLoader* loader = frame.loader().documentLoader()) > loader->addAllArchiveResources(result->archive.get()); >Index: Source/WebCore/page/DeprecatedGlobalSettings.cpp >=================================================================== >--- Source/WebCore/page/DeprecatedGlobalSettings.cpp (revision 227280) >+++ Source/WebCore/page/DeprecatedGlobalSettings.cpp (working copy) >@@ -39,10 +39,6 @@ > #endif > #endif > >-#if PLATFORM(COCOA) >-#include <wtf/spi/darwin/dyldSPI.h> >-#endif >- > namespace WebCore { > > #if USE(AVFOUNDATION) >@@ -82,22 +78,6 @@ bool DeprecatedGlobalSettings::gAVKitEna > bool DeprecatedGlobalSettings::gShouldOptOutOfNetworkStateObservation = false; > #endif > bool DeprecatedGlobalSettings::gManageAudioSession = false; >-bool DeprecatedGlobalSettings::gCustomPasteboardDataEnabled = false; >- >-bool DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled() >-{ >- if (!isInWebProcess()) >- return false; >-#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300 >- return IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3; >-#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 >- return MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13; >-#elif PLATFORM(MAC) >- return MacApplication::isSafari(); >-#else >- return false; >-#endif >-} > > #if PLATFORM(WIN) > void DeprecatedGlobalSettings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers) >Index: Source/WebCore/page/DeprecatedGlobalSettings.h >=================================================================== >--- Source/WebCore/page/DeprecatedGlobalSettings.h (revision 227280) >+++ Source/WebCore/page/DeprecatedGlobalSettings.h (working copy) >@@ -108,10 +108,6 @@ public: > static void setShouldManageAudioSessionCategory(bool flag) { gManageAudioSession = flag; } > static bool shouldManageAudioSessionCategory() { return gManageAudioSession; } > #endif >- >- static void setCustomPasteboardDataEnabled(bool enabled) { gCustomPasteboardDataEnabled = enabled; } >- static bool customPasteboardDataEnabled() { return gCustomPasteboardDataEnabled; } >- WEBCORE_EXPORT static bool defaultCustomPasteboardDataEnabled(); > > #if ENABLE(MEDIA_STREAM) > static bool mockCaptureDevicesEnabled(); >Index: Source/WebCore/page/RuntimeEnabledFeatures.h >=================================================================== >--- Source/WebCore/page/RuntimeEnabledFeatures.h (revision 227280) >+++ Source/WebCore/page/RuntimeEnabledFeatures.h (working copy) >@@ -82,6 +82,9 @@ public: > void setDataTransferItemsEnabled(bool areEnabled) { m_areDataTransferItemsEnabled = areEnabled; } > bool dataTransferItemsEnabled() const { return m_areDataTransferItemsEnabled; } > >+ void setCustomPasteboardDataEnabled(bool isEnabled) { m_isCustomPasteboardDataEnabled = isEnabled; } >+ bool customPasteboardDataEnabled() const { return m_isCustomPasteboardDataEnabled; } >+ > #if ENABLE(ATTACHMENT_ELEMENT) > void setAttachmentElementEnabled(bool areEnabled) { m_isAttachmentElementEnabled = areEnabled; } > bool attachmentElementEnabled() const { return m_isAttachmentElementEnabled; } >@@ -262,6 +265,7 @@ private: > bool m_isMenuItemElementEnabled { false }; > bool m_isDirectoryUploadEnabled { false }; > bool m_areDataTransferItemsEnabled { false }; >+ bool m_isCustomPasteboardDataEnabled { false }; > bool m_inputEventsEnabled { true }; > > #if ENABLE(ATTACHMENT_ELEMENT) >Index: Source/WebCore/testing/InternalSettings.cpp >=================================================================== >--- Source/WebCore/testing/InternalSettings.cpp (revision 227280) >+++ Source/WebCore/testing/InternalSettings.cpp (working copy) >@@ -119,7 +119,7 @@ InternalSettings::Backup::Backup(Setting > #if USE(AUDIO_SESSION) > , m_shouldManageAudioSessionCategory(DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) > #endif >- , m_customPasteboardDataEnabled(DeprecatedGlobalSettings::customPasteboardDataEnabled()) >+ , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled()) > { > } > >@@ -216,11 +216,11 @@ void InternalSettings::Backup::restoreTo > #if ENABLE(MEDIA_STREAM) > RuntimeEnabledFeatures::sharedFeatures().setScreenCaptureEnabled(m_setScreenCaptureEnabled); > #endif >+ RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled); > > #if USE(AUDIO_SESSION) > DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory); > #endif >- DeprecatedGlobalSettings::setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled); > } > > class InternalSettingsWrapper : public Supplement<Page> { >@@ -879,7 +879,7 @@ ExceptionOr<void> InternalSettings::setS > > ExceptionOr<void> InternalSettings::setCustomPasteboardDataEnabled(bool enabled) > { >- DeprecatedGlobalSettings::setCustomPasteboardDataEnabled(enabled); >+ RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(enabled); > return { }; > } > >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 227281) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2018-01-21 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Turning off custom pasteboard data doesn't actually turn it off in WK2 >+ https://bugs.webkit.org/show_bug.cgi?id=181920 >+ <rdar://problem/36686429> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Moved the code to decide when to enable custom pasteboard data from WebCore >+ since we never enable this feature in WebKit1. >+ >+ * Shared/WebPreferences.yaml: >+ * Shared/WebPreferencesDefaultValues.cpp: >+ (defaultCustomPasteboardDataEnabled): Added. >+ * Shared/WebPreferencesDefaultValues.h: >+ > 2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com> > > Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h >Index: Source/WebKit/Shared/WebPreferences.yaml >=================================================================== >--- Source/WebKit/Shared/WebPreferences.yaml (revision 227280) >+++ Source/WebKit/Shared/WebPreferences.yaml (working copy) >@@ -779,10 +779,10 @@ DataTransferItemsEnabled: > > CustomPasteboardDataEnabled: > type: bool >- defaultValue: WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled() >+ defaultValue: defaultCustomPasteboardDataEnabled() > humanReadableName: "Custom pateboard data" > humanReadableDescription: "Enable custom clipboard types and better security model for clipboard API." >- webcoreBinding: DeprecatedGlobalSettings >+ webcoreBinding: RuntimeEnabledFeatures > > WebVREnabled: > type: bool >Index: Source/WebKit/Shared/WebPreferencesDefaultValues.cpp >=================================================================== >--- Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (revision 227280) >+++ Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (working copy) >@@ -25,6 +25,11 @@ > > #include "config.h" > #include "WebPreferencesDefaultValues.h" >+#import <WebCore/RuntimeApplicationChecks.h> >+ >+#if PLATFORM(COCOA) >+#include <wtf/spi/darwin/dyldSPI.h> >+#endif > > #if PLATFORM(IOS) > #include "VersionChecks.h" >@@ -38,3 +43,17 @@ bool defaultPassiveTouchListenersAsDefau > return true; > #endif > } >+ >+bool defaultCustomPasteboardDataEnabled() >+{ >+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110300 >+ return WebCore::IOSApplication::isMobileSafari() || dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_11_3; >+#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 >+ return WebCore::MacApplication::isSafari() || dyld_get_program_sdk_version() > DYLD_MACOSX_VERSION_10_13; >+#elif PLATFORM(MAC) >+ return WebCore::MacApplication::isSafari(); >+#else >+ return false; >+#endif >+} >+ >Index: Source/WebKit/Shared/WebPreferencesDefaultValues.h >=================================================================== >--- Source/WebKit/Shared/WebPreferencesDefaultValues.h (revision 227280) >+++ Source/WebKit/Shared/WebPreferencesDefaultValues.h (working copy) >@@ -186,3 +186,4 @@ > #endif > > bool defaultPassiveTouchListenersAsDefaultOnDocument(); >+bool defaultCustomPasteboardDataEnabled(); >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 227280) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-01-21 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Turning off custom pasteboard data doesn't actually turn it off in WK2 >+ https://bugs.webkit.org/show_bug.cgi?id=181920 >+ <rdar://problem/36686429> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Always disable custom pasteboard data in WebKit1. See r226156 for details. >+ >+ * WebView/WebPreferences.mm: >+ (+[WebPreferences initialize]): >+ * WebView/WebView.mm: >+ (-[WebView _preferencesChanged:]): >+ > 2018-01-20 Andy Estes <aestes@apple.com> > > [Apple Pay] Stop eagerly loading PassKit.framework >Index: Source/WebKitLegacy/mac/WebView/WebPreferences.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebPreferences.mm (revision 227280) >+++ Source/WebKitLegacy/mac/WebView/WebPreferences.mm (working copy) >@@ -622,7 +622,7 @@ + (void)initialize > [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey, >- [NSNumber numberWithBool:DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled()], WebKitCustomPasteboardDataEnabledPreferenceKey, >+ [NSNumber numberWithBool:NO], WebKitCustomPasteboardDataEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey, > #if ENABLE(WEBGL2) > [NSNumber numberWithBool:NO], WebKitWebGL2EnabledPreferenceKey, >Index: Source/WebKitLegacy/mac/WebView/WebView.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebView.mm (revision 227280) >+++ Source/WebKitLegacy/mac/WebView/WebView.mm (working copy) >@@ -2994,6 +2994,7 @@ - (void)_preferencesChanged:(WebPreferen > RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled([preferences shadowDOMEnabled]); > RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]); > RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled([preferences dataTransferItemsEnabled]); >+ RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled([preferences customPasteboardDataEnabled]); > > #if ENABLE(ATTACHMENT_ELEMENT) > RuntimeEnabledFeatures::sharedFeatures().setAttachmentElementEnabled([preferences attachmentElementEnabled]); >@@ -3073,8 +3074,6 @@ - (void)_preferencesChanged:(WebPreferen > [WAKView _setInterpolationQuality:[preferences _interpolationQuality]]; > #endif > >- DeprecatedGlobalSettings::setCustomPasteboardDataEnabled([preferences customPasteboardDataEnabled]); >- > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) > settings.setMediaKeysStorageDirectory([preferences mediaKeysStorageDirectory]); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
wenson_hsieh
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 181920
: 331893