Changeset 153877 in webkit


Ignore:
Timestamp:
Aug 8, 2013 11:44:27 PM (11 years ago)
Author:
timothy_horton@apple.com
Message:

navigator.plugins has plugins in it when plugins are disabled
https://bugs.webkit.org/show_bug.cgi?id=119607
<rdar://problem/14678030>

Reviewed by Anders Carlsson.

Test: plugins/navigator-plugins-disabled.html

  • page/Settings.cpp:

(WebCore::Settings::setPluginsEnabled):
Refresh the plugin database when plugins are enabled or disabled.
This is necessary to ensure that navigator.plugins will have the
correct set of plugins after dynamically changing whether plugins
are enabled, which makes the test for this patch possible (but it
makes sense in the browser as well).

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::getPlugins):
Return a list of all plugins, and a list of only application plugins.

  • UIProcess/WebProcessProxy.h:
  • UIProcess/WebProcessProxy.messages.in:
  • WebProcess/WebCoreSupport/WebPlatformStrategies.h:
  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::getPluginInfo):
Add applicationPlugin parameter to getPlugins, and storage for the returned list.

(WebKit::WebPlatformStrategies::populatePluginCache):
If plugins are disabled for the given page, give WebCore the list that
only includes application plugins. Otherwise, give it the whole list
as we are doing currently.

  • WebCoreSupport/WebPlatformStrategies.mm:

(WebPlatformStrategies::getPluginInfo):
If plugins are disabled for the given page, give WebCore an empty list of
plugins. If WebKit1 had any application plugins, we'd return just them
instead.

Add a test that ensures that navigator.plugins only contains
application plugins when plugins are disabled.

  • plugins/navigator-plugins-disabled-expected.txt: Added.
  • plugins/navigator-plugins-disabled.html: Added.
