case NPNVWindowNPObject: { *(NPObject **)result = _getwindowobject(npp);  return NPERR_NO_ERROR; }  case NPNVPluginElementNPObject: { *(NPObject **)result = _getpluginelement(npp);  return NPERR_NO_ERROR; }
_getvalue(NPP npp, NPNVariable variable, void *result){  NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetValue: npp=%p, var=%d\n", (void*)npp, (int)variable));  nsresult res;  switch(variable) {#if defined(XP_UNIX) && !defined(XP_MACOSX)  case NPNVxDisplay : {#ifdef MOZ_WIDGET_GTK2    if(npp) {      ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;      NPBool rtv = PR_FALSE;      inst->GetValue((nsPluginInstanceVariable)NPPVpluginNeedsXEmbed, &rtv);      if(rtv) {        (*(Display **)result) = GDK_DISPLAY();        return NPERR_NO_ERROR;      }    }#endif#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)    // 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(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;#endif#if defined(XP_WIN) || defined(XP_OS2)  case NPNVnetscapeWindow: {    if (!npp || !npp->ndata)      return NPERR_INVALID_INSTANCE_ERROR;    ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;    nsCOMPtr<nsIPluginInstancePeer> peer;    if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) &&        peer &&         NS_SUCCEEDED(peer->GetValue(nsPluginInstancePeerVariable_NetscapeWindow, result)))    {      return NPERR_NO_ERROR;    }    return NPERR_GENERIC_ERROR;  }#endif  case NPNVjavascriptEnabledBool: {    *(NPBool*)result = PR_FALSE;     nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));    if(prefs) {      PRBool js = PR_FALSE;;      res = prefs->GetBoolPref("javascript.enabled", &js);      if(NS_SUCCEEDED(res))        *(NPBool*)result = js;     }    return NPERR_NO_ERROR;  }  case NPNVasdEnabledBool:     *(NPBool*)result = FALSE;     return NPERR_NO_ERROR;  case NPNVisOfflineBool:     *(NPBool*)result = FALSE;     return NPERR_NO_ERROR;  case NPNVserviceManager: {    nsIServiceManager * sm;    res = NS_GetServiceManager(&sm);    if (NS_SUCCEEDED(res)) {      *(nsIServiceManager**)result = sm;      return NPERR_NO_ERROR;    } else      return NPERR_GENERIC_ERROR;  }  case NPNVDOMElement: {    ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;    NS_ENSURE_TRUE(inst, NPERR_GENERIC_ERROR);    nsCOMPtr<nsIPluginInstancePeer> pip;    inst->GetPeer(getter_AddRefs(pip));    nsCOMPtr<nsIPluginTagInfo2> pti2 (do_QueryInterface(pip));    if (pti2) {      nsCOMPtr<nsIDOMElement> e;      pti2->GetDOMElement(getter_AddRefs(e));      if (e) {        NS_ADDREF(*(nsIDOMElement**)result = e.get());        return NPERR_NO_ERROR;      }    }    return NPERR_GENERIC_ERROR;  }  case NPNVDOMWindow: {    ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;    NS_ENSURE_TRUE(inst, NPERR_GENERIC_ERROR);    nsCOMPtr<nsIPluginInstancePeer> pip;    inst->GetPeer(getter_AddRefs(pip));    nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(pip));    if (pp) {      nsCOMPtr<nsIPluginInstanceOwner> owner;      pp->GetOwner(getter_AddRefs(owner));      if (owner) {        nsCOMPtr<nsIDocument> doc;        owner->GetDocument(getter_AddRefs(doc));        if (doc) {          nsCOMPtr<nsIDOMWindow> domWindow (do_QueryInterface(doc->GetScriptGlobalObject()));          if (domWindow) {            NS_ADDREF(*(nsIDOMWindow**)result = domWindow.get());            return NPERR_NO_ERROR;          }        }      }    }    return NPERR_GENERIC_ERROR;  }  case NPNVToolkit: {#ifdef MOZ_WIDGET_GTK    *((NPNToolkitType*)result) = NPNVGtk12;#endif#ifdef MOZ_WIDGET_GTK2    *((NPNToolkitType*)result) = NPNVGtk2;#endif    if (result)        return NPERR_NO_ERROR;    return NPERR_GENERIC_ERROR;  }  case NPNVSupportsXEmbedBool: {#ifdef MOZ_WIDGET_GTK2    *(NPBool*)result = PR_TRUE; #else    *(NPBool*)result = PR_FALSE; #endif    return NPERR_NO_ERROR;  }  default : return NPERR_GENERIC_ERROR;  }}