Changeset 26929 in webkit


Ignore:
Timestamp:
Oct 23, 2007 4:16:06 PM (16 years ago)
Author:
honeycutt
Message:

2007-10-23 Jon Honeycutt <jhoneycutt@apple.com>

Reviewed by Anders.

<rdar://5548217>: [NTS] Java 6 update 3 crashes Safari when loading a
java page

It is possible to load Mozilla's Java plugin instead of our own, which
can lead to a crash. The fix is to prefer plugins in our own Plugins
directory when searching for a plugin.

  • plugins/win/PluginDatabaseWin.cpp: (WebCore::safariPluginsPath): Return the path to our own Plugins directory (WebCore::PluginDatabaseWin::defaultPluginPaths): Use new method safariPluginsPath() (WebCore::PluginDatabaseWin::pluginForMIMEType): If the plugin's path is our Plugins path, return this plugin. Otherwise, continue scanning the list of plugins (WebCore::PluginDatabaseWin::pluginForExtension): Same
  • plugins/win/PluginPackageWin.h: (WebCore::PluginPackageWin::path): Return this plugin's path
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r26924 r26929  
     12007-10-23  Jon Honeycutt  <jhoneycutt@apple.com>
     2
     3        Reviewed by Anders.
     4
     5        <rdar://5548217>: [NTS] Java 6 update 3 crashes Safari when loading a
     6        java page
     7
     8        It is possible to load Mozilla's Java plugin instead of our own, which
     9        can lead to a crash. The fix is to prefer plugins in our own Plugins
     10        directory when searching for a plugin.
     11
     12        * plugins/win/PluginDatabaseWin.cpp:
     13        (WebCore::safariPluginsPath): Return the path to our own Plugins
     14        directory
     15        (WebCore::PluginDatabaseWin::defaultPluginPaths): Use new method
     16        safariPluginsPath()
     17        (WebCore::PluginDatabaseWin::pluginForMIMEType): If the plugin's path is
     18        our Plugins path, return this plugin. Otherwise, continue scanning the
     19        list of plugins
     20        (WebCore::PluginDatabaseWin::pluginForExtension): Same
     21        * plugins/win/PluginPackageWin.h:
     22        (WebCore::PluginPackageWin::path): Return this plugin's path
     23
    1242007-10-23  Jasper Bryant-Greene  <m@ni.ac.nz>
    225
  • trunk/WebCore/plugins/win/PluginDatabaseWin.cpp

    r25594 r26929  
    380380}
    381381
    382 static inline void addPluginPath(Vector<String>& paths)
     382static inline String safariPluginsPath()
    383383{
    384384    WCHAR moduleFileNameStr[_MAX_PATH];
     
    387387
    388388    if (!moduleFileNameLen)
    389         return;
     389        return String();
    390390
    391391    String moduleFileName = String(moduleFileNameStr, moduleFileNameLen);
    392392    int i = moduleFileName.reverseFind('\\');
    393393    if (i == -1)
    394         return;
     394        return String();
    395395
    396396    String pluginsPath = moduleFileName.left(i);
    397397    pluginsPath.append("\\Plugins");
    398 
    399     paths.append(pluginsPath);
     398    return pluginsPath;
    400399}
    401400
     
    417416{
    418417    Vector<String> paths;
    419 
    420     addPluginPath(paths);
     418    String ourPath = safariPluginsPath();
     419
     420    if (!ourPath.isNull())
     421        paths.append(ourPath);
    421422    addQuickTimePluginPath(paths);
    422423    addAdobeAcrobatPluginPath(paths);
     
    436437{
    437438    String key = mimeType.lower();
     439    String ourPath = safariPluginsPath();
     440    PluginPackageWin* plugin = 0;
    438441
    439442    PluginSet::const_iterator end = m_plugins.end();
    440443    for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) {
    441         if ((*it)->mimeToDescriptions().contains(key))
    442             return (*it).get();
    443     }
    444 
    445     return 0;
     444        if ((*it)->mimeToDescriptions().contains(key)) {
     445            plugin = (*it).get();
     446            // prefer plugins in our own plugins directory
     447            if (plugin->path() == ourPath)
     448                break;
     449        }
     450    }
     451
     452    return plugin;
    446453}
    447454
     
    449456{
    450457    PluginSet::const_iterator end = m_plugins.end();
     458    String ourPath = safariPluginsPath();
     459    PluginPackageWin* plugin = 0;
     460
    451461    for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) {
    452462        MIMEToExtensionsMap::const_iterator mime_end = (*it)->mimeToExtensions().end();
     
    456466
    457467            for (unsigned i = 0; i < extensions.size(); i++) {
    458                 if (extensions[i] == extension)
    459                     return (*it).get();
     468                if (extensions[i] == extension) {
     469                    plugin = (*it).get();
     470                    // prefer plugins in our own plugins directory
     471                    if (plugin->path() == ourPath)
     472                        break;
     473                }
    460474            }
    461475        }
    462476    }
    463477
    464     return 0;
     478    return plugin;
    465479}
    466480
  • trunk/WebCore/plugins/win/PluginPackageWin.h

    r26364 r26929  
    4949        String description() const { return m_description; }
    5050        String fileName() const { return m_fileName; }
     51        String path() const { return m_path; }
    5152
    5253        const MIMEToDescriptionsMap& mimeToDescriptions() const { return m_mimeToDescriptions; }
Note: See TracChangeset for help on using the changeset viewer.