Deprecate WebKit2 plug-in support.
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKPreferences.mm
index 804b468..c3befce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #import "config.h"
 #import "WKPreferencesInternal.h"
 
-#if WK_API_ENABLED
-
 #import "APIArray.h"
+#import "PluginProcessManager.h"
 #import "WKNSArray.h"
 #import "WebPreferences.h"
-#import "_WKExperimentalFeature.h"
 #import "_WKExperimentalFeatureInternal.h"
+#import "_WKInternalDebugFeatureInternal.h"
 #import <WebCore/SecurityOrigin.h>
+#import <WebCore/Settings.h>
 #import <wtf/RetainPtr.h>
 
 @implementation WKPreferences
     [super dealloc];
 }
 
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
 // FIXME: We currently only encode/decode API preferences. We should consider whether we should
 // encode/decode SPI preferences as well.
 
     [coder encodeBool:self.javaScriptCanOpenWindowsAutomatically forKey:@"javaScriptCanOpenWindowsAutomatically"];
 
 #if PLATFORM(MAC)
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     [coder encodeBool:self.javaEnabled forKey:@"javaEnabled"];
     [coder encodeBool:self.plugInsEnabled forKey:@"plugInsEnabled"];
+ALLOW_DEPRECATED_DECLARATIONS_END
     [coder encodeBool:self.tabFocusesLinks forKey:@"tabFocusesLinks"];
 #endif
 }
     self.javaScriptCanOpenWindowsAutomatically = [coder decodeBoolForKey:@"javaScriptCanOpenWindowsAutomatically"];
 
 #if PLATFORM(MAC)
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     self.javaEnabled = [coder decodeBoolForKey:@"javaEnabled"];
     self.plugInsEnabled = [coder decodeBoolForKey:@"plugInsEnabled"];
+ALLOW_DEPRECATED_DECLARATIONS_END
     self.tabFocusesLinks = [coder decodeBoolForKey:@"tabFocusesLinks"];
 #endif
 
@@ -90,7 +99,7 @@
 
 - (id)copyWithZone:(NSZone *)zone
 {
-    return wrapper(_preferences->copy().leakRef());
+    return [wrapper(_preferences->copy()) retain];
 }
 
 - (CGFloat)minimumFontSize
 
 #if PLATFORM(MAC)
 
-- (BOOL)javaEnabled
-{
-    return _preferences->javaEnabled();
-}
-
-- (void)setJavaEnabled:(BOOL)javaEnabled
-{
-    _preferences->setJavaEnabled(javaEnabled);
-}
-
-- (BOOL)plugInsEnabled
-{
-    return _preferences->pluginsEnabled();
-}
-
-- (void)setPlugInsEnabled:(BOOL)plugInsEnabled
-{
-    _preferences->setPluginsEnabled(plugInsEnabled);
-}
-
 - (BOOL)tabFocusesLinks
 {
     return _preferences->tabsToLinks();
@@ -320,6 +309,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setSimpleLineLayoutDebugBordersEnabled(simpleLineLayoutDebugBordersEnabled);
 }
 
+- (BOOL)_contentChangeObserverEnabled
+{
+    return _preferences->contentChangeObserverEnabled();
+}
+
+- (void)_setContentChangeObserverEnabled:(BOOL)contentChangeObserverEnabled
+{
+    _preferences->setContentChangeObserverEnabled(contentChangeObserverEnabled);
+}
+
 - (BOOL)_acceleratedDrawingEnabled
 {
     return _preferences->acceleratedDrawingEnabled();
@@ -340,16 +339,6 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setDisplayListDrawingEnabled(displayListDrawingEnabled);
 }
 
-- (BOOL)_visualViewportEnabled
-{
-    return _preferences->visualViewportEnabled();
-}
-
-- (void)_setVisualViewportEnabled:(BOOL)_visualViewportEnabled
-{
-    _preferences->setVisualViewportEnabled(_visualViewportEnabled);
-}
-
 - (BOOL)_largeImageAsyncDecodingEnabled
 {
     return _preferences->largeImageAsyncDecodingEnabled();
@@ -510,20 +499,48 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setFixedFontFamily(fixedPitchFontFamily);
 }
 
