PDFPlugins don't load when plugins are disabled, but they should
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 00:42:03 +0000 (00:42 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 00:42:03 +0000 (00:42 +0000)
commit4429d8b0b8a292dec2f78812a00762a257181d0f
treeeac436e317d348b9fd289e88fd287e03ca0b60da
parent01821fbe176feea8261557bf19a528121cfb0444
PDFPlugins don't load when plugins are disabled, but they should
https://bugs.webkit.org/show_bug.cgi?id=75790
<rdar://problem/11650197>

Reviewed by Anders Carlsson.

Make it possible to load "application" plug-ins even if settings or the FrameLoaderClient
say that plug-ins should be disabled, providing a mechanism for WebKit* to offer built-in
functionality which happens to use the plug-in infrastructure, and which also doesn't
unexpectedly disappear for users with plug-ins off.

* WebCore.exp.in:
Export SubframeLoader::allowPlugins().
Update signature for PluginData::supportsMimeType to include the AllowedPluginTypes argument.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
Load PluginData even if plug-ins are disabled, but if that is the case, only
create a PluginDocument for application plug-ins.

* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::appendBytes):
Don't bail if plug-ins are disabled, because we could still be a PluginDocument
for an application plug-in.

* page/Page.cpp:
(WebCore::Page::pluginData):
Allow PluginData to be constructed even if plug-ins are disabled, as there might
be application plug-ins that we want to load anyway.

* platform/mac/MIMETypeRegistryMac.mm:
(WebCore::MIMETypeRegistry::isApplicationPluginMIMEType):
On Mac, if we have PDFPlugin, we can support PDF and PostScript with a native application plug-in.

* plugins/PluginData.cpp:
(WebCore::PluginData::supportsMimeType):
Add an AllowedPluginTypes argument to supportsMimeType, allowing callers to specify
whether they are looking for any plug-in, or are looking only for application plug-ins.

* plugins/PluginData.h:
(PluginInfo): Added an isApplicationPlugin field, to specify whether this is a "built-in" plug-in.
(PluginData): Add the aforementioned AllowedPluginTypes enum and the argument to supportsMimeType.

Support loading "application" plug-ins even if plug-ins are explicitly disabled.

Make PDFPlugin and SimplePDFPlugin "application" plug-ins, so they can
be loaded even if plug-ins are disabled.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add a 5-argument, 3-reply version of callMemberFunction.

* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::getPluginInfo):
NPAPI plug-ins are not application plug-ins.

* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
Encode/decode the new isApplicationPlugin field on PluginInfo.

* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::findPluginForMIMEType):
(WebKit::PluginInfoStore::findPluginForExtension):
(WebKit::PluginInfoStore::findPlugin):
* UIProcess/Plugins/PluginInfoStore.h:
(PluginInfoStore):
Give PluginInfoStore's findPlugin method and its private helper
methods an argument allowing them to only match application plug-ins.

(WebKit::WebPageProxy::findPlugin):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
Add an argument allowing findPlugin to restrict its search to only application plug-ins.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::objectContentType):
Previously, this caller depended on pluginData() returning null if
plug-ins were disabled. Since that is no longer the case, we have to
check if we can use plug-ins, and otherwise ignore non-application-plug-ins.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
When going to search for a plug-in, ask subframeLoader whether or not
it's OK to use ordinary non-application plug-ins, and pass that information
on to the UIProcess when performing the search.

(WebKit::WebPage::canPluginHandleResponse): Ditto.
(WebKit::WebPage::canShowMIMEType):
Ensure that canShowMIMEType returns true if we have an application plug-in
that can display a particular MIME type, even if we're not allowed to load plug-ins.

* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage getPluginInfoFromPLists]):
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage getPluginInfoFromResources]):
Nothing loaded via WebBasePluginPackage or WebNetscapePluginPackage
is an application plugin.

* WebView/WebFrame.mm:
(-[WebFrame _canProvideDocumentSource]):
Previously, this caller depended on pluginData() returning null if
plug-ins were disabled. Since that is no longer the case, we have to
check if we can use plug-ins, and otherwise ignore non-application-plug-ins.

* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::objectContentType):
Previously, this caller depended on pluginData() returning null if
plug-ins were disabled. Since that is no longer the case, we have to
check if we can use plug-ins, and otherwise ignore non-application-plug-ins.

* WebView.cpp:
(WebView::canShowMIMEType):
Previously, this caller depended on pluginData() returning null if
plug-ins were disabled. Since that is no longer the case, we have to
check if we can use plug-ins, and otherwise ignore non-application-plug-ins.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/DOMImplementation.cpp
Source/WebCore/html/PluginDocument.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/platform/mac/MIMETypeRegistryMac.mm
Source/WebCore/plugins/PluginData.cpp
Source/WebCore/plugins/PluginData.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/WebBasePluginPackage.mm
Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/HandleMessage.h
Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.mm
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp