Make Legacy EME API controlled by RuntimeEnabled setting.
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / Cocoa / WKWebViewConfiguration.mm
index 8fc5591..fbf4a66 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #if WK_API_ENABLED
 
 #import "APIPageConfiguration.h"
+#import "VersionChecks.h"
 #import "WKPreferences.h"
 #import "WKProcessPool.h"
 #import "WKUserContentController.h"
+#import "WKWebView.h"
 #import "WKWebViewContentProviderRegistry.h"
 #import "WeakObjCPtr.h"
-#import "_WKVisitedLinkProvider.h"
+#import "WebKit2Initialize.h"
+#import "_WKVisitedLinkStore.h"
 #import "_WKWebsiteDataStoreInternal.h"
+#import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/Settings.h>
+#import <WebCore/URLParser.h>
 #import <wtf/RetainPtr.h>
 
 #if PLATFORM(IOS)
 #import "UIKitSPI.h"
+#import <WebCore/Device.h>
 #endif
 
+using namespace WebCore;
+
 template<typename T> class LazyInitialized {
 public:
     typedef typename WTF::GetPtrHelper<T>::PtrType PtrType;
@@ -65,7 +74,7 @@ public:
 
     void set(T&& t)
     {
-        m_value = WTF::move(t);
+        m_value = WTFMove(t);
         m_isInitialized = true;
     }
 
@@ -79,38 +88,139 @@ private:
     T m_value;
 };
 
+#if PLATFORM(IOS)
+
+static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
+{
+    if (value == _WKDragLiftDelayMedium)
+        return _WKDragLiftDelayMedium;
+    if (value == _WKDragLiftDelayLong)
+        return _WKDragLiftDelayLong;
+    return _WKDragLiftDelayShort;
+}
+
+#endif
+
 @implementation WKWebViewConfiguration {
     LazyInitialized<RetainPtr<WKProcessPool>> _processPool;
     LazyInitialized<RetainPtr<WKPreferences>> _preferences;
     LazyInitialized<RetainPtr<WKUserContentController>> _userContentController;
-    LazyInitialized<RetainPtr<_WKVisitedLinkProvider>> _visitedLinkProvider;
+    LazyInitialized<RetainPtr<_WKVisitedLinkStore>> _visitedLinkStore;
     LazyInitialized<RetainPtr<WKWebsiteDataStore>> _websiteDataStore;
     WebKit::WeakObjCPtr<WKWebView> _relatedWebView;
     WebKit::WeakObjCPtr<WKWebView> _alternateWebViewForNavigationGestures;
-    BOOL _treatsSHA1SignedCertificatesAsInsecure;
     RetainPtr<NSString> _groupIdentifier;
     LazyInitialized<RetainPtr<NSString>> _applicationNameForUserAgent;
+    LazyInitialized<RetainPtr<NSMutableDictionary<NSString *, id <WKURLSchemeHandler>>>> _urlSchemeHandlers;
+    NSTimeInterval _incrementalRenderingSuppressionTimeout;
+    BOOL _treatsSHA1SignedCertificatesAsInsecure;
+    BOOL _respectsImageOrientation;
+    BOOL _printsBackgrounds;
+    BOOL _allowsJavaScriptMarkup;
+    BOOL _convertsPositionStyleOnCopy;
+    BOOL _allowsMetaRefresh;
+    BOOL _allowUniversalAccessFromFileURLs;
 
 #if PLATFORM(IOS)
     LazyInitialized<RetainPtr<WKWebViewContentProviderRegistry>> _contentProviderRegistry;
     BOOL _alwaysRunsAtForegroundPriority;
+    BOOL _allowsInlineMediaPlayback;
+    BOOL _inlineMediaPlaybackRequiresPlaysInlineAttribute;
+    BOOL _allowsInlineMediaPlaybackAfterFullscreen;
+    BOOL _allowsBlockSelection;
+    _WKDragLiftDelay _dragLiftDelay;
+#endif
+
+    BOOL _invisibleAutoplayNotPermitted;
+    BOOL _mediaDataLoadsAutomatically;
+    BOOL _attachmentElementEnabled;
+    BOOL _mainContentUserGestureOverrideEnabled;
+
+#if PLATFORM(MAC)
+    BOOL _showsURLsInToolTips;
+    BOOL _serviceControlsEnabled;
+    BOOL _imageControlsEnabled;
+    BOOL _requiresUserActionForEditingControlsManager;
 #endif
+    BOOL _initialCapitalizationEnabled;
+    BOOL _waitsForPaintAfterViewDidMoveToWindow;
+    BOOL _controlledByAutomation;
+
+#if ENABLE(APPLE_PAY)
+    BOOL _applePayEnabled;
+#endif
+    BOOL _needsStorageAccessFromFileURLsQuirk;
+    BOOL _legacyEncryptedMediaAPIEnabled;
+
+    RetainPtr<NSString> _overrideContentSecurityPolicy;
+    RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport;
 }
 
 - (instancetype)init
 {
     if (!(self = [super init]))
         return nil;
-    
+
+    WebKit::InitializeWebKit2();
+
 #if PLATFORM(IOS)
-    _requiresUserActionForMediaPlayback = YES;
     _allowsPictureInPictureMediaPlayback = YES;
+    _allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
+    _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
+    _allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback;
+    _mediaDataLoadsAutomatically = NO;
+    if (WebKit::linkedOnOrAfter(WebKit::SDKVersion::FirstWithMediaTypesRequiringUserActionForPlayback))
+        _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio;
+    else
+        _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
+    _ignoresViewportScaleLimits = NO;
+    _legacyEncryptedMediaAPIEnabled = NO;
+#else
+    _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
+    _mediaDataLoadsAutomatically = YES;
+    _userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
+    _legacyEncryptedMediaAPIEnabled = YES;
+#endif
+    _mainContentUserGestureOverrideEnabled = NO;
+    _invisibleAutoplayNotPermitted = NO;
+    _attachmentElementEnabled = NO;
+
+#if PLATFORM(IOS)
+    _respectsImageOrientation = YES;
+    _printsBackgrounds = YES;
+#endif
+
+#if PLATFORM(MAC)
+    _printsBackgrounds = NO;
+    _respectsImageOrientation = NO;
+    _showsURLsInToolTips = NO;
+    _serviceControlsEnabled = NO;
+    _imageControlsEnabled = NO;
+    _requiresUserActionForEditingControlsManager = NO;
 #endif
+    _initialCapitalizationEnabled = YES;
+    _waitsForPaintAfterViewDidMoveToWindow = YES;
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     _allowsAirPlayForMediaPlayback = YES;
 #endif
 
+    _incrementalRenderingSuppressionTimeout = 5;
+    _allowsJavaScriptMarkup = YES;
+    _convertsPositionStyleOnCopy = NO;
+    _allowsMetaRefresh = YES;
+    _allowUniversalAccessFromFileURLs = NO;
+    _treatsSHA1SignedCertificatesAsInsecure = YES;
+    _needsStorageAccessFromFileURLsQuirk = YES;
+
+#if PLATFORM(IOS)
+    _selectionGranularity = WKSelectionGranularityDynamic;
+    _allowsBlockSelection = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDebugAllowBlockSelection"];
+    _dragLiftDelay = toDragLiftDelay([[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitDebugDragLiftDelay"]);
+#endif
+
+    _mediaContentTypesRequiringHardwareSupport = Settings::defaultMediaContentTypesRequiringHardwareSupport();
+
     return self;
 }
 
@@ -119,6 +229,65 @@ private:
     return [NSString stringWithFormat:@"<%@: %p; processPool = %@; preferences = %@>", NSStringFromClass(self.class), self, self.processPool, self.preferences];
 }
 
+// FIXME: Encode the process pool, user content controller and website data store.
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+    [coder encodeObject:self.processPool forKey:@"processPool"];
+    [coder encodeObject:self.preferences forKey:@"preferences"];
+    [coder encodeObject:self.userContentController forKey:@"userContentController"];
+    [coder encodeObject:self.websiteDataStore forKey:@"websiteDataStore"];
+
+    [coder encodeBool:self.suppressesIncrementalRendering forKey:@"suppressesIncrementalRendering"];
+    [coder encodeObject:self.applicationNameForUserAgent forKey:@"applicationNameForUserAgent"];
+    [coder encodeBool:self.allowsAirPlayForMediaPlayback forKey:@"allowsAirPlayForMediaPlayback"];
+
+#if PLATFORM(IOS)
+    [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
+    [coder encodeBool:self.allowsInlineMediaPlayback forKey:@"allowsInlineMediaPlayback"];
+    [coder encodeBool:self._allowsInlineMediaPlaybackAfterFullscreen forKey:@"allowsInlineMediaPlaybackAfterFullscreen"];
+    [coder encodeBool:self.mediaTypesRequiringUserActionForPlayback forKey:@"mediaTypesRequiringUserActionForPlayback"];
+    [coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
+    [coder encodeBool:self.allowsPictureInPictureMediaPlayback forKey:@"allowsPictureInPictureMediaPlayback"];
+    [coder encodeBool:self.ignoresViewportScaleLimits forKey:@"ignoresViewportScaleLimits"];
+    [coder encodeInteger:self._dragLiftDelay forKey:@"dragLiftDelay"];
+#else
+    [coder encodeInteger:self.userInterfaceDirectionPolicy forKey:@"userInterfaceDirectionPolicy"];
+#endif
+}
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+    if (!(self = [self init]))
+        return nil;
+
+    self.processPool = [coder decodeObjectForKey:@"processPool"];
+    self.preferences = [coder decodeObjectForKey:@"preferences"];
+    self.userContentController = [coder decodeObjectForKey:@"userContentController"];
+    self.websiteDataStore = [coder decodeObjectForKey:@"websiteDataStore"];
+
+    self.suppressesIncrementalRendering = [coder decodeBoolForKey:@"suppressesIncrementalRendering"];
+    self.applicationNameForUserAgent = [coder decodeObjectForKey:@"applicationNameForUserAgent"];
+    self.allowsAirPlayForMediaPlayback = [coder decodeBoolForKey:@"allowsAirPlayForMediaPlayback"];
+
+#if PLATFORM(IOS)
+    self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
+    self.allowsInlineMediaPlayback = [coder decodeBoolForKey:@"allowsInlineMediaPlayback"];
+    self._allowsInlineMediaPlaybackAfterFullscreen = [coder decodeBoolForKey:@"allowsInlineMediaPlaybackAfterFullscreen"];
+    self.mediaTypesRequiringUserActionForPlayback = [coder decodeBoolForKey:@"mediaTypesRequiringUserActionForPlayback"];
+    self.selectionGranularity = static_cast<WKSelectionGranularity>([coder decodeIntegerForKey:@"selectionGranularity"]);
+    self.allowsPictureInPictureMediaPlayback = [coder decodeBoolForKey:@"allowsPictureInPictureMediaPlayback"];
+    self.ignoresViewportScaleLimits = [coder decodeBoolForKey:@"ignoresViewportScaleLimits"];
+    self._dragLiftDelay = toDragLiftDelay([coder decodeIntegerForKey:@"dragLiftDelay"]);
+#else
+    auto userInterfaceDirectionPolicyCandidate = static_cast<WKUserInterfaceDirectionPolicy>([coder decodeIntegerForKey:@"userInterfaceDirectionPolicy"]);
+    if (userInterfaceDirectionPolicyCandidate == WKUserInterfaceDirectionPolicyContent || userInterfaceDirectionPolicyCandidate == WKUserInterfaceDirectionPolicySystem)
+        self.userInterfaceDirectionPolicy = userInterfaceDirectionPolicyCandidate;
+#endif
+
+    return self;
+}
+
 - (id)copyWithZone:(NSZone *)zone
 {
     WKWebViewConfiguration *configuration = [(WKWebViewConfiguration *)[[self class] allocWithZone:zone] init];
@@ -127,7 +296,7 @@ private:
     configuration.preferences = self.preferences;
     configuration.userContentController = self.userContentController;
     configuration.websiteDataStore = self.websiteDataStore;
-    configuration._visitedLinkProvider = self._visitedLinkProvider;
+    configuration._visitedLinkStore = self._visitedLinkStore;
     configuration._relatedWebView = _relatedWebView.get().get();
     configuration._alternateWebViewForNavigationGestures = _alternateWebViewForNavigationGestures.get().get();
     configuration->_treatsSHA1SignedCertificatesAsInsecure = _treatsSHA1SignedCertificatesAsInsecure;
@@ -138,16 +307,56 @@ private:
     configuration->_suppressesIncrementalRendering = self->_suppressesIncrementalRendering;
     configuration.applicationNameForUserAgent = self.applicationNameForUserAgent;
 
+    configuration->_respectsImageOrientation = self->_respectsImageOrientation;
+    configuration->_printsBackgrounds = self->_printsBackgrounds;
+    configuration->_incrementalRenderingSuppressionTimeout = self->_incrementalRenderingSuppressionTimeout;
+    configuration->_allowsJavaScriptMarkup = self->_allowsJavaScriptMarkup;
+    configuration->_convertsPositionStyleOnCopy = self->_convertsPositionStyleOnCopy;
+    configuration->_allowsMetaRefresh = self->_allowsMetaRefresh;
+    configuration->_allowUniversalAccessFromFileURLs = self->_allowUniversalAccessFromFileURLs;
+
+    configuration->_invisibleAutoplayNotPermitted = self->_invisibleAutoplayNotPermitted;
+    configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
+    configuration->_attachmentElementEnabled = self->_attachmentElementEnabled;
+    configuration->_mediaTypesRequiringUserActionForPlayback = self->_mediaTypesRequiringUserActionForPlayback;
+    configuration->_mainContentUserGestureOverrideEnabled = self->_mainContentUserGestureOverrideEnabled;
+    configuration->_initialCapitalizationEnabled = self->_initialCapitalizationEnabled;
+    configuration->_waitsForPaintAfterViewDidMoveToWindow = self->_waitsForPaintAfterViewDidMoveToWindow;
+    configuration->_controlledByAutomation = self->_controlledByAutomation;
+
 #if PLATFORM(IOS)
     configuration->_allowsInlineMediaPlayback = self->_allowsInlineMediaPlayback;
+    configuration->_allowsInlineMediaPlaybackAfterFullscreen = self->_allowsInlineMediaPlaybackAfterFullscreen;
+    configuration->_inlineMediaPlaybackRequiresPlaysInlineAttribute = self->_inlineMediaPlaybackRequiresPlaysInlineAttribute;
     configuration->_allowsPictureInPictureMediaPlayback = self->_allowsPictureInPictureMediaPlayback;
     configuration->_alwaysRunsAtForegroundPriority = _alwaysRunsAtForegroundPriority;
-    configuration->_requiresUserActionForMediaPlayback = self->_requiresUserActionForMediaPlayback;
     configuration->_selectionGranularity = self->_selectionGranularity;
+    configuration->_allowsBlockSelection = self->_allowsBlockSelection;
+    configuration->_ignoresViewportScaleLimits = self->_ignoresViewportScaleLimits;
+    configuration->_dragLiftDelay = self->_dragLiftDelay;
+#endif
+#if PLATFORM(MAC)
+    configuration->_userInterfaceDirectionPolicy = self->_userInterfaceDirectionPolicy;
+    configuration->_showsURLsInToolTips = self->_showsURLsInToolTips;
+    configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
+    configuration->_imageControlsEnabled = self->_imageControlsEnabled;
+    configuration->_requiresUserActionForEditingControlsManager = self->_requiresUserActionForEditingControlsManager;
+#endif
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
+    configuration->_dataDetectorTypes = self->_dataDetectorTypes;
 #endif
 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
     configuration->_allowsAirPlayForMediaPlayback = self->_allowsAirPlayForMediaPlayback;
 #endif
+#if ENABLE(APPLE_PAY)
+    configuration->_applePayEnabled = self->_applePayEnabled;
+#endif
+    configuration->_needsStorageAccessFromFileURLsQuirk = self->_needsStorageAccessFromFileURLsQuirk;
+    configuration->_overrideContentSecurityPolicy = adoptNS([self->_overrideContentSecurityPolicy copyWithZone:zone]);
+
+    configuration->_urlSchemeHandlers.set(adoptNS([self._urlSchemeHandlers mutableCopyWithZone:zone]));
+    configuration->_mediaContentTypesRequiringHardwareSupport = adoptNS([self._mediaContentTypesRequiringHardwareSupport copyWithZone:zone]);
+    configuration->_legacyEncryptedMediaAPIEnabled = self->_legacyEncryptedMediaAPIEnabled;
 
     return configuration;
 }
@@ -211,14 +420,41 @@ static NSString *defaultApplicationNameForUserAgent()
     _applicationNameForUserAgent.set(adoptNS([applicationNameForUserAgent copy]));
 }
 
-- (_WKVisitedLinkProvider *)_visitedLinkProvider
+- (_WKVisitedLinkStore *)_visitedLinkStore
+{
+    return _visitedLinkStore.get([] { return adoptNS([[_WKVisitedLinkStore alloc] init]); });
+}
+
+- (void)_setVisitedLinkStore:(_WKVisitedLinkStore *)visitedLinkStore
 {
-    return _visitedLinkProvider.get([] { return adoptNS([[_WKVisitedLinkProvider alloc] init]); });
+    _visitedLinkStore.set(visitedLinkStore);
 }
 
-- (void)_setVisitedLinkProvider:(_WKVisitedLinkProvider *)visitedLinkProvider
+- (void)setURLSchemeHandler:(id <WKURLSchemeHandler>)urlSchemeHandler forURLScheme:(NSString *)urlScheme
 {
-    _visitedLinkProvider.set(visitedLinkProvider);
+    auto *urlSchemeHandlers = _urlSchemeHandlers.get([] { return adoptNS([[NSMutableDictionary alloc] init]); });
+
+    if ([WKWebView handlesURLScheme:urlScheme])
+        [NSException raise:NSInvalidArgumentException format:@"'%@' is a URL scheme that WKWebView handles natively", urlScheme];
+
+    auto canonicalScheme = WebCore::URLParser::maybeCanonicalizeScheme(urlScheme);
+    if (!canonicalScheme)
+        [NSException raise:NSInvalidArgumentException format:@"'%@' is not a valid URL scheme", urlScheme];
+
+    if ([urlSchemeHandlers objectForKey:(NSString *)canonicalScheme.value()])
+        [NSException raise:NSInvalidArgumentException format:@"URL scheme '%@' already has a registered URL scheme handler", urlScheme];
+
+    [urlSchemeHandlers setObject:urlSchemeHandler forKey:(NSString *)canonicalScheme.value()];
+}
+
+- (nullable id <WKURLSchemeHandler>)urlSchemeHandlerForURLScheme:(NSString *)urlScheme
+{
+    auto canonicalScheme = WebCore::URLParser::maybeCanonicalizeScheme(urlScheme);
+    if (!canonicalScheme)
+        return nil;
+
+    auto *urlSchemeHandlers = _urlSchemeHandlers.get([] { return adoptNS([[NSMutableDictionary alloc] init]); });
+    return [urlSchemeHandlers objectForKey:(NSString *)canonicalScheme.value()];
 }
 
 #pragma clang diagnostic push
@@ -236,6 +472,11 @@ static NSString *defaultApplicationNameForUserAgent()
 
 #pragma clang diagnostic pop
 
+- (NSMutableDictionary<NSString *, id <WKURLSchemeHandler>> *)_urlSchemeHandlers
+{
+    return _urlSchemeHandlers.get([] { return adoptNS([[NSMutableDictionary alloc] init]); });
+}
+
 #if PLATFORM(IOS)
 - (WKWebViewContentProviderRegistry *)_contentProviderRegistry
 {
@@ -262,8 +503,8 @@ static NSString *defaultApplicationNameForUserAgent()
     if (!self.websiteDataStore)
         [NSException raise:NSInvalidArgumentException format:@"configuration.websiteDataStore is nil"];
 
-    if (!self._visitedLinkProvider)
-        [NSException raise:NSInvalidArgumentException format:@"configuration._visitedLinkProvider is nil"];
+    if (!self._visitedLinkStore)
+        [NSException raise:NSInvalidArgumentException format:@"configuration._visitedLinkStore is nil"];
 
 #if PLATFORM(IOS)
     if (!self._contentProviderRegistry)
@@ -315,6 +556,76 @@ static NSString *defaultApplicationNameForUserAgent()
     _treatsSHA1SignedCertificatesAsInsecure = insecure;
 }
 
+- (BOOL)_respectsImageOrientation
+{
+    return _respectsImageOrientation;
+}
+
+- (void)_setRespectsImageOrientation:(BOOL)respectsImageOrientation
+{
+    _respectsImageOrientation = respectsImageOrientation;
+}
+
+- (BOOL)_printsBackgrounds
+{
+    return _printsBackgrounds;
+}
+
+- (void)_setPrintsBackgrounds:(BOOL)printsBackgrounds
+{
+    _printsBackgrounds = printsBackgrounds;
+}
+
+- (NSTimeInterval)_incrementalRenderingSuppressionTimeout
+{
+    return _incrementalRenderingSuppressionTimeout;
+}
+
+- (void)_setIncrementalRenderingSuppressionTimeout:(NSTimeInterval)incrementalRenderingSuppressionTimeout
+{
+    _incrementalRenderingSuppressionTimeout = incrementalRenderingSuppressionTimeout;
+}
+
+- (BOOL)_allowsJavaScriptMarkup
+{
+    return _allowsJavaScriptMarkup;
+}
+
+- (void)_setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
+{
+    _allowsJavaScriptMarkup = allowsJavaScriptMarkup;
+}
+
+- (BOOL)_allowUniversalAccessFromFileURLs
+{
+    return _allowUniversalAccessFromFileURLs;
+}
+
+- (void)_setAllowUniversalAccessFromFileURLs:(BOOL)allowUniversalAccessFromFileURLs
+{
+    _allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
+}
+
+- (BOOL)_convertsPositionStyleOnCopy
+{
+    return _convertsPositionStyleOnCopy;
+}
+
+- (void)_setConvertsPositionStyleOnCopy:(BOOL)convertsPositionStyleOnCopy
+{
+    _convertsPositionStyleOnCopy = convertsPositionStyleOnCopy;
+}
+
+- (BOOL)_allowsMetaRefresh
+{
+    return _allowsMetaRefresh;
+}
+
+- (void)_setAllowsMetaRefresh:(BOOL)allowsMetaRefresh
+{
+    _allowsMetaRefresh = allowsMetaRefresh;
+}
+
 #if PLATFORM(IOS)
 - (BOOL)_alwaysRunsAtForegroundPriority
 {
@@ -325,7 +636,242 @@ static NSString *defaultApplicationNameForUserAgent()
 {
     _alwaysRunsAtForegroundPriority = alwaysRunsAtForegroundPriority;
 }
+
+- (BOOL)_inlineMediaPlaybackRequiresPlaysInlineAttribute
+{
+    return _inlineMediaPlaybackRequiresPlaysInlineAttribute;
+}
+
+- (void)_setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)requires
+{
+    _inlineMediaPlaybackRequiresPlaysInlineAttribute = requires;
+}
+
+- (BOOL)_allowsInlineMediaPlaybackAfterFullscreen
+{
+    return _allowsInlineMediaPlaybackAfterFullscreen;
+}
+
+- (void)_setAllowsInlineMediaPlaybackAfterFullscreen:(BOOL)allows
+{
+    _allowsInlineMediaPlaybackAfterFullscreen = allows;
+}
+
+- (BOOL)_allowsBlockSelection
+{
+    return _allowsBlockSelection;
+}
+
+- (void)_setAllowsBlockSelection:(BOOL)allowsBlockSelection
+{
+    _allowsBlockSelection = allowsBlockSelection;
+}
+
+- (_WKDragLiftDelay)_dragLiftDelay
+{
+    return _dragLiftDelay;
+}
+
+- (void)_setDragLiftDelay:(_WKDragLiftDelay)dragLiftDelay
+{
+    _dragLiftDelay = dragLiftDelay;
+}
+#endif // PLATFORM(IOS)
+
+- (BOOL)_invisibleAutoplayNotPermitted
+{
+    return _invisibleAutoplayNotPermitted;
+}
+
+- (void)_setInvisibleAutoplayNotPermitted:(BOOL)notPermitted
+{
+    _invisibleAutoplayNotPermitted = notPermitted;
+}
+
+- (BOOL)_mediaDataLoadsAutomatically
+{
+    return _mediaDataLoadsAutomatically;
+}
+
+- (void)_setMediaDataLoadsAutomatically:(BOOL)mediaDataLoadsAutomatically
+{
+    _mediaDataLoadsAutomatically = mediaDataLoadsAutomatically;
+}
+
+- (BOOL)_attachmentElementEnabled
+{
+    return _attachmentElementEnabled;
+}
+
+- (void)_setAttachmentElementEnabled:(BOOL)attachmentElementEnabled
+{
+    _attachmentElementEnabled = attachmentElementEnabled;
+}
+
+- (BOOL)_requiresUserActionForVideoPlayback
+{
+    return self.mediaTypesRequiringUserActionForPlayback & WKAudiovisualMediaTypeVideo;
+}
+
+- (void)_setRequiresUserActionForVideoPlayback:(BOOL)requiresUserActionForVideoPlayback
+{
+    if (requiresUserActionForVideoPlayback)
+        self.mediaTypesRequiringUserActionForPlayback |= WKAudiovisualMediaTypeVideo;
+    else
+        self.mediaTypesRequiringUserActionForPlayback &= ~WKAudiovisualMediaTypeVideo;
+}
+
+- (BOOL)_requiresUserActionForAudioPlayback
+{
+    return self.mediaTypesRequiringUserActionForPlayback & WKAudiovisualMediaTypeAudio;
+}
+
+- (void)_setRequiresUserActionForAudioPlayback:(BOOL)requiresUserActionForAudioPlayback
+{
+    if (requiresUserActionForAudioPlayback)
+        self.mediaTypesRequiringUserActionForPlayback |= WKAudiovisualMediaTypeAudio;
+    else
+        self.mediaTypesRequiringUserActionForPlayback &= ~WKAudiovisualMediaTypeAudio;
+}
+
+- (BOOL)_mainContentUserGestureOverrideEnabled
+{
+    return _mainContentUserGestureOverrideEnabled;
+}
+
+- (void)_setMainContentUserGestureOverrideEnabled:(BOOL)mainContentUserGestureOverrideEnabled
+{
+    _mainContentUserGestureOverrideEnabled = mainContentUserGestureOverrideEnabled;
+}
+
+- (BOOL)_initialCapitalizationEnabled
+{
+    return _initialCapitalizationEnabled;
+}
+
+- (void)_setInitialCapitalizationEnabled:(BOOL)initialCapitalizationEnabled
+{
+    _initialCapitalizationEnabled = initialCapitalizationEnabled;
+}
+
+- (BOOL)_waitsForPaintAfterViewDidMoveToWindow
+{
+    return _waitsForPaintAfterViewDidMoveToWindow;
+}
+
+- (void)_setWaitsForPaintAfterViewDidMoveToWindow:(BOOL)shouldSynchronize
+{
+    _waitsForPaintAfterViewDidMoveToWindow = shouldSynchronize;
+}
+
+- (BOOL)_isControlledByAutomation
+{
+    return _controlledByAutomation;
+}
+
+- (void)_setControlledByAutomation:(BOOL)controlledByAutomation
+{
+    _controlledByAutomation = controlledByAutomation;
+}
+
+#if PLATFORM(MAC)
+- (BOOL)_showsURLsInToolTips
+{
+    return _showsURLsInToolTips;
+}
+
+- (void)_setShowsURLsInToolTips:(BOOL)showsURLsInToolTips
+{
+    _showsURLsInToolTips = showsURLsInToolTips;
+}
+
+- (BOOL)_serviceControlsEnabled
+{
+    return _serviceControlsEnabled;
+}
+
+- (void)_setServiceControlsEnabled:(BOOL)serviceControlsEnabled
+{
+    _serviceControlsEnabled = serviceControlsEnabled;
+}
+
+- (BOOL)_imageControlsEnabled
+{
+    return _imageControlsEnabled;
+}
+
+- (void)_setImageControlsEnabled:(BOOL)imageControlsEnabled
+{
+    _imageControlsEnabled = imageControlsEnabled;
+}
+
+- (BOOL)_requiresUserActionForEditingControlsManager
+{
+    return _requiresUserActionForEditingControlsManager;
+}
+
+- (void)_setRequiresUserActionForEditingControlsManager:(BOOL)requiresUserAction
+{
+    _requiresUserActionForEditingControlsManager = requiresUserAction;
+}
+
+#endif // PLATFORM(MAC)
+
+- (BOOL)_applePayEnabled
+{
+#if ENABLE(APPLE_PAY)
+    return _applePayEnabled;
+#else
+    return NO;
+#endif
+}
+
+- (void)_setApplePayEnabled:(BOOL)applePayEnabled
+{
+#if ENABLE(APPLE_PAY)
+    _applePayEnabled = applePayEnabled;
 #endif
+}
+
+- (BOOL)_needsStorageAccessFromFileURLsQuirk
+{
+    return _needsStorageAccessFromFileURLsQuirk;
+}
+
+- (void)_setNeedsStorageAccessFromFileURLsQuirk:(BOOL)needsLocalStorageQuirk
+{
+    _needsStorageAccessFromFileURLsQuirk = needsLocalStorageQuirk;
+}
+
+- (NSString *)_overrideContentSecurityPolicy
+{
+    return _overrideContentSecurityPolicy.get();
+}
+
+- (void)_setOverrideContentSecurityPolicy:(NSString *)overrideContentSecurityPolicy
+{
+    _overrideContentSecurityPolicy = adoptNS([overrideContentSecurityPolicy copy]);
+}
+
+- (NSString *)_mediaContentTypesRequiringHardwareSupport
+{
+    return _mediaContentTypesRequiringHardwareSupport.get();
+}
+
+- (void)_setMediaContentTypesRequiringHardwareSupport:(NSString *)mediaContentTypesRequiringHardwareSupport
+{
+    _mediaContentTypesRequiringHardwareSupport = adoptNS([mediaContentTypesRequiringHardwareSupport copy]);
+}
+
+- (void)_setLegacyEncryptedMediaAPIEnabled:(BOOL)enabled
+{
+    _legacyEncryptedMediaAPIEnabled = enabled;
+}
+
+- (BOOL)_legacyEncryptedMediaAPIEnabled
+{
+    return _legacyEncryptedMediaAPIEnabled;
+}
 
 @end
 
@@ -351,8 +897,33 @@ static NSString *defaultApplicationNameForUserAgent()
 {
     self.requiresUserActionForMediaPlayback = required;
 }
+
+- (BOOL)requiresUserActionForMediaPlayback
+{
+    return self.mediaTypesRequiringUserActionForPlayback == WKAudiovisualMediaTypeAll;
+}
+
+- (void)setRequiresUserActionForMediaPlayback:(BOOL)requiresUserActionForMediaPlayback
+{
+    self.mediaTypesRequiringUserActionForPlayback = requiresUserActionForMediaPlayback ? WKAudiovisualMediaTypeAll : WKAudiovisualMediaTypeNone;
+}
+
 #endif // PLATFORM(IOS)
 
 @end
 
+@implementation WKWebViewConfiguration (WKBinaryCompatibilityWithIOS10)
+
+-(_WKVisitedLinkStore *)_visitedLinkProvider
+{
+    return self._visitedLinkStore;
+}
+
+- (void)_setVisitedLinkProvider:(_WKVisitedLinkStore *)visitedLinkProvider
+{
+    self._visitedLinkStore = visitedLinkProvider;
+}
+
+@end
+
 #endif // WK_API_ENABLED