Skip to content
  • timothy_horton@apple.com's avatar
    PDFPlugins don't load when plugins are disabled, but they should · e48c147c
    timothy_horton@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@150227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e48c147c