Title: [260239] trunk/Source
Revision
260239
Author
[email protected]
Date
2020-04-17 00:52:00 -0700 (Fri, 17 Apr 2020)

Log Message

Move allowPlugins to FrameLoader
https://bugs.webkit.org/show_bug.cgi?id=205876

Patch by Rob Buis <[email protected]> on 2020-04-17
Reviewed by Darin Adler.

Source/WebCore:

Move allowPlugins to FrameLoader to reduce
pointer dereferences and lessen dependency
on SubframeLoader. Also rename to
arePluginsEnabled since the method is asking
the Setting with the same name.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::rendererIsEverNeeded):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::arePluginsEnabled):
* loader/FrameLoader.h:
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::createJavaAppletWidget):
(WebCore::SubframeLoader::allowPlugins): Deleted.
* loader/SubframeLoader.h:
* plugins/DOMMimeType.cpp:
(WebCore::DOMMimeType::enabledPlugin const):

Source/WebKit:

Adapt to API change.

* WebProcess/Plugins/WebPluginInfoProvider.cpp:
(WebKit::WebPluginInfoProvider::pluginInfo):
(WebKit::WebPluginInfoProvider::populatePluginCache):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::objectContentType):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
(WebKit::WebPage::canPluginHandleResponse):
(WebKit::WebPage::canShowMIMEType const):

Source/WebKitLegacy/mac:

Adapt to API change.

* WebCoreSupport/WebPluginInfoProvider.mm:
(WebPluginInfoProvider::pluginInfo):
* WebView/WebFrame.mm:
(-[WebFrame _canProvideDocumentSource]):

Source/WebKitLegacy/win:

Adapt to API change.

* WebView.cpp:
(WebView::canShowMIMEType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260238 => 260239)


--- trunk/Source/WebCore/ChangeLog	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/ChangeLog	2020-04-17 07:52:00 UTC (rev 260239)
@@ -1,3 +1,30 @@
+2020-04-17  Rob Buis  <[email protected]>
+
+        Move allowPlugins to FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=205876
+
+        Reviewed by Darin Adler.
+
+        Move allowPlugins to FrameLoader to reduce
+        pointer dereferences and lessen dependency
+        on SubframeLoader. Also rename to
+        arePluginsEnabled since the method is asking
+        the Setting with the same name.
+
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocument):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::rendererIsEverNeeded):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::arePluginsEnabled):
+        * loader/FrameLoader.h:
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::createJavaAppletWidget):
+        (WebCore::SubframeLoader::allowPlugins): Deleted.
+        * loader/SubframeLoader.h:
+        * plugins/DOMMimeType.cpp:
+        (WebCore::DOMMimeType::enabledPlugin const):
+
 2020-04-17  Tomoki Imai  <[email protected]>
 
         Fix an integer overflow in WebCrypto AES-CTR Mac implementation, which may detect a false loop

Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (260238 => 260239)


--- trunk/Source/WebCore/dom/DOMImplementation.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -51,7 +51,6 @@
 #include "SecurityOriginPolicy.h"
 #include "Settings.h"
 #include "StyleSheetContents.h"
-#include "SubframeLoader.h"
 #include "Text.h"
 #include "TextDocument.h"
 #include "XMLDocument.h"
@@ -173,7 +172,7 @@
 
     // The following is the relatively costly lookup that requires initializing the plug-in database.
     if (frame && frame->page()) {
-        auto allowedPluginTypes = frame->loader().subframeLoader().allowPlugins()
+        auto allowedPluginTypes = frame->loader().arePluginsEnabled()
             ? PluginData::AllPlugins : PluginData::OnlyApplicationPlugins;
         if (frame->page()->pluginData().supportsWebVisibleMimeType(type, allowedPluginTypes))
             return PluginDocument::create(*frame, url);

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (260238 => 260239)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -63,7 +63,6 @@
 #include "ShadowRoot.h"
 #include "SimulatedClick.h"
 #include "StyleProperties.h"
-#include "SubframeLoader.h"
 #include "Text.h"
 #include "XMLNames.h"
 #include "markup.h"
@@ -741,7 +740,7 @@
             return false;
     } else if (hasTagName(noembedTag)) {
         RefPtr<Frame> frame = document().frame();
-        if (frame && frame->loader().subframeLoader().allowPlugins())
+        if (frame && frame->loader().arePluginsEnabled())
             return false;
     }
     return StyledElement::rendererIsEverNeeded();

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (260238 => 260239)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -4163,6 +4163,11 @@
     return m_frame.settings().shouldSuppressTextInputFromEditingDuringProvisionalNavigation() && m_state == FrameStateProvisional;
 }
 
