зеркало из https://github.com/mozilla/pjs.git
fix for 74938; acrobat fails on plugin registration on Linux; r=av; sr=waterson
This commit is contained in:
Родитель
1c8b45f751
Коммит
826fcb6c8c
|
@ -39,6 +39,12 @@
|
|||
#include <Resources.h>
|
||||
#endif
|
||||
|
||||
//needed for nppdf plugin
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gtkxtbin.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// CID's && IID's
|
||||
|
@ -235,6 +241,9 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
|||
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
if (!aFileName) //do not call NP_Initialize in this case, bug 74938
|
||||
return NS_OK;
|
||||
|
||||
// we must init here because the plugin may call NPN functions
|
||||
// when we call into the NP_Initialize entry point - NPN functions
|
||||
// require that mBrowserManager be set up
|
||||
|
@ -1032,13 +1041,24 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
|
||||
nsresult res;
|
||||
|
||||
if(!npp || !npp->ndata)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
|
||||
switch(variable) {
|
||||
#ifdef XP_UNIX
|
||||
case NPNVxDisplay:
|
||||
case NPNVxDisplay : {
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// adobe nppdf calls XtGetApplicationNameAndClass(display, &instance, &class)
|
||||
// we have to init Xt toolkit before get XtDisplay
|
||||
// just call gtk_xtbin_new(w,0) once
|
||||
static GtkWidget *gtkXtBinHolder = 0;
|
||||
if (!gtkXtBinHolder) {
|
||||
gtkXtBinHolder = gtk_xtbin_new((GdkWindow*)&gdk_root_parent,0);
|
||||
// it crashes on destroy, let it leak
|
||||
// gtk_widget_destroy(gtkXtBinHolder);
|
||||
}
|
||||
(*(Display **)result) = GTK_XTBIN(gtkXtBinHolder)->xtdisplay;
|
||||
return NPERR_NO_ERROR;
|
||||
#endif
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
case NPNVxtAppContext:
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
@ -1046,6 +1066,9 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
|
||||
#ifdef XP_PC
|
||||
case NPNVnetscapeWindow: {
|
||||
if (!npp || !npp->ndata)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
|
||||
ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;
|
||||
nsIPluginInstancePeer *peer;
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
|
|||
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
{
|
||||
nsresult rv;
|
||||
const char* mimedescr, *name, *description;
|
||||
const char* mimedescr = 0, *name = 0, *description = 0;
|
||||
char *mdesc,*start,*nexttoc,*mtype,*exten,*descr;
|
||||
int i,num;
|
||||
|
||||
|
@ -422,20 +422,23 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
|||
plugin = do_QueryInterface(factory);
|
||||
} else {
|
||||
// It's old sk00l
|
||||
rv = ns4xPlugin::CreatePlugin(mgr, this->GetCString(), pLibrary,
|
||||
// if fileName parameter == 0 ns4xPlugin::CreatePlugin() will not call NP_Initialize()
|
||||
rv = ns4xPlugin::CreatePlugin(mgr, 0, pLibrary,
|
||||
getter_AddRefs(plugin));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (plugin) {
|
||||
info.fFileName = PL_strdup(this->GetCString());
|
||||
plugin->GetValue(nsPluginVariable_NameString, &name);
|
||||
if (!name)
|
||||
name = PL_strrchr(info.fFileName, '/') + 1;
|
||||
info.fName = PL_strdup(name);
|
||||
|
||||
plugin->GetValue(nsPluginVariable_DescriptionString, &description);
|
||||
if (!description)
|
||||
description = "";
|
||||
info.fDescription = PL_strdup(description);
|
||||
|
||||
info.fFileName = PL_strdup(this->GetCString());
|
||||
|
||||
plugin->GetMIMEDescription(&mimedescr);
|
||||
} else {
|
||||
info.fName = PL_strdup(this->GetCString());
|
||||
|
|
Загрузка…
Ссылка в новой задаче