Closed Bug 546015 Opened 15 years ago Closed 8 years ago

SDK Sample Code uses NPN_GetValue with NPNVServiceManager which was removed

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: khuey, Unassigned)

Details

Per Bug 545224, the sample code for plugins needs to be updated to not use functionality removed in Bug 500513.
I'm curious as to see the correct way to do this now that NPNVserviceManager is no longer retrievable via NPN_GetValue. Also I would like to see a recommendation on how to do this with using loose binding to XPCOM. Currently in my plugin code I need to use NS_GetServiceManager to get the service manager but if I use -z defs to compile the plugin I must specify -lxpcom to the linker. Which can cause problems if different browsers on the system are linked to different xpcoms.
You should not use XPCOM. To provide plugin scriptability you should use NPRuntime, a cross-browser plugin scripting API. See https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins
How do you suggest getting the Service Manager... I ended up doing something like this so that the code could run on Firefox 3.6, 3.5 and Opera... void (*get_sm)(nsIServiceManager**); get_sm = (void (*)(nsIServiceManager**))dlsym(RTLD_DEFAULT,"NS_GetServiceManager"); if (get_sm) { (*get_sm)(&sm); } else { NPN_GetValue(NULL, NPNVserviceManager, &sm); } Really really gross, but it works. I did not want to use XPCOM, but the only way to get to the service manager to change the user agent is to use the above code. Also the sample code in MDC still doesn't work.
Resolving old bugs which are likely not relevant any more, since NPAPI plugins are deprecated.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.