Bug 47677 - WebKit2 can load the same plugin multiple times
Summary: WebKit2 can load the same plugin multiple times
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-10-14 11:21 PDT by Adam Roben (:aroben)
Modified: 2016-10-27 19:09 PDT (History)
3 users (show)

See Also:


Attachments
Make sure WebKit2 only loads each plugin once (6.17 KB, patch)
2010-10-14 11:55 PDT, Adam Roben (:aroben)
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2010-10-14 11:21:01 PDT
It's possible for WebKit2 to load the same plugin multiple times. This can happen, e.g., if a client application passes the path to a standard plugin directory to _WKContextSetAdditionalPluginsDirectory, or if a plugin in one of the standard plugin directories on Windows is also listed in the MozillaPlugins registry key.
Comment 1 Adam Roben (:aroben) 2010-10-14 11:21:53 PDT
We could change how we load plugins to:

1) Collect all plugin paths from all directories
2) Put all the paths in a HashSet to get rid of duplicates
3) Load plugins specified in the HashSet

On Windows, we'd probably want to use a case-insensitive HashSet.
Comment 2 Adam Roben (:aroben) 2010-10-14 11:22:13 PDT
<rdar://problem/8552178>
Comment 3 Adam Roben (:aroben) 2010-10-14 11:55:13 PDT
Created attachment 70763 [details]
Make sure WebKit2 only loads each plugin once
Comment 4 Sam Weinig 2010-10-14 12:08:26 PDT
Comment on attachment 70763 [details]
Make sure WebKit2 only loads each plugin once

View in context: https://bugs.webkit.org/attachment.cgi?id=70763&action=review

> WebKit2/UIProcess/Plugins/PluginInfoStore.cpp:59
> +template <typename T, typename U, typename V, typename W>
> +static void addFromVector(HashSet<T, U, V>& hashSet, const W& vector)
> +{
> +    for (size_t i = 0; i < vector.size(); ++i)
> +        hashSet.add(vector[i]);
> +}

Should this be in HashSet.h?
Comment 5 Adam Roben (:aroben) 2010-10-14 12:09:52 PDT
Comment on attachment 70763 [details]
Make sure WebKit2 only loads each plugin once

View in context: https://bugs.webkit.org/attachment.cgi?id=70763&action=review

>> WebKit2/UIProcess/Plugins/PluginInfoStore.cpp:59
>> +}
> 
> Should this be in HashSet.h?

If we find it to be more generally useful we could put it there.

Thanks for reviewing!
Comment 6 Adam Roben (:aroben) 2010-10-14 12:33:35 PDT
Committed r69790: <http://trac.webkit.org/changeset/69790>