+bool FrameLoader::arePluginsEnabled()
+{
+    return m_frame.settings().arePluginsEnabled();
+}
+
 } // namespace WebCore
 
 #undef PAGE_ID

Modified: trunk/Source/WebCore/loader/FrameLoader.h (260238 => 260239)


--- trunk/Source/WebCore/loader/FrameLoader.h	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2020-04-17 07:52:00 UTC (rev 260239)
@@ -332,6 +332,8 @@
     // For subresource requests the FrameLoadType parameter has no effect and can be skipped.
     void addExtraFieldsToRequest(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard);
 
+    WEBCORE_EXPORT bool arePluginsEnabled();
+
 private:
     enum FormSubmissionCacheLoadPolicy {
         MayAttemptCacheOnlyLoadForFormSubmissionItem,

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (260238 => 260239)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -154,7 +154,7 @@
     // Application plug-ins are plug-ins implemented by the user agent, for example Qt plug-ins,
     // as opposed to third-party code such as Flash. The user agent decides whether or not they are
     // permitted, rather than WebKit.
-    if ((!allowPlugins() && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType)))
+    if (!(m_frame.settings().arePluginsEnabled() || MIMETypeRegistry::isApplicationPluginMIMEType(mimeType)))
         return false;
 
     if (!pluginIsLoadable(url, mimeType))
@@ -279,7 +279,7 @@
     URL baseURL = completeURL(baseURLString);
 
     RefPtr<Widget> widget;
-    if (allowPlugins())
+    if (m_frame.settings().arePluginsEnabled())
         widget = m_frame.loader().client().createJavaAppletWidget(size, element, baseURL, paramNames, paramValues);
 
     logPluginRequest(m_frame.page(), element.serviceType(), String(), widget);
@@ -382,11 +382,6 @@
     return frame;
 }
 