++ (NSArray<_WKInternalDebugFeature *> *)_internalDebugFeatures
+{
+    auto features = WebKit::WebPreferences::internalDebugFeatures();
+    return wrapper(API::Array::create(WTFMove(features)));
+}
+
+- (BOOL)_isEnabledForInternalDebugFeature:(_WKInternalDebugFeature *)feature
+{
+    return _preferences->isFeatureEnabled(*feature->_internalDebugFeature);
+}
+
+- (void)_setEnabled:(BOOL)value forInternalDebugFeature:(_WKInternalDebugFeature *)feature
+{
+    _preferences->setFeatureEnabled(*feature->_internalDebugFeature, value);
+}
+
 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures
 {
     auto features = WebKit::WebPreferences::experimentalFeatures();
-    return [wrapper(API::Array::create(WTFMove(features)).leakRef()) autorelease];
+    return wrapper(API::Array::create(WTFMove(features)));
 }
 
+// FIXME: Remove this once Safari has adopted the new API.
 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature
 {
-    return _preferences->isEnabledForFeature(*feature->_experimentalFeature);
+    return [self _isEnabledForExperimentalFeature:feature];
 }
 
+// FIXME: Remove this once Safari has adopted the new API.
 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature
 {
-    _preferences->setEnabledForFeature(value, *feature->_experimentalFeature);
+    [self _setEnabled:value forExperimentalFeature:feature];
+}
+
+- (BOOL)_isEnabledForExperimentalFeature:(_WKExperimentalFeature *)feature
+{
+    return _preferences->isFeatureEnabled(*feature->_experimentalFeature);
+}
+
+- (void)_setEnabled:(BOOL)value forExperimentalFeature:(_WKExperimentalFeature *)feature
+{
+    _preferences->setFeatureEnabled(*feature->_experimentalFeature, value);
 }
 
 - (BOOL)_applePayCapabilityDisclosureAllowed
@@ -544,12 +561,12 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
 
 - (BOOL)_shouldSuppressKeyboardInputDuringProvisionalNavigation
 {
-    return _preferences->shouldSuppressKeyboardInputDuringProvisionalNavigation();
+    return _preferences->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
 }
 
 - (void)_setShouldSuppressKeyboardInputDuringProvisionalNavigation:(BOOL)shouldSuppress
 {
-    _preferences->setShouldSuppressKeyboardInputDuringProvisionalNavigation(shouldSuppress);
+    _preferences->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(shouldSuppress);
 }
 
 - (BOOL)_loadsImagesAutomatically
@@ -582,6 +599,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setMediaDevicesEnabled(enabled);
 }
 
+- (BOOL)_screenCaptureEnabled
+{
+    return _preferences->screenCaptureEnabled();
+}
+
+- (void)_setScreenCaptureEnabled:(BOOL)enabled
+{
+    _preferences->setScreenCaptureEnabled(enabled);
+}
+
 - (BOOL)_mockCaptureDevicesEnabled
 {
     return _preferences->mockCaptureDevicesEnabled();
@@ -612,6 +639,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setMediaCaptureRequiresSecureConnection(requiresSecureConnection);
 }
 
+- (double)_inactiveMediaCaptureSteamRepromptIntervalInMinutes
+{
+    return _preferences->inactiveMediaCaptureSteamRepromptIntervalInMinutes();
+}
+
+- (void)_setInactiveMediaCaptureSteamRepromptIntervalInMinutes:(double)interval
+{
+    _preferences->setInactiveMediaCaptureSteamRepromptIntervalInMinutes(interval);
+}
+
 - (BOOL)_enumeratingAllNetworkInterfacesEnabled
 {
     return _preferences->enumeratingAllNetworkInterfacesEnabled();
@@ -634,12 +671,11 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
 
 - (BOOL)_webRTCLegacyAPIEnabled
 {
-    return !_preferences->webRTCLegacyAPIDisabled();
+    return NO;
 }
 
 - (void)_setWebRTCLegacyAPIEnabled:(BOOL)enabled
 {
-    _preferences->setWebRTCLegacyAPIDisabled(!enabled);
 }
 
 - (void)_setJavaScriptCanAccessClipboard:(BOOL)javaScriptCanAccessClipboard
@@ -647,16 +683,590 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
 }
 
-- (void)_setPlugInsEnabled:(BOOL)enabled
+- (BOOL)_shouldAllowUserInstalledFonts
 {
-    _preferences->setPluginsEnabled(enabled);
+    return _preferences->shouldAllowUserInstalledFonts();
 }
 
