- a/Source/WebKit2/ChangeLog +15 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2011-09-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        [UNIX] Add a method to get information for an already loaded plugin module
4
        https://bugs.webkit.org/show_bug.cgi?id=69139
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * Shared/Plugins/Netscape/NetscapePluginModule.h: Add pluginInfo().
9
        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
10
        (WebKit::NetscapePluginModule::pluginInfo): Private method to get
11
        the plugin information from the module, it must be called when the
12
        module has been already initialized.
13
        (WebKit::NetscapePluginModule::getPluginInfo): Use pluginInfo() to
14
        get information of the plugin module for the given path.
15
1
2011-09-29  Carlos Garcia Campos  <cgarcia@igalia.com>
16
2011-09-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2
17
3
        [GTK] Force single header include in WebKit2 GTK+ API
18
        [GTK] Force single header include in WebKit2 GTK+ API
- a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h +1 lines
Lines 69-74 private: a/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h_sec1
69
#if PLUGIN_ARCHITECTURE(X11)
69
#if PLUGIN_ARCHITECTURE(X11)
70
    void applyX11QuirksBeforeLoad();
70
    void applyX11QuirksBeforeLoad();
71
    static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
71
    static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
72
    bool pluginInfo(PluginModuleInfo&);
72
#endif
73
#endif
73
74
74
    bool tryGetSitesWithData(Vector<String>&);
75
    bool tryGetSitesWithData(Vector<String>&);
- a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp -25 / +25 lines
Lines 118-152 void NetscapePluginModule::setMIMEDescription(const String& mimeDescription, Plu a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp_sec1
118
    }
118
    }
119
}
119
}
120
120
121
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
121
bool NetscapePluginModule::pluginInfo(PluginModuleInfo& plugin)
122
{
122
{
123
    // Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
123
    ASSERT(m_isInitialized);
124
    // is leaked to layout test output.
125
    StdoutDevNullRedirector stdoutDevNullRedirector;
126
127
    // We are loading the plugin here since it does not seem to be a standardized way to
128
    // get the needed informations from a UNIX plugin without loading it.
129
    RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
130
    if (!pluginModule)
131
        return false;
132
133
    pluginModule->incrementLoadCount();
134
124
135
    plugin.path = pluginPath;
125
    plugin.path = m_pluginPath;
136
    plugin.info.file = pathGetFileName(pluginPath);
126
    plugin.info.file = pathGetFileName(m_pluginPath);
137
127
138
    Module* module = pluginModule->module();
128
    Module* module = m_module.get();
139
    NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
129
    NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
140
    if (!NPP_GetValue) {
130
    if (!NPP_GetValue)
141
        pluginModule->decrementLoadCount();
142
        return false;
131
        return false;
143
    }
144
132
145
    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
133
    NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
146
    if (!NP_GetMIMEDescription) {
134
    if (!NP_GetMIMEDescription)
147
        pluginModule->decrementLoadCount();
148
        return false;
135
        return false;
149
    }
150
136
151
    char* buffer;
137
    char* buffer;
152
    NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
138
    NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
Lines 158-173 bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleI a/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp_sec2
158
        plugin.info.desc = buffer;
144
        plugin.info.desc = buffer;
159
145
160
    const char* mimeDescription = NP_GetMIMEDescription();
146
    const char* mimeDescription = NP_GetMIMEDescription();
161
    if (!mimeDescription) {
147
    if (!mimeDescription)
162
        pluginModule->decrementLoadCount();
163
        return false;
148
        return false;
164
    }
165
149
166
    setMIMEDescription(mimeDescription, plugin);
150
    setMIMEDescription(mimeDescription, plugin);
167
151
152
    return true;
153
}
154
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
155
{
156
    // Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
157
    // is leaked to layout test output.
158
    StdoutDevNullRedirector stdoutDevNullRedirector;
159
160
    // We are loading the plugin here since it does not seem to be a standardized way to
161
    // get the needed informations from a UNIX plugin without loading it.
162
    RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
163
    if (!pluginModule)
164
        return false;
165
166
    pluginModule->incrementLoadCount();
167
    bool returnValue = pluginModule->pluginInfo(plugin);
168
    pluginModule->decrementLoadCount();
168
    pluginModule->decrementLoadCount();
169
169
170
    return true;
170
    return returnValue;
171
}
171
}
172
172
173
void NetscapePluginModule::determineQuirks()
173
void NetscapePluginModule::determineQuirks()

Return to Bug 69139