Bug 475991: Extend NPAPI to allow plugins to participate in redirect handling. r=bsmedberg a=blocking2.0betaN+

This commit is contained in:
Josh Aas
2011-01-05 14:44:21 -05:00
parent 95b4c5a1e2
commit 198bd2263c
20 changed files with 373 additions and 116 deletions

View File

@@ -396,6 +396,16 @@ PluginModuleParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
aFuncs->urlnotify = NPP_URLNotify;
aFuncs->getvalue = NPP_GetValue;
aFuncs->setvalue = NPP_SetValue;
aFuncs->gotfocus = NULL;
aFuncs->lostfocus = NULL;
aFuncs->urlredirectnotify = NULL;
// Provide 'NPP_URLRedirectNotify' if it is supported by the plugin.
bool urlRedirectSupported = false;
CallURLRedirectNotifySupported(&urlRedirectSupported);
if (urlRedirectSupported) {
aFuncs->urlredirectnotify = NPP_URLRedirectNotify;
}
}
NPError
@@ -558,6 +568,17 @@ PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
return true;
}
void
PluginModuleParent::NPP_URLRedirectNotify(NPP instance, const char* url,
int32_t status, void* notifyData)
{
PluginInstanceParent* i = InstCast(instance);
if (!i)
return;
i->NPP_URLRedirectNotify(url, status, notifyData);
}
bool
PluginModuleParent::AnswerNPN_UserAgent(nsCString* userAgent)
{
@@ -673,6 +694,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
}
SetPluginFuncs(pFuncs);
return NS_OK;
}
#else
@@ -743,8 +765,18 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
{
NS_ASSERTION(pFuncs, "Null pointer!");
// We need to have the child process update its function table
// here by actually calling NP_GetEntryPoints since the parent's
// function table can reflect NULL entries in the child's table.
if (!CallNP_GetEntryPoints(error)) {
return NS_ERROR_FAILURE;
}
else if (*error != NPERR_NO_ERROR) {
return NS_OK;
}
SetPluginFuncs(pFuncs);
*error = NPERR_NO_ERROR;
return NS_OK;
}
#endif