-- (BOOL)_plugInsEnabled
+- (void)_setShouldAllowUserInstalledFonts:(BOOL)_shouldAllowUserInstalledFonts
 {
-    return _preferences->pluginsEnabled();
+    _preferences->setShouldAllowUserInstalledFonts(_shouldAllowUserInstalledFonts);
+}
+
+static _WKEditableLinkBehavior toAPI(WebCore::EditableLinkBehavior behavior)
+{
+    switch (behavior) {
+    case WebCore::EditableLinkDefaultBehavior:
+        return _WKEditableLinkBehaviorDefault;
+    case WebCore::EditableLinkAlwaysLive:
+        return _WKEditableLinkBehaviorAlwaysLive;
+    case WebCore::EditableLinkOnlyLiveWithShiftKey:
+        return _WKEditableLinkBehaviorOnlyLiveWithShiftKey;
+    case WebCore::EditableLinkLiveWhenNotFocused:
+        return _WKEditableLinkBehaviorLiveWhenNotFocused;
+    case WebCore::EditableLinkNeverLive:
+        return _WKEditableLinkBehaviorNeverLive;
+    }
+    
+    ASSERT_NOT_REACHED();
+    return _WKEditableLinkBehaviorNeverLive;
+}
+
+static WebCore::EditableLinkBehavior toEditableLinkBehavior(_WKEditableLinkBehavior wkBehavior)
+{
+    switch (wkBehavior) {
+    case _WKEditableLinkBehaviorDefault:
+        return WebCore::EditableLinkDefaultBehavior;
+    case _WKEditableLinkBehaviorAlwaysLive:
+        return WebCore::EditableLinkAlwaysLive;
+    case _WKEditableLinkBehaviorOnlyLiveWithShiftKey:
+        return WebCore::EditableLinkOnlyLiveWithShiftKey;
+    case _WKEditableLinkBehaviorLiveWhenNotFocused:
+        return WebCore::EditableLinkLiveWhenNotFocused;
+    case _WKEditableLinkBehaviorNeverLive:
+        return WebCore::EditableLinkNeverLive;
+    }
+    
+    ASSERT_NOT_REACHED();
+    return WebCore::EditableLinkNeverLive;
+}
+
+- (_WKEditableLinkBehavior)_editableLinkBehavior
+{
+    return toAPI(static_cast<WebCore::EditableLinkBehavior>(_preferences->editableLinkBehavior()));
+}
+
+- (void)_setEditableLinkBehavior:(_WKEditableLinkBehavior)editableLinkBehavior
+{
+    _preferences->setEditableLinkBehavior(toEditableLinkBehavior(editableLinkBehavior));
+}
+
+- (void)_setAVFoundationEnabled:(BOOL)enabled
+{
+    _preferences->setAVFoundationEnabled(enabled);
+}
+
+- (BOOL)_avFoundationEnabled
+{
+    return _preferences->isAVFoundationEnabled();
+}
+
+- (void)_setColorFilterEnabled:(BOOL)enabled
+{
+    _preferences->setColorFilterEnabled(enabled);
+}
+
+- (BOOL)_colorFilterEnabled
+{
+    return _preferences->colorFilterEnabled();
+}
+
+- (void)_setPunchOutWhiteBackgroundsInDarkMode:(BOOL)punches
+{
+    _preferences->setPunchOutWhiteBackgroundsInDarkMode(punches);
+}
+
+- (BOOL)_punchOutWhiteBackgroundsInDarkMode
+{
+    return _preferences->punchOutWhiteBackgroundsInDarkMode();
+}
+
+- (void)_setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled
+{
+    _preferences->setLowPowerVideoAudioBufferSizeEnabled(enabled);
+}
+
+- (BOOL)_lowPowerVideoAudioBufferSizeEnabled
+{
+    return _preferences->lowPowerVideoAudioBufferSizeEnabled();
+}
+
+- (void)_setShouldIgnoreMetaViewport:(BOOL)ignoreMetaViewport
+{
+    return _preferences->setShouldIgnoreMetaViewport(ignoreMetaViewport);
+}
+
+- (BOOL)_shouldIgnoreMetaViewport
+{
+    return _preferences->shouldIgnoreMetaViewport();
+}
+
+- (void)_setNeedsSiteSpecificQuirks:(BOOL)enabled
+{
+    _preferences->setNeedsSiteSpecificQuirks(enabled);
+}
+
+- (BOOL)_needsSiteSpecificQuirks
+{
+    return _preferences->needsSiteSpecificQuirks();
 }
 
