"pluginReplacementEnabled" should be a Setting, not a RuntimeEnabledFeature
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2016 01:28:35 +0000 (01:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2016 01:28:35 +0000 (01:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161416
<rdar://problem/28050847>

Patch by Ricky Mondello <rmondello@apple.com> on 2016-08-30
Reviewed by Simon Fraser.

Mostly mechanical. Tested by running LayoutTests/plugins/quicktime-plugin-replacement.html and manually toggling
defaultPluginReplacementEnabled and observing a behavior change.

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::reset): Purged of the pluginReplacementEnabled setting.
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setPluginReplacementEnabled): Deleted.
(WebCore::RuntimeEnabledFeatures::pluginReplacementEnabled): Deleted.
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::requestObject): Use the setting.
* page/Settings.cpp: Supply different values for iOS and other platforms, matching the RuntimeEnabledFeature values,
    enabled for iOS and disabled otherwise.
* page/Settings.in: Declare the setting.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): Use the setting.
(WebCore::InternalSettings::Backup::restoreTo): Ditto.
(WebCore::InternalSettings::setPluginReplacementEnabled): Ditto.
* testing/InternalSettings.h: Can now throw an exception, like other Settings-backed members.
* testing/InternalSettings.idl: Declare this as possibly throwing an exception.

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

Source/WebCore/ChangeLog
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.in
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl

index 0819223..a1e68e8 100644 (file)
@@ -1,5 +1,33 @@
 2016-08-30  Ricky Mondello  <rmondello@apple.com>
 
+        "pluginReplacementEnabled" should be a Setting, not a RuntimeEnabledFeature
+        https://bugs.webkit.org/show_bug.cgi?id=161416
+        <rdar://problem/28050847>
+
+        Reviewed by Simon Fraser.
+
+        Mostly mechanical. Tested by running LayoutTests/plugins/quicktime-plugin-replacement.html and manually toggling
+        defaultPluginReplacementEnabled and observing a behavior change.
+
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::reset): Purged of the pluginReplacementEnabled setting.
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setPluginReplacementEnabled): Deleted.
+        (WebCore::RuntimeEnabledFeatures::pluginReplacementEnabled): Deleted.
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::requestObject): Use the setting.
+        * page/Settings.cpp: Supply different values for iOS and other platforms, matching the RuntimeEnabledFeature values,
+            enabled for iOS and disabled otherwise.
+        * page/Settings.in: Declare the setting.
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::Backup::Backup): Use the setting.
+        (WebCore::InternalSettings::Backup::restoreTo): Ditto.
+        (WebCore::InternalSettings::setPluginReplacementEnabled): Ditto.
+        * testing/InternalSettings.h: Can now throw an exception, like other Settings-backed members.
+        * testing/InternalSettings.idl: Declare this as possibly throwing an exception.
+
+2016-08-30  Ricky Mondello  <rmondello@apple.com>
+
         YouTubePluginReplacementTest's URL transformation logic should have tests
         https://bugs.webkit.org/show_bug.cgi?id=161406
         <rdar://problem/28050847>
index 594be92..408eb8f 100644 (file)
@@ -57,11 +57,6 @@ void RuntimeEnabledFeatures::reset()
     m_isDeviceOrientationEnabled = true;
     m_isLinkPreloadEnabled = false;
     m_isLangAttributeAwareFormControlUIEnabled = false;
-#if PLATFORM(IOS)
-    m_isPluginReplacementEnabled = true;
-#else
-    m_isPluginReplacementEnabled = false;
-#endif
     m_isResourceTimingEnabled = false;
 #if ENABLE(INDEXED_DATABASE)
     m_isIndexedDBEnabled = true;
index 51beab8..bd99d24 100644 (file)
@@ -177,9 +177,6 @@ public:
     // The lang attribute support is incomplete and should only be turned on for tests.
     void setLangAttributeAwareFormControlUIEnabled(bool isEnabled) { m_isLangAttributeAwareFormControlUIEnabled = isEnabled; }
 
-    void setPluginReplacementEnabled(bool isEnabled) { m_isPluginReplacementEnabled = isEnabled; }
-    bool pluginReplacementEnabled() const { return m_isPluginReplacementEnabled; }
-
     void setResourceTimingEnabled(bool isEnabled) { m_isResourceTimingEnabled = isEnabled; }
     bool resourceTimingEnabled() const { return m_isResourceTimingEnabled; }
 
@@ -246,7 +243,6 @@ private:
     bool m_isDeviceOrientationEnabled;
     bool m_isLinkPreloadEnabled;
     bool m_isLangAttributeAwareFormControlUIEnabled;
-    bool m_isPluginReplacementEnabled;
     bool m_isResourceTimingEnabled;
 
 #if ENABLE(INDEXED_DATABASE)
