Title: [96400] trunk/Source/WebKit2
Revision
96400
Author
carlo...@webkit.org
Date
2011-09-30 07:23:43 -0700 (Fri, 30 Sep 2011)

Log Message

[UNIX] Add a method to get information for an already loaded plugin module
https://bugs.webkit.org/show_bug.cgi?id=69139

Reviewed by Martin Robinson.

* Shared/Plugins/Netscape/NetscapePluginModule.h: Add pluginInfo().
* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::NetscapePluginModule::pluginInfo): Private method to get
the plugin information from the module, it must be called when the
module has been already initialized.
(WebKit::NetscapePluginModule::getPluginInfo): Use pluginInfo() to
get information of the plugin module for the given path.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (96399 => 96400)


--- trunk/Source/WebKit2/ChangeLog	2011-09-30 11:58:30 UTC (rev 96399)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-30 14:23:43 UTC (rev 96400)
@@ -1,3 +1,18 @@
+2011-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [UNIX] Add a method to get information for an already loaded plugin module
+        https://bugs.webkit.org/show_bug.cgi?id=69139
+
+        Reviewed by Martin Robinson.
+
+        * Shared/Plugins/Netscape/NetscapePluginModule.h: Add pluginInfo().
+        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+        (WebKit::NetscapePluginModule::pluginInfo): Private method to get
+        the plugin information from the module, it must be called when the
+        module has been already initialized.
+        (WebKit::NetscapePluginModule::getPluginInfo): Use pluginInfo() to
+        get information of the plugin module for the given path.
+
 2011-09-30  Zeno Albisser  <zeno.albis...@nokia.com>
 
         [Qt][WK2] Event delivery in QDesktopWebView is broken after merge of Qt5 refactor

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h (96399 => 96400)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h	2011-09-30 11:58:30 UTC (rev 96399)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h	2011-09-30 14:23:43 UTC (rev 96400)
@@ -69,6 +69,7 @@
 #if PLUGIN_ARCHITECTURE(X11)
     void applyX11QuirksBeforeLoad();
     static void setMIMEDescription(const String& mimeDescription, PluginModuleInfo&);
+    bool pluginInfo(PluginModuleInfo&);
 #endif
 
     bool tryGetSitesWithData(Vector<String>&);

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp (96399 => 96400)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2011-09-30 11:58:30 UTC (rev 96399)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2011-09-30 14:23:43 UTC (rev 96400)
@@ -118,35 +118,21 @@
     }
 }
 
-bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
+bool NetscapePluginModule::pluginInfo(PluginModuleInfo& plugin)
 {
-    // Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
-    // is leaked to layout test output.
-    StdoutDevNullRedirector stdoutDevNullRedirector;
+    ASSERT(m_isInitialized);
 
-    // We are loading the plugin here since it does not seem to be a standardized way to
-    // get the needed informations from a UNIX plugin without loading it.
-    RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
-    if (!pluginModule)
-        return false;
+    plugin.path = m_pluginPath;
+    plugin.info.file = pathGetFileName(m_pluginPath);
 
-    pluginModule->incrementLoadCount();
-
-    plugin.path = pluginPath;
-    plugin.info.file = pathGetFileName(pluginPath);
-
-    Module* module = pluginModule->module();
+    Module* module = m_module.get();
     NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
-    if (!NPP_GetValue) {
-        pluginModule->decrementLoadCount();
+    if (!NPP_GetValue)
         return false;
-    }
 
     NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
-    if (!NP_GetMIMEDescription) {
-        pluginModule->decrementLoadCount();
+    if (!NP_GetMIMEDescription)
         return false;
-    }
 
     char* buffer;
     NPError error = NPP_GetValue(0, NPPVpluginNameString, &buffer);
@@ -158,16 +144,30 @@
         plugin.info.desc = buffer;
 
     const char* mimeDescription = NP_GetMIMEDescription();
-    if (!mimeDescription) {
-        pluginModule->decrementLoadCount();
+    if (!mimeDescription)
         return false;
-    }
 
     setMIMEDescription(mimeDescription, plugin);
 
+    return true;
+}
+bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
+{
+    // Tempararily suppress stdout in this function as plugins will be loaded and shutdown and debug info
+    // is leaked to layout test output.
+    StdoutDevNullRedirector stdoutDevNullRedirector;
+
+    // We are loading the plugin here since it does not seem to be a standardized way to
+    // get the needed informations from a UNIX plugin without loading it.
+    RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath);
+    if (!pluginModule)
+        return false;
+
+    pluginModule->incrementLoadCount();
+    bool returnValue = pluginModule->pluginInfo(plugin);
     pluginModule->decrementLoadCount();
 
-    return true;
+    return returnValue;
 }
 
 void NetscapePluginModule::determineQuirks()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to