+- (void)_setItpDebugModeEnabled:(BOOL)enabled
+{
+    _preferences->setItpDebugModeEnabled(enabled);
+}
+
+- (BOOL)_itpDebugModeEnabled
+{
+    return _preferences->itpDebugModeEnabled();
+}
+
+- (void)_setMediaSourceEnabled:(BOOL)enabled
+{
+    _preferences->setMediaSourceEnabled(enabled);
+}
+
+- (BOOL)_mediaSourceEnabled
+{
+    return _preferences->mediaSourceEnabled();
+}
+
+#if PLATFORM(MAC)
+- (void)_setJavaEnabledForLocalFiles:(BOOL)enabled
+{
+    _preferences->setJavaEnabledForLocalFiles(enabled);
+}
+
+- (BOOL)_javaEnabledForLocalFiles
+{
+    return _preferences->javaEnabledForLocalFiles();
+}
+
+- (void)_setCanvasUsesAcceleratedDrawing:(BOOL)enabled
+{
+    _preferences->setCanvasUsesAcceleratedDrawing(enabled);
+}
+
+- (BOOL)_canvasUsesAcceleratedDrawing
+{
+    return _preferences->canvasUsesAcceleratedDrawing();
+}
+
+- (void)_setAcceleratedCompositingEnabled:(BOOL)enabled
+{
+    _preferences->setAcceleratedCompositingEnabled(enabled);
+}
+
+- (BOOL)_acceleratedCompositingEnabled
+{
+    return _preferences->acceleratedCompositingEnabled();
+}
+
+- (void)_setDefaultTextEncodingName:(NSString *)name
+{
+    _preferences->setDefaultTextEncodingName(name);
+}
+
+- (NSString *)_defaultTextEncodingName
+{
+    return _preferences->defaultTextEncodingName();
+}
+
+- (void)_setAuthorAndUserStylesEnabled:(BOOL)enabled
+{
+    _preferences->setAuthorAndUserStylesEnabled(enabled);
+}
+
+- (BOOL)_authorAndUserStylesEnabled
+{
+    return _preferences->authorAndUserStylesEnabled();
+}
+
+- (void)_setDOMTimersThrottlingEnabled:(BOOL)enabled
+{
+    _preferences->setDOMTimersThrottlingEnabled(enabled);
+}
+
+- (BOOL)_domTimersThrottlingEnabled
+{
+    return _preferences->domTimersThrottlingEnabled();
+}
+
+- (void)_setWebArchiveDebugModeEnabled:(BOOL)enabled
+{
+    _preferences->setWebArchiveDebugModeEnabled(enabled);
+}
+
+- (BOOL)_webArchiveDebugModeEnabled
+{
+    return _preferences->webArchiveDebugModeEnabled();
+}
+
+- (void)_setLocalFileContentSniffingEnabled:(BOOL)enabled
+{
+    _preferences->setLocalFileContentSniffingEnabled(enabled);
+}
+
+- (BOOL)_localFileContentSniffingEnabled
+{
+    return _preferences->localFileContentSniffingEnabled();
+}
+
+- (void)_setUsesPageCache:(BOOL)enabled
+{
+    _preferences->setUsesPageCache(enabled);
+}
+
+- (BOOL)_usesPageCache
+{
+    return _preferences->usesPageCache();
+}
+
+- (void)_setPageCacheSupportsPlugins:(BOOL)enabled
+{
+    _preferences->setPageCacheSupportsPlugins(enabled);
+}
+
+- (BOOL)_pageCacheSupportsPlugins
+{
+    return _preferences->pageCacheSupportsPlugins();
+}
+
+- (void)_setShouldPrintBackgrounds:(BOOL)enabled
+{
+    _preferences->setShouldPrintBackgrounds(enabled);
+}
+
+- (BOOL)_shouldPrintBackgrounds
+{
+    return _preferences->shouldPrintBackgrounds();
+}
+
+- (void)_setWebSecurityEnabled:(BOOL)enabled
+{
+    _preferences->setWebSecurityEnabled(enabled);
+}
+
+- (BOOL)_webSecurityEnabled
+{
+    return _preferences->webSecurityEnabled();
+}
+
+- (void)_setUniversalAccessFromFileURLsAllowed:(BOOL)enabled
+{
+    _preferences->setAllowUniversalAccessFromFileURLs(enabled);
+}
+
+- (BOOL)_universalAccessFromFileURLsAllowed
+{
+    return _preferences->allowUniversalAccessFromFileURLs();
+}
+
+- (void)_setSuppressesIncrementalRendering:(BOOL)enabled
+{
+    _preferences->setSuppressesIncrementalRendering(enabled);
+}
+
+- (BOOL)_suppressesIncrementalRendering
+{
+    return _preferences->suppressesIncrementalRendering();
+}
+
+- (void)_setAsynchronousPluginInitializationEnabled:(BOOL)enabled
+{
+    _preferences->setAsynchronousPluginInitializationEnabled(enabled);
+}
+
+- (BOOL)_asynchronousPluginInitializationEnabled
+{
+    return _preferences->asynchronousPluginInitializationEnabled();
+}
+
+- (void)_setArtificialPluginInitializationDelayEnabled:(BOOL)enabled
+{
+    _preferences->setArtificialPluginInitializationDelayEnabled(enabled);
+}
+
+- (BOOL)_artificialPluginInitializationDelayEnabled
+{
+    return _preferences->artificialPluginInitializationDelayEnabled();
+}
+
+- (void)_setExperimentalPlugInSandboxProfilesEnabled:(BOOL)enabled
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+    WebKit::PluginProcessManager::singleton().setExperimentalPlugInSandboxProfilesEnabled(enabled);
+#endif
+    _preferences->setExperimentalPlugInSandboxProfilesEnabled(enabled);
+}
+
+- (BOOL)_experimentalPlugInSandboxProfilesEnabled
+{
+    return _preferences->experimentalPlugInSandboxProfilesEnabled();
+}
+
+- (void)_setCookieEnabled:(BOOL)enabled
+{
+    _preferences->setCookieEnabled(enabled);
+}
+
+- (BOOL)_cookieEnabled
+{
+    return _preferences->cookieEnabled();
+}
+
+- (void)_setPlugInSnapshottingEnabled:(BOOL)enabled
+{
+    _preferences->setPlugInSnapshottingEnabled(enabled);
+}
+
+- (BOOL)_plugInSnapshottingEnabled
+{
+    return _preferences->plugInSnapshottingEnabled();
+}
+
+- (void)_setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
+{
+    _preferences->setSubpixelCSSOMElementMetricsEnabled(enabled);
+}
+
+- (BOOL)_subpixelCSSOMElementMetricsEnabled
+{
+    return _preferences->subpixelCSSOMElementMetricsEnabled();
+}
+
+- (void)_setViewGestureDebuggingEnabled:(BOOL)enabled
+{
+    _preferences->setViewGestureDebuggingEnabled(enabled);
+}
+
+- (BOOL)_viewGestureDebuggingEnabled
+{
+    return _preferences->viewGestureDebuggingEnabled();
+}
+
+- (void)_setStandardFontFamily:(NSString *)family
+{
+    _preferences->setStandardFontFamily(family);
+}
+
+- (NSString *)_standardFontFamily
+{
+    return _preferences->standardFontFamily();
+}
+
+- (void)_setNotificationsEnabled:(BOOL)enabled
+{
+    _preferences->setNotificationsEnabled(enabled);
+}
+
+- (BOOL)_notificationsEnabled
+{
+    return _preferences->notificationsEnabled();
+}
+
+- (void)_setBackspaceKeyNavigationEnabled:(BOOL)enabled
+{
+    _preferences->setBackspaceKeyNavigationEnabled(enabled);
+}
+
+- (BOOL)_backspaceKeyNavigationEnabled
+{
+    return _preferences->backspaceKeyNavigationEnabled();
+}
+
+- (void)_setWebGLEnabled:(BOOL)enabled
+{
+    _preferences->setWebGLEnabled(enabled);
+}
+
+- (BOOL)_webGLEnabled
+{
+    return _preferences->webGLEnabled();
+}
+
+- (void)_setAllowsInlineMediaPlayback:(BOOL)enabled
+{
+    _preferences->setAllowsInlineMediaPlayback(enabled);
+}
+
+- (BOOL)_allowsInlineMediaPlayback
+{
+    return _preferences->allowsInlineMediaPlayback();
+}
+
+- (void)_setApplePayEnabled:(BOOL)enabled
+{
+    _preferences->setApplePayEnabled(enabled);
+}
+
+- (BOOL)_applePayEnabled
+{
+    return _preferences->applePayEnabled();
+}
+
+- (void)_setDNSPrefetchingEnabled:(BOOL)enabled
+{
+    _preferences->setDNSPrefetchingEnabled(enabled);
+}
+
+- (BOOL)_dnsPrefetchingEnabled
+{
+    return _preferences->dnsPrefetchingEnabled();
+}
+
+- (void)_setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)enabled
+{
+    _preferences->setInlineMediaPlaybackRequiresPlaysInlineAttribute(enabled);
+}
+
+- (BOOL)_inlineMediaPlaybackRequiresPlaysInlineAttribute
+{
+    return _preferences->inlineMediaPlaybackRequiresPlaysInlineAttribute();
+}
+
+- (void)_setInvisibleMediaAutoplayNotPermitted:(BOOL)enabled
+{
+    _preferences->setInvisibleAutoplayNotPermitted(enabled);
+}
+
+- (BOOL)_invisibleMediaAutoplayNotPermitted
+{
+    return _preferences->invisibleAutoplayNotPermitted();
+}
+
+- (void)_setLegacyEncryptedMediaAPIEnabled:(BOOL)enabled
+{
+    _preferences->setLegacyEncryptedMediaAPIEnabled(enabled);
+}
+
+- (BOOL)_legacyEncryptedMediaAPIEnabled
+{
+    return _preferences->legacyEncryptedMediaAPIEnabled();
+}
+
+- (void)_setMainContentUserGestureOverrideEnabled:(BOOL)enabled
+{
+    _preferences->setMainContentUserGestureOverrideEnabled(enabled);
+}
+
+- (BOOL)_mainContentUserGestureOverrideEnabled
+{
+    return _preferences->mainContentUserGestureOverrideEnabled();
+}
+
+- (void)_setMediaStreamEnabled:(BOOL)enabled
+{
+    _preferences->setMediaStreamEnabled(enabled);
+}
+
+- (BOOL)_mediaStreamEnabled
+{
+    return _preferences->mediaStreamEnabled();
+}
+
+- (void)_setNeedsStorageAccessFromFileURLsQuirk:(BOOL)enabled
+{
+    _preferences->setNeedsStorageAccessFromFileURLsQuirk(enabled);
+}
+
+- (BOOL)_needsStorageAccessFromFileURLsQuirk
+{
+    return _preferences->needsStorageAccessFromFileURLsQuirk();
+}
+
+- (void)_setPDFPluginEnabled:(BOOL)enabled
+{
+    _preferences->setPDFPluginEnabled(enabled);
+}
+
+- (BOOL)_pdfPluginEnabled
+{
+    return _preferences->pdfPluginEnabled();
+}
+
+- (void)_setRequiresUserGestureForAudioPlayback:(BOOL)enabled
+{
+    _preferences->setRequiresUserGestureForAudioPlayback(enabled);
+}
+
+- (BOOL)_requiresUserGestureForAudioPlayback
+{
+    return _preferences->requiresUserGestureForAudioPlayback();
+}
+
+- (void)_setRequiresUserGestureForVideoPlayback:(BOOL)enabled
+{
+    _preferences->setRequiresUserGestureForVideoPlayback(enabled);
+}
+
+- (BOOL)_requiresUserGestureForVideoPlayback
+{
+    return _preferences->requiresUserGestureForVideoPlayback();
+}
+
+- (void)_setServiceControlsEnabled:(BOOL)enabled
+{
+    _preferences->setServiceControlsEnabled(enabled);
+}
+
+- (BOOL)_serviceControlsEnabled
+{
+    return _preferences->serviceControlsEnabled();
+}
+
+- (void)_setShowsToolTipOverTruncatedText:(BOOL)enabled
+{
+    _preferences->setShowsToolTipOverTruncatedText(enabled);
+}
+
+- (BOOL)_showsToolTipOverTruncatedText
+{
+    return _preferences->showsToolTipOverTruncatedText();
+}
+
+- (void)_setTextAreasAreResizable:(BOOL)enabled
+{
+    _preferences->setTextAreasAreResizable(enabled);
+}
+
+- (BOOL)_textAreasAreResizable
+{
+    return _preferences->textAreasAreResizable();
+}
+
+- (void)_setUseGiantTiles:(BOOL)enabled
+{
+    _preferences->setUseGiantTiles(enabled);
+}
+
+- (BOOL)_useGiantTiles
+{
+    return _preferences->useGiantTiles();
+}
+
+- (void)_setWantsBalancedSetDefersLoadingBehavior:(BOOL)enabled
+{
+    _preferences->setWantsBalancedSetDefersLoadingBehavior(enabled);
+}
+
+- (BOOL)_wantsBalancedSetDefersLoadingBehavior
+{
+    return _preferences->wantsBalancedSetDefersLoadingBehavior();
+}
+
+- (void)_setWebAudioEnabled:(BOOL)enabled
+{
+    _preferences->setWebAudioEnabled(enabled);
+}
+
+- (BOOL)_webAudioEnabled
+{
+    return _preferences->webAudioEnabled();
+}
+
+- (void)_setAggressiveTileRetentionEnabled:(BOOL)enabled
+{
+    _preferences->setAggressiveTileRetentionEnabled(enabled);
+}
+
+- (BOOL)_aggressiveTileRetentionEnabled
+{
+    return _preferences->aggressiveTileRetentionEnabled();
+}
+
+#endif // PLATFORM(MAC)
+
 - (BOOL)_javaScriptCanAccessClipboard
 {
     return _preferences->javaScriptCanAccessClipboard();
@@ -672,6 +1282,94 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     return _preferences->domPasteAllowed();
 }
 