index 4130a26..f21eb96 100644 (file)
@@ -374,7 +374,7 @@ static ReplacementPlugin* pluginReplacementForType(const URL& url, const String&
 
 bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
-    if (!RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
+    if (!document().settings()->pluginReplacementEnabled())
         return false;
 
     if (m_pluginReplacement)
index df8b2f6..0d1f1a1 100644 (file)
@@ -145,6 +145,7 @@ static const bool defaultShouldRespectImageOrientation = true;
 static const bool defaultImageSubsamplingEnabled = true;
 static const bool defaultScrollingTreeIncludesFrames = true;
 static const bool defaultMediaControlsScaleWithPageZoom = true;
+static const bool defaultPluginReplacementEnabled = true;
 #else
 static const bool defaultFixedPositionCreatesStackingContext = false;
 static const bool defaultFixedBackgroundsPaintRelativeToDocument = false;
@@ -158,6 +159,7 @@ static const bool defaultShouldRespectImageOrientation = false;
 static const bool defaultImageSubsamplingEnabled = false;
 static const bool defaultScrollingTreeIncludesFrames = false;
 static const bool defaultMediaControlsScaleWithPageZoom = true;
+static const bool defaultPluginReplacementEnabled = false;
 #endif
 
 static const bool defaultAllowsPictureInPictureMediaPlayback = true;
index 860e323..7350b34 100644 (file)
@@ -279,3 +279,5 @@ treatIPAddressAsDomain initial=false
 
 # Runtime-enabled features
 visualViewportEnabled initial=false
+
+pluginReplacementEnabled initial=defaultPluginReplacementEnabled
index c9a333a..f0e8592 100644 (file)
@@ -91,7 +91,7 @@ InternalSettings::Backup::Backup(Settings& settings)
     , m_originalTimeWithoutMouseMovementBeforeHidingControls(settings.timeWithoutMouseMovementBeforeHidingControls())
     , m_useLegacyBackgroundSizeShorthandBehavior(settings.useLegacyBackgroundSizeShorthandBehavior())
     , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
-    , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
+    , m_pluginReplacementEnabled(settings.pluginReplacementEnabled())
     , m_shouldConvertPositionStyleOnCopy(settings.shouldConvertPositionStyleOnCopy())
     , m_fontFallbackPrefersPictographs(settings.fontFallbackPrefersPictographs())
     , m_webFontsAlwaysFallBack(settings.webFontsAlwaysFallBack())
@@ -183,7 +183,7 @@ void InternalSettings::Backup::restoreTo(Settings& settings)
     settings.setAllowsInlineMediaPlayback(m_allowsInlineMediaPlayback);
     settings.setAllowsInlineMediaPlaybackAfterFullscreen(m_allowsInlineMediaPlaybackAfterFullscreen);
     settings.setInlineMediaPlaybackRequiresPlaysInlineAttribute(m_inlineMediaPlaybackRequiresPlaysInlineAttribute);
-    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled);
+    settings.setPluginReplacementEnabled(m_pluginReplacementEnabled);
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     RuntimeEnabledFeatures::sharedFeatures().setIndexedDBWorkersEnabled(m_indexedDBWorkersEnabled);
 #endif
@@ -548,9 +548,10 @@ void InternalSettings::setWebFontsAlwaysFallBack(bool enable, ExceptionCode& ec)
     settings()->setWebFontsAlwaysFallBack(enable);
 }
 
-void InternalSettings::setPluginReplacementEnabled(bool enabled)
+void InternalSettings::setPluginReplacementEnabled(bool enabled, ExceptionCode& ec)
 {
-    RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(enabled);
+    InternalSettingsGuardForSettings();
+    settings()->setPluginReplacementEnabled(enabled);
 }
 
 void InternalSettings::setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode& ec)
index e98508e..cb925a5 100644 (file)
@@ -156,7 +156,7 @@ public:
     void setAutoscrollForDragAndDropEnabled(bool, ExceptionCode&);
     void setFontFallbackPrefersPictographs(bool, ExceptionCode&);
     void setWebFontsAlwaysFallBack(bool, ExceptionCode&);
-    void setPluginReplacementEnabled(bool);
+    void setPluginReplacementEnabled(bool, ExceptionCode&);
     void setBackgroundShouldExtendBeyondPage(bool, ExceptionCode&);
     void setShouldConvertPositionStyleOnCopy(bool, ExceptionCode&);
     void setScrollingTreeIncludesFrames(bool, ExceptionCode&);
index a37e90f..982e3a9 100644 (file)
@@ -57,7 +57,7 @@
 
     [RaisesException] void setForcePendingWebGLPolicy(boolean forced);
 
-    void setPluginReplacementEnabled(boolean enabled);
+    [RaisesException] void setPluginReplacementEnabled(boolean enabled);
 
     // Editing, forms
     [RaisesException] void setEditingBehavior(DOMString behavior);