Location:
trunk
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153876 r153877  
     12013-08-08  Tim Horton  <timothy_horton@apple.com>
     2
     3        navigator.plugins has plugins in it when plugins are disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=119607
     5        <rdar://problem/14678030>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        Add a test that ensures that navigator.plugins only contains
     10        application plugins when plugins are disabled.
     11
     12        * plugins/navigator-plugins-disabled-expected.txt: Added.
     13        * plugins/navigator-plugins-disabled.html: Added.
     14
    1152013-08-08  Timothy Hatcher  <timothy@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r153876 r153877  
     12013-08-08  Tim Horton  <timothy_horton@apple.com>
     2
     3        navigator.plugins has plugins in it when plugins are disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=119607
     5        <rdar://problem/14678030>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        Test: plugins/navigator-plugins-disabled.html
     10
     11        * page/Settings.cpp:
     12        (WebCore::Settings::setPluginsEnabled):
     13        Refresh the plugin database when plugins are enabled or disabled.
     14        This is necessary to ensure that navigator.plugins will have the
     15        correct set of plugins after dynamically changing whether plugins
     16        are enabled, which makes the test for this patch possible (but it
     17        makes sense in the browser as well).
     18
    1192013-08-08  Timothy Hatcher  <timothy@apple.com>
    220
  • trunk/Source/WebCore/page/Settings.cpp

    r153696 r153877  
    391391void Settings::setPluginsEnabled(bool arePluginsEnabled)
    392392{
     393    if (m_arePluginsEnabled == arePluginsEnabled)
     394        return;
     395
    393396    m_arePluginsEnabled = arePluginsEnabled;
     397    Page::refreshPlugins(false);
    394398}
    395399
  • trunk/Source/WebKit/mac/ChangeLog

    r153775 r153877  
     12013-08-08  Tim Horton  <timothy_horton@apple.com>
     2
     3        navigator.plugins has plugins in it when plugins are disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=119607
     5        <rdar://problem/14678030>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * WebCoreSupport/WebPlatformStrategies.mm:
     10        (WebPlatformStrategies::getPluginInfo):
     11        If plugins are disabled for the given page, give WebCore an empty list of
     12        plugins. If WebKit1 had any application plugins, we'd return just them
     13        instead.
     14
    1152013-08-06  Stephanie Lewis  <slewis@apple.com>
    216
  • trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm

    r149035 r153877  
    127127}
    128128
    129 void WebPlatformStrategies::getPluginInfo(const Page*, Vector<PluginInfo>& plugins)
     129void WebPlatformStrategies::getPluginInfo(const Page* page, Vector<PluginInfo>& plugins)
    130130{
    131131    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     132
     133    // WebKit1 has no application plug-ins, so we don't need to add them here.
     134    if (!page->mainFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
     135        return;
    132136
    133137    NSArray* pluginsArray = [[WebPluginDatabase sharedDatabase] plugins];
  • trunk/Source/WebKit2/ChangeLog

    r153856 r153877  
     12013-08-08  Tim Horton  <timothy_horton@apple.com>
     2
     3        navigator.plugins has plugins in it when plugins are disabled
     4        https://bugs.webkit.org/show_bug.cgi?id=119607
     5        <rdar://problem/14678030>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * UIProcess/WebProcessProxy.cpp:
     10        (WebKit::WebProcessProxy::getPlugins):
     11        Return a list of all plugins, and a list of only application plugins.
     12
     13        * UIProcess/WebProcessProxy.h:
     14        * UIProcess/WebProcessProxy.messages.in:
     15        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
     16        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
     17        (WebKit::WebPlatformStrategies::getPluginInfo):
     18        Add applicationPlugin parameter to getPlugins, and storage for the returned list.
     19
     20        (WebKit::WebPlatformStrategies::populatePluginCache):
     21        If plugins are disabled for the given page, give WebCore the list that
     22        only includes application plugins. Otherwise, give it the whole list
     23        as we are doing currently.
     24
    1252013-08-08  Gavin Barraclough  <barraclough@apple.com>
    226
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp

    r153694 r153877  
    307307
    308308#if ENABLE(NETSCAPE_PLUGIN_API)
    309 void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins)
     309void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins, Vector<PluginInfo>& applicationPlugins)
    310310{
    311311    if (refresh)
     
    318318#if ENABLE(PDFKIT_PLUGIN)
    319319    // Add built-in PDF last, so that it's not used when a real plug-in is installed.
    320     if (!m_context->omitPDFSupport())
     320    if (!m_context->omitPDFSupport()) {
    321321        plugins.append(PDFPlugin::pluginInfo());
     322        applicationPlugins.append(PDFPlugin::pluginInfo());
     323    }
    322324#endif
    323325}
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.h

    r150491 r153877  
    145145    // Plugins
    146146#if ENABLE(NETSCAPE_PLUGIN_API)
    147     void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins);
     147    void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins);
    148148#endif // ENABLE(NETSCAPE_PLUGIN_API)
    149149#if ENABLE(PLUGIN_PROCESS)
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in

    r150484 r153877  
    3939    # Plugin messages.
    4040#if ENABLE(NETSCAPE_PLUGIN_API)
    41     GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins)
     41    GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins, Vector<WebCore::PluginInfo> applicationPlugins)
    4242#endif // ENABLE(NETSCAPE_PLUGIN_API)
    4343#if ENABLE(PLUGIN_PROCESS)
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r150669 r153877  
    4040#include "WebProcessProxyMessages.h"
    4141#include <WebCore/Color.h>
     42#include <WebCore/Frame.h>
    4243#include <WebCore/KURL.h>
    4344#include <WebCore/LoaderStrategy.h>
     
    280281}
    281282
    282 void WebPlatformStrategies::getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>& plugins)
     283void WebPlatformStrategies::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& plugins)
    283284{
    284285#if ENABLE(NETSCAPE_PLUGIN_API)
    285286    populatePluginCache();
    286     plugins = m_cachedPlugins;
     287
     288    if (page->mainFrame()->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) {
     289        plugins = m_cachedPlugins;
     290        return;
     291    }
     292
     293    plugins = m_cachedApplicationPlugins;
    287294#endif // ENABLE(NETSCAPE_PLUGIN_API)
    288295}
     
    297304   
    298305    // FIXME: Should we do something in case of error here?
    299     if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPlugins(m_shouldRefreshPlugins), Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins), 0))
     306    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPlugins(m_shouldRefreshPlugins), Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins, m_cachedApplicationPlugins), 0))
    300307        return;
    301308
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

    r150310 r153877  
    119119    bool m_shouldRefreshPlugins;
    120120    Vector<WebCore::PluginInfo> m_cachedPlugins;
     121    Vector<WebCore::PluginInfo> m_cachedApplicationPlugins;
    121122#endif // ENABLE(PLUGIN_PROCESS)
    122123};
    123124
    124125#if ENABLE(NETSCAPE_PLUGIN_API)
    125 void handleDidGetPlugins(uint64_t requestID, const Vector<WebCore::PluginInfo>&);
     126void handleDidGetPlugins(uint64_t requestID, const Vector<WebCore::PluginInfo>&, const Vector<WebCore::PluginInfo>& applicationPlugins);
    126127#endif // ENABLE(PLUGIN_PROCESS)
    127128
Note: See TracChangeset for help on using the changeset viewer.