+- (void)_setShouldEnableTextAutosizingBoost:(BOOL)shouldEnableTextAutosizingBoost
+{
+#if ENABLE(TEXT_AUTOSIZING)
+    _preferences->setShouldEnableTextAutosizingBoost(shouldEnableTextAutosizingBoost);
+#endif
+}
+
+- (BOOL)_shouldEnableTextAutosizingBoost
+{
+#if ENABLE(TEXT_AUTOSIZING)
+    return _preferences->shouldEnableTextAutosizingBoost();
+#else
+    return NO;
+#endif
+}
+
+- (BOOL)_isSafeBrowsingEnabled
+{
+    return _preferences->safeBrowsingEnabled();
+}
+
+- (void)_setSafeBrowsingEnabled:(BOOL)enabled
+{
+    _preferences->setSafeBrowsingEnabled(enabled);
+}
+
+- (void)_setVideoQualityIncludesDisplayCompositingEnabled:(BOOL)videoQualityIncludesDisplayCompositingEnabled
+{
+    _preferences->setVideoQualityIncludesDisplayCompositingEnabled(videoQualityIncludesDisplayCompositingEnabled);
+}
+
+- (BOOL)_videoQualityIncludesDisplayCompositingEnabled
+{
+    return _preferences->videoQualityIncludesDisplayCompositingEnabled();
+}
+
+- (void)_setWebAnimationsCSSIntegrationEnabled:(BOOL)enabled
+{
+    _preferences->setWebAnimationsCSSIntegrationEnabled(enabled);
+}
+
+- (BOOL)_webAnimationsCSSIntegrationEnabled
+{
+    return _preferences->webAnimationsCSSIntegrationEnabled();
+}
+
+- (void)_setDeviceOrientationEventEnabled:(BOOL)enabled
+{
+#if ENABLE(DEVICE_ORIENTATION)
+    _preferences->setDeviceOrientationEventEnabled(enabled);
+#endif
+}
+
+- (BOOL)_deviceOrientationEventEnabled
+{
+#if ENABLE(DEVICE_ORIENTATION)
+    return _preferences->deviceOrientationEventEnabled();
+#else
+    return false;
+#endif
+}
+
+@end
+
+#if !TARGET_OS_IPHONE
+
+@implementation WKPreferences (WKDeprecated)
+
+- (BOOL)javaEnabled
+{
+    return _preferences->javaEnabled();
+}
+
+- (void)setJavaEnabled:(BOOL)javaEnabled
+{
+    _preferences->setJavaEnabled(javaEnabled);
+}
+
+- (BOOL)plugInsEnabled
+{
+    return _preferences->pluginsEnabled();
+}
+
+- (void)setPlugInsEnabled:(BOOL)plugInsEnabled
+{
+    _preferences->setPluginsEnabled(plugInsEnabled);
+}
+
 @end
 
-#endif // WK_API_ENABLED
+#endif