Changeset 69789 in webkit


Ignore:
Timestamp:
Oct 14, 2010 12:22:08 PM (13 years ago)
Author:
Adam Roben
Message:

Load plugins that are specified in the MozillaPlugins registry key

Fixes <http://webkit.org/b/44271> <rdar://problem/8329750> WebKit2
should load plugins specified in the MozillaPlugins registry key (like
old WebKit does)

I couldn't think of a good way to test this.

Reviewed by Steve Falkenburg.

  • UIProcess/Plugins/PluginInfoStore.cpp:

(WebKit::PluginInfoStore::loadPluginsIfNecessary): Also load plugins
specified by individualPluginPaths.

  • UIProcess/Plugins/PluginInfoStore.h: Added individualPluginPaths and

some comments.

  • UIProcess/Plugins/mac/PluginInfoStoreMac.mm:

(WebKit::PluginInfoStore::individualPluginPaths):

  • UIProcess/Plugins/qt/PluginInfoStoreQt.cpp:

(WebKit::PluginInfoStore::individualPluginPaths):
Stubbed out.

  • UIProcess/Plugins/win/PluginInfoStoreWin.cpp:

(WebKit::addPluginPathsFromRegistry):
(WebKit::PluginInfoStore::individualPluginPaths):
Ported this code from WebCore's PluginDatabaseWin.cpp. I slightly
cleaned it up and changed it to use a case-insensitive hash, since
paths on Windows are case-insensitive.

Location:
trunk/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r69788 r69789  
     12010-10-14  Adam Roben  <aroben@apple.com>
     2
     3        Load plugins that are specified in the MozillaPlugins registry key
     4
     5        Fixes <http://webkit.org/b/44271> <rdar://problem/8329750> WebKit2
     6        should load plugins specified in the MozillaPlugins registry key (like
     7        old WebKit does)
     8
     9        I couldn't think of a good way to test this.
     10
     11        Reviewed by Steve Falkenburg.
     12
     13        * UIProcess/Plugins/PluginInfoStore.cpp:
     14        (WebKit::PluginInfoStore::loadPluginsIfNecessary): Also load plugins
     15        specified by individualPluginPaths.
     16
     17        * UIProcess/Plugins/PluginInfoStore.h: Added individualPluginPaths and
     18        some comments.
     19
     20        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
     21        (WebKit::PluginInfoStore::individualPluginPaths):
     22        * UIProcess/Plugins/qt/PluginInfoStoreQt.cpp:
     23        (WebKit::PluginInfoStore::individualPluginPaths):
     24        Stubbed out.
     25
     26        * UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
     27        (WebKit::addPluginPathsFromRegistry):
     28        (WebKit::PluginInfoStore::individualPluginPaths):
     29        Ported this code from WebCore's PluginDatabaseWin.cpp. I slightly
     30        cleaned it up and changed it to use a case-insensitive hash, since
     31        paths on Windows are case-insensitive.
     32
    1332010-10-14  Adam Roben  <aroben@apple.com>
    234
  • trunk/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp

    r68170 r69789  
    6363        loadPluginsInDirectory(m_additionalPluginsDirectories[i]);
    6464
     65    // Then load plug-ins from the standard plug-ins directories.
    6566    Vector<String> directories = pluginsDirectories();
    6667    for (size_t i = 0; i < directories.size(); ++i)
    6768        loadPluginsInDirectory(directories[i]);
     69
     70    // Then load plug-ins that are not in the standard plug-ins directories.
     71    Vector<String> paths = individualPluginPaths();
     72    for (size_t i = 0; i < paths.size(); ++i)
     73        loadPlugin(paths[i]);
    6874
    6975    m_pluginListIsUpToDate = true;
  • trunk/WebKit2/UIProcess/Plugins/PluginInfoStore.h

    r68170 r69789  
    7272    void loadPlugin(const String& pluginPath);
    7373   
    74     // Platform specific member functions.
     74    // Platform-specific member functions
     75
     76    // Returns paths to directories that should be searched for plug-ins (via pluginPathsInDirectory).
    7577    static Vector<String> pluginsDirectories();
     78    // Returns paths to all plug-ins in the specified directory.
    7679    static Vector<String> pluginPathsInDirectory(const String& directory);
     80    // Returns paths to individual plug-ins that won't be found via pluginsDirectories/pluginPathsInDirectory.
     81    static Vector<String> individualPluginPaths();
    7782    static bool getPluginInfo(const String& pluginPath, Plugin& plugin);
    7883    static bool shouldUsePlugin(const Plugin& plugin, const Vector<Plugin>& loadedPlugins);
  • trunk/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm

    r67775 r69789  
    6565}
    6666
     67Vector<String> PluginInfoStore::individualPluginPaths()
     68{
     69    return Vector<String>();
     70}
     71
    6772static bool getPluginArchitecture(CFBundleRef bundle, cpu_type_t& pluginArchitecture)
    6873{
  • trunk/WebKit2/UIProcess/Plugins/qt/PluginInfoStoreQt.cpp

    r66636 r69789  
    5353}
    5454
     55Vector<String> PluginInfoStore::individualPluginPaths()
     56{
     57    return Vector<String>();
     58}
     59
    5560bool PluginInfoStore::getPluginInfo(const String& pluginPath, Plugin& plugin)
    5661{
  • trunk/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp

    r65704 r69789  
    3030#include <WebCore/FileSystem.h>
    3131#include <shlwapi.h>
     32#include <wtf/HashSet.h>
    3233#include <wtf/OwnArrayPtr.h>
     34#include <wtf/text/StringHash.h>
    3335
    3436using namespace WebCore;
     
    302304
    303305    return paths;
     306}
     307
     308static void addPluginPathsFromRegistry(HKEY rootKey, HashSet<String, CaseFoldingHash>& paths)
     309{
     310    HKEY key;
     311    if (::RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, KEY_ENUMERATE_SUB_KEYS, &key) != ERROR_SUCCESS)
     312        return;
     313
     314    for (size_t i = 0; ; ++i) {
     315        // MSDN says that key names have a maximum length of 255 characters.
     316        wchar_t name[256];
     317        DWORD nameLen = _countof(name);
     318        if (::RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, 0) != ERROR_SUCCESS)
     319            break;
     320
     321        wchar_t path[MAX_PATH];
     322        DWORD pathSizeInBytes = sizeof(path);
     323        DWORD type;
     324        if (::SHGetValueW(key, name, L"Path", &type, path, &pathSizeInBytes) != ERROR_SUCCESS)
     325            continue;
     326        if (type != REG_SZ)
     327            continue;
     328
     329        paths.add(path);
     330    }
     331
     332    ::RegCloseKey(key);
     333}
     334
     335Vector<String> PluginInfoStore::individualPluginPaths()
     336{
     337    HashSet<String, CaseFoldingHash> paths;
     338
     339    addPluginPathsFromRegistry(HKEY_LOCAL_MACHINE, paths);
     340    addPluginPathsFromRegistry(HKEY_CURRENT_USER, paths);
     341
     342    Vector<String> result;
     343    copyToVector(paths, result);
     344    return result;
    304345}
    305346
Note: See TracChangeset for help on using the changeset viewer.