Fixing bug 366082. Prevent Adobe Acrobat from loading URLs other than http:, https:, or ftp: w/o specifying a target. r+sr=dveditz@cruzio.com

This commit is contained in:
jst%mozilla.org 2007-01-28 19:50:37 +00:00
Родитель 549e162c3d
Коммит ae1ec84843
3 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -975,6 +975,21 @@ _geturl(NPP npp, const char* relativeURL, const char* target)
("NPN_GetURL: npp=%p, target=%s, url=%s\n", (void *)npp, target,
relativeURL));
// Block Adobe Acrobat from loading URLs that are not http:, https:,
// or ftp: URLs if the given target is null.
if (target == nsnull && relativeURL &&
(strncmp(relativeURL, "http:", 5) != 0) &&
(strncmp(relativeURL, "https:", 6) != 0) &&
(strncmp(relativeURL, "ftp:", 4) != 0)) {
ns4xPluginInstance *inst = (ns4xPluginInstance *) npp->ndata;
const char *name = nsPluginHostImpl::GetPluginName(inst);
if (name && strstr(name, "Adobe") && strstr(name, "Acrobat")) {
return NPERR_NO_ERROR;
}
}
return MakeNew4xStreamInternal (npp, relativeURL, target,
eNPPStreamTypeInternal_Get);
}

Просмотреть файл

@ -2566,6 +2566,20 @@ nsPluginHostImpl::GetInst()
return sInst;
}
// static
const char *
nsPluginHostImpl::GetPluginName(nsIPluginInstance *aPluginInstance)
{
nsActivePlugin *plugin =
gActivePluginList ? gActivePluginList->find(aPluginInstance) : nsnull;
if (plugin && plugin->mPluginTag) {
return plugin->mPluginTag->mName;
}
return nsnull;
}
////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsPluginHostImpl::GetValue(nsPluginManagerVariable aVariable, void *aValue)
@ -6699,7 +6713,7 @@ nsresult nsPluginHostImpl::AddPrefObserver()
////////////////////////////////////////////////////////////////////////////////////
nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
nsISupports* aContext)
nsISupports* aContext)
{
if (!mInstance)
return NS_ERROR_FAILURE;

Просмотреть файл

@ -213,6 +213,8 @@ public:
NS_DECL_ISUPPORTS
static const char *GetPluginName(nsIPluginInstance *aPluginInstance);
//nsIPluginManager interface - the main interface nsIPlugin communicates to
NS_IMETHOD