-bool SubframeLoader::allowPlugins()
-{
-    return m_frame.settings().arePluginsEnabled();
-}
-
 bool SubframeLoader::shouldUsePlugin(const URL& url, const String& mimeType, bool hasFallback, bool& useFallback)
 {
     if (m_frame.loader().client().shouldAlwaysUsePluginDocument(mimeType)) {

Modified: trunk/Source/WebCore/loader/SubframeLoader.h (260238 => 260239)


--- trunk/Source/WebCore/loader/SubframeLoader.h	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/loader/SubframeLoader.h	2020-04-17 07:52:00 UTC (rev 260239)
@@ -61,8 +61,6 @@
 
     RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const Vector<String>& paramNames, const Vector<String>& paramValues);
 
-    WEBCORE_EXPORT bool allowPlugins();
-
     bool containsPlugins() const { return m_containsPlugins; }
     
     bool resourceWillUsePlugin(const String& url, const String& mimeType);

Modified: trunk/Source/WebCore/plugins/DOMMimeType.cpp (260238 => 260239)


--- trunk/Source/WebCore/plugins/DOMMimeType.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebCore/plugins/DOMMimeType.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -24,7 +24,6 @@
 #include "FrameLoader.h"
 #include "Page.h"
 #include "PluginData.h"
-#include "SubframeLoader.h"
 #include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
@@ -67,7 +66,7 @@
 
 RefPtr<DOMPlugin> DOMMimeType::enabledPlugin() const
 {
-    if (!m_frame || !m_frame->page() || !m_frame->page()->mainFrame().loader().subframeLoader().allowPlugins())
+    if (!m_frame || !m_frame->page() || !m_frame->page()->mainFrame().loader().arePluginsEnabled())
         return nullptr;
 
     Vector<MimeClassInfo> mimes;

Modified: trunk/Source/WebKit/ChangeLog (260238 => 260239)


--- trunk/Source/WebKit/ChangeLog	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKit/ChangeLog	2020-04-17 07:52:00 UTC (rev 260239)
@@ -1,3 +1,22 @@
+2020-04-17  Rob Buis  <[email protected]>
+
+        Move allowPlugins to FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=205876
+
+        Reviewed by Darin Adler.
+
+        Adapt to API change.
+
+        * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+        (WebKit::WebPluginInfoProvider::pluginInfo):
+        (WebKit::WebPluginInfoProvider::populatePluginCache):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::objectContentType):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+        (WebKit::WebPage::canPluginHandleResponse):
+        (WebKit::WebPage::canShowMIMEType const):
+
 2020-04-16  Peng Liu  <[email protected]>
 
         Cleanup the usage of ENABLE_FULLSCREEN_API

Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (260238 => 260239)


--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -37,7 +37,6 @@
 #include <WebCore/LegacySchemeRegistry.h>
 #include <WebCore/Page.h>
 #include <WebCore/Settings.h>
-#include <WebCore/SubframeLoader.h>
 #include <wtf/text/StringHash.h>
 
 #if PLATFORM(MAC)
@@ -108,7 +107,7 @@
     if (m_cachedSupportedPluginIdentifiers)
         supportedPluginIdentifiers = *m_cachedSupportedPluginIdentifiers;
 
-    return page.mainFrame().loader().subframeLoader().allowPlugins() ? m_cachedPlugins : m_cachedApplicationPlugins;
+    return page.mainFrame().loader().arePluginsEnabled() ? m_cachedPlugins : m_cachedApplicationPlugins;
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(supportedPluginIdentifiers);
@@ -151,7 +150,7 @@
         // Application plugins are not affected by enablePlugins setting, so we always need to scan plugins to get them.
         bool shouldScanPlugins = true;
 #else
-        bool shouldScanPlugins = page.mainFrame().loader().subframeLoader().allowPlugins();
+        bool shouldScanPlugins = page.mainFrame().loader().arePluginsEnabled();
 #endif
         if (shouldScanPlugins) {
             HangDetectionDisabler hangDetectionDisabler;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (260238 => 260239)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -87,7 +87,6 @@
 #include <WebCore/ScriptController.h>
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/Settings.h>
-#include <WebCore/SubframeLoader.h>
 #include <WebCore/UIEventWithKeyState.h>
 #include <WebCore/Widget.h>
 #include <WebCore/WindowFeatures.h>
@@ -1713,7 +1712,7 @@
         return ObjectContentType::Image;
 
     if (WebPage* webPage = m_frame->page()) {
-        auto allowedPluginTypes = webFrame().coreFrame()->loader().subframeLoader().allowPlugins()
+        auto allowedPluginTypes = webFrame().coreFrame()->loader().arePluginsEnabled()
             ? PluginData::AllPlugins : PluginData::OnlyApplicationPlugins;
         if (webPage->corePage()->pluginData().supportsMimeType(mimeType, allowedPluginTypes))
             return ObjectContentType::PlugIn;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (260238 => 260239)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -996,7 +996,7 @@
     PluginProcessType processType = pluginElement->displayState() == HTMLPlugInElement::WaitingForSnapshot ? PluginProcessTypeSnapshot : PluginProcessTypeNormal;
 #endif
 
-    bool allowOnlyApplicationPlugins = !frame->coreFrame()->loader().subframeLoader().allowPlugins();
+    bool allowOnlyApplicationPlugins = !frame->coreFrame()->loader().arePluginsEnabled();
 
     uint64_t pluginProcessToken;
     uint32_t pluginLoadPolicy;
@@ -5249,7 +5249,7 @@
 {
 #if ENABLE(NETSCAPE_PLUGIN_API)
     uint32_t pluginLoadPolicy;
-    bool allowOnlyApplicationPlugins = !m_mainFrame->coreFrame()->loader().subframeLoader().allowPlugins();
+    bool allowOnlyApplicationPlugins = !m_mainFrame->coreFrame()->loader().arePluginsEnabled();
 
     uint64_t pluginProcessToken;
     String newMIMEType;
@@ -5797,7 +5797,7 @@
     if (!mimeType.isNull() && m_mimeTypesWithCustomContentProviders.contains(mimeType))
         return true;
 
-    if (corePage()->mainFrame().loader().subframeLoader().allowPlugins() && pluginsSupport(mimeType, PluginData::AllPlugins))
+    if (corePage()->mainFrame().loader().arePluginsEnabled() && pluginsSupport(mimeType, PluginData::AllPlugins))
         return true;
 
     // We can use application plugins even if plugins aren't enabled.

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (260238 => 260239)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-04-17 07:52:00 UTC (rev 260239)
@@ -1,3 +1,17 @@
+2020-04-17  Rob Buis  <[email protected]>
+
+        Move allowPlugins to FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=205876
+
+        Reviewed by Darin Adler.
+
+        Adapt to API change.
+
+        * WebCoreSupport/WebPluginInfoProvider.mm:
+        (WebPluginInfoProvider::pluginInfo):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _canProvideDocumentSource]):
+
 2020-04-13  Tim Horton  <[email protected]>
 
         REGRESSION (r259843): "Missing Plug-In" when dragging an image into Mail Compose

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm (260238 => 260239)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm	2020-04-17 07:52:00 UTC (rev 260239)
@@ -30,7 +30,6 @@
 #import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/Page.h>
-#import <WebCore/SubframeLoader.h>
 #import <wtf/BlockObjCExceptions.h>
 
 using namespace WebCore;
@@ -63,7 +62,7 @@
 
 
     // WebKit1 has no application plug-ins, so we don't need to add them here.
-    if (!page.mainFrame().loader().subframeLoader().allowPlugins())
+    if (!page.mainFrame().loader().arePluginsEnabled())
         return plugins;
 
     for (WebPluginPackage *plugin in [WebPluginDatabase sharedDatabase].plugins)

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm (260238 => 260239)


--- trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2020-04-17 07:52:00 UTC (rev 260239)
@@ -977,7 +977,7 @@
 
     if (WebCore::MIMETypeRegistry::isTextMIMEType(mimeType)
         || WebCore::Image::supportsType(mimeType)
-        || (pluginData && pluginData->supportsWebVisibleMimeType(mimeType, WebCore::PluginData::AllPlugins) && frame->loader().subframeLoader().allowPlugins())
+        || (pluginData && pluginData->supportsWebVisibleMimeType(mimeType, WebCore::PluginData::AllPlugins) && frame->loader().arePluginsEnabled())
         || (pluginData && pluginData->supportsWebVisibleMimeType(mimeType, WebCore::PluginData::OnlyApplicationPlugins)))
         return NO;
 

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (260238 => 260239)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2020-04-17 07:52:00 UTC (rev 260239)
@@ -1,3 +1,15 @@
+2020-04-17  Rob Buis  <[email protected]>
+
+        Move allowPlugins to FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=205876
+
+        Reviewed by Darin Adler.
+
+        Adapt to API change.
+
+        * WebView.cpp:
+        (WebView::canShowMIMEType):
+
 2020-04-08  Daniel Bates  <[email protected]>
 
         Should find touch-action elements inside non-composited iframes

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (260238 => 260239)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2020-04-17 07:35:02 UTC (rev 260238)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2020-04-17 07:52:00 UTC (rev 260239)
@@ -162,7 +162,6 @@
 #include <WebCore/Settings.h>
 #include <WebCore/ShouldTreatAsContinuingLoad.h>
 #include <WebCore/SocketProvider.h>
-#include <WebCore/SubframeLoader.h>
 #include <WebCore/SystemInfo.h>
 #include <WebCore/TextIterator.h>
 #include <WebCore/UserContentController.h>
@@ -2972,7 +2971,7 @@
 bool WebView::canShowMIMEType(const String& mimeType)
 {
     Frame* coreFrame = core(m_mainFrame);
-    bool allowPlugins = coreFrame && coreFrame->loader().subframeLoader().allowPlugins();
+    bool arePluginsEnabled = coreFrame && coreFrame->loader().arePluginsEnabled();
 
     bool canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeType)
         || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)
@@ -2979,7 +2978,7 @@
         || MIMETypeRegistry::isSupportedMediaMIMEType(mimeType);
 
     if (!canShow && m_page) {
-        canShow = (m_page->pluginData().supportsWebVisibleMimeType(mimeType, PluginData::AllPlugins) && allowPlugins)
+        canShow = (m_page->pluginData().supportsWebVisibleMimeType(mimeType, PluginData::AllPlugins) && arePluginsEnabled)
             || m_page->pluginData().supportsWebVisibleMimeType(mimeType, PluginData::OnlyApplicationPlugins);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to