mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 13:25:00 +00:00
Fix for Shockwave registration bug 85334 r=av sr=attinasi
This commit is contained in:
parent
0dbb5635b5
commit
d768cc430c
@ -67,6 +67,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIPrintContext.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
// headers for plugin scriptability
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
@ -422,6 +423,24 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
|
||||
mPresContext = aPresContext; // weak ref
|
||||
|
||||
// This is way of ensure the previous document is gone. Important when reloading either
|
||||
// the page or refreshing plugins. In the case of an OBJECT frame,
|
||||
// we want to flush out the prevous content viewer which will cause the previous document
|
||||
// and plugins to be cleaned up. Then we can create our new plugin without the old instance
|
||||
// hanging around.
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PRBool bImage = PR_FALSE;
|
||||
|
||||
//Ideally should be call to imlib, when it is available
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIPrintContext.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
// headers for plugin scriptability
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
@ -422,6 +423,24 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
||||
|
||||
mPresContext = aPresContext; // weak ref
|
||||
|
||||
// This is way of ensure the previous document is gone. Important when reloading either
|
||||
// the page or refreshing plugins. In the case of an OBJECT frame,
|
||||
// we want to flush out the prevous content viewer which will cause the previous document
|
||||
// and plugins to be cleaned up. Then we can create our new plugin without the old instance
|
||||
// hanging around.
|
||||
nsCOMPtr<nsISupports> container;
|
||||
mPresContext->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> cvc(do_QueryInterface(container));
|
||||
if (cvc) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
cvc->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv)
|
||||
cv->SetPreviousViewer(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PRBool bImage = PR_FALSE;
|
||||
|
||||
//Ideally should be call to imlib, when it is available
|
||||
|
@ -108,12 +108,64 @@ static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
|
||||
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, PRLibrary* aLibrary, NP_PLUGINSHUTDOWN aShutdown, nsIServiceManager* serviceMgr)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
gServiceMgr = serviceMgr;
|
||||
fLibrary = nsnull;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// On Windows (and Mac) we need to keep a direct reference to the fCallbacks and NOT
|
||||
// just copy the struct. See Bugzilla 85334
|
||||
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
|
||||
|
||||
if (!pfnGetEntryPoints)
|
||||
{
|
||||
NS_ASSERTION(pfnGetEntryPoints, "failed to get entry points");
|
||||
return;
|
||||
}
|
||||
|
||||
memset((void*) &fCallbacks, 0, sizeof(fCallbacks));
|
||||
|
||||
fCallbacks.size = sizeof(fCallbacks);
|
||||
|
||||
nsresult result = pfnGetEntryPoints(&fCallbacks);
|
||||
NS_ASSERTION( NS_OK == result,"Failed to get callbacks");
|
||||
|
||||
NS_ASSERTION(HIBYTE(fCallbacks.version) >= NP_VERSION_MAJOR,
|
||||
"callback version is less than NP version");
|
||||
|
||||
fShutdownEntry = (NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
|
||||
#elif defined(XP_MAC)
|
||||
// get the main entry point
|
||||
#if TARGET_CARBON
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main");
|
||||
#else
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD");
|
||||
#endif
|
||||
|
||||
if(pfnMain == NULL)
|
||||
{
|
||||
NS_ASSERTION(pfnMain, "failed to get entry points");
|
||||
return;
|
||||
}
|
||||
|
||||
// call into the entry point
|
||||
NPError error;
|
||||
NS_TRY_SAFE_CALL_RETURN(error, CallNPP_MainEntryProc(pfnMain,
|
||||
&(ns4xPlugin::CALLBACKS),
|
||||
&fCallbacks,
|
||||
&fShutdownEntry), aLibrary);
|
||||
|
||||
if(error != NPERR_NO_ERROR || ((fCallbacks.version >> 8) < NP_VERSION_MAJOR))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else // for everyone else
|
||||
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
|
||||
fShutdownEntry = aShutdown;
|
||||
|
||||
fLibrary = aLibrary;
|
||||
gServiceMgr = serviceMgr;
|
||||
#endif
|
||||
|
||||
fLibrary = aLibrary;
|
||||
}
|
||||
|
||||
|
||||
@ -253,8 +305,9 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
memcpy((void*) &(plptr->fCallbacks), (void*)&callbacks, sizeof(callbacks));
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
// XXX this only applies on Windows
|
||||
#if defined(XP_PC) && !defined(XP_WIN)
|
||||
// XXX this probably should be factored out and
|
||||
// just use trailing XP_WIN.
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
|
||||
|
||||
@ -269,17 +322,20 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
if (pfnGetEntryPoints(&callbacks) != NS_OK)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
#ifdef XP_PC // XXX This is really XP, but we need to figure out how to do HIBYTE()
|
||||
if (HIBYTE(callbacks.version) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
NP_PLUGINSHUTDOWN pfnShutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
|
||||
|
||||
// create the new plugin handler
|
||||
// create the new plugin handler
|
||||
*aResult = new ns4xPlugin(&callbacks, aLibrary, pfnShutdown, aServiceMgr);
|
||||
|
||||
#elif defined(XP_WIN)
|
||||
// Note: on Windows, we must use the fCallback because plugins may change
|
||||
// the function table. The Shockwave installer makes changes in the table while running
|
||||
*aResult = new ns4xPlugin(nsnull, aLibrary, nsnull, aServiceMgr);
|
||||
#endif
|
||||
#ifdef XP_PC
|
||||
if (*aResult == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -311,26 +367,11 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#if TARGET_CARBON
|
||||
// get the main entry point
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main");
|
||||
#else
|
||||
// get the mainRD entry point
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD");
|
||||
#endif
|
||||
if(pfnMain == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NPP_ShutdownUPP pfnShutdown;
|
||||
NPPluginFuncs callbacks;
|
||||
memset((void*) &callbacks, 0, sizeof(callbacks));
|
||||
callbacks.size = sizeof(callbacks);
|
||||
#if defined(XP_MAC)
|
||||
nsPluginsDir pluginsDir(PLUGINS_DIR_LOCATION_MAC_SYSTEM_PLUGINS_FOLDER);
|
||||
if(!pluginsDir.Valid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPluginsDir pluginsDir(PLUGINS_DIR_LOCATION_MAC_SYSTEM_PLUGINS_FOLDER);
|
||||
if(!pluginsDir.Valid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
short appRefNum = ::CurResFile();
|
||||
short pluginRefNum;
|
||||
Boolean found = false;
|
||||
@ -374,28 +415,14 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
}
|
||||
|
||||
|
||||
// call into the entry point
|
||||
NPError error;
|
||||
NS_TRY_SAFE_CALL_RETURN(error, CallNPP_MainEntryProc(pfnMain,
|
||||
&(ns4xPlugin::CALLBACKS),
|
||||
&callbacks,
|
||||
&pfnShutdown), fLibrary);
|
||||
if(error != NPERR_NO_ERROR)
|
||||
return NS_ERROR_FAILURE;
|
||||
ns4xPlugin* plugin = new ns4xPlugin(nsnull, aLibrary, nsnull, aServiceMgr);
|
||||
if(plugin == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
::UseResFile(appRefNum);
|
||||
|
||||
::UseResFile(appRefNum);
|
||||
plugin->SetPluginRefNum(pluginRefNum);
|
||||
|
||||
if ((callbacks.version >> 8) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// create the new plugin handler
|
||||
ns4xPlugin* plugin = new ns4xPlugin(&callbacks, aLibrary, (NP_PLUGINSHUTDOWN)pfnShutdown, aServiceMgr);
|
||||
|
||||
if(plugin == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
plugin->SetPluginRefNum(pluginRefNum);
|
||||
|
||||
*aResult = plugin;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -213,6 +213,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
// if WriteReady returned 0, the plugin is not ready to handle
|
||||
// the data, return FAILURE for now
|
||||
if (numtowrite <= 0) {
|
||||
NS_ASSERTION(numtowrite,"WriteReady returned Zero");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
@ -242,8 +243,10 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
goto error;
|
||||
}
|
||||
|
||||
amountRead -= numtowrite;
|
||||
mPosition += numtowrite;
|
||||
amountRead -= writeCount;
|
||||
mPosition += writeCount;
|
||||
if (amountRead > 0)
|
||||
strncpy(mStreamBuffer,mStreamBuffer+writeCount,amountRead);
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,8 +474,12 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// check to see if we have a call back
|
||||
if (callbacks->urlnotify != NULL && mNotifyData != nsnull)
|
||||
// check to see if we have a call back and a
|
||||
// XXX nasty hack for Shockwave Registration.
|
||||
// we seem to crash doing URLNotify so just always exclude it.
|
||||
// See bug 85334.
|
||||
if (callbacks->urlnotify != NULL && mNotifyData != nsnull &&
|
||||
strcmp(mNPStream.url,"http://pinger.macromedia.com") < 0 )
|
||||
{
|
||||
PRLibrary* lib = nsnull;
|
||||
lib = mInst->fLibrary;
|
||||
|
@ -1644,7 +1644,8 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aCo
|
||||
if (NS_FAILED(rv)) {
|
||||
// The channel doesn't want to do our bidding, lets cache it to disk ourselves
|
||||
rv = SetupPluginCacheFile(channel);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "No Cache Aval. Some plugins wont work.");
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("No Cache Aval. Some plugins wont work OR we don't have a URL");
|
||||
}
|
||||
|
||||
char* aContentType = nsnull;
|
||||
@ -2076,17 +2077,6 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
|
||||
rv = mPStreamListener->OnStartBinding((nsIPluginStreamInfo*)mPluginStreamInfo);
|
||||
|
||||
mStartBinding = PR_TRUE;
|
||||
|
||||
if(rv == NS_OK)
|
||||
{
|
||||
mPStreamListener->GetStreamType(&mStreamType);
|
||||
// check to see if we need to cache the file as well
|
||||
if ((mStreamType == nsPluginStreamType_AsFile) ||
|
||||
(mStreamType == nsPluginStreamType_AsFileOnly))
|
||||
// wtf does this do?!
|
||||
rv = SetUpCache(aURL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,64 @@ static NS_DEFINE_IID(kIPluginStreamListenerIID, NS_IPLUGINSTREAMLISTENER_IID);
|
||||
ns4xPlugin::ns4xPlugin(NPPluginFuncs* callbacks, PRLibrary* aLibrary, NP_PLUGINSHUTDOWN aShutdown, nsIServiceManager* serviceMgr)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
gServiceMgr = serviceMgr;
|
||||
fLibrary = nsnull;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// On Windows (and Mac) we need to keep a direct reference to the fCallbacks and NOT
|
||||
// just copy the struct. See Bugzilla 85334
|
||||
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
|
||||
|
||||
if (!pfnGetEntryPoints)
|
||||
{
|
||||
NS_ASSERTION(pfnGetEntryPoints, "failed to get entry points");
|
||||
return;
|
||||
}
|
||||
|
||||
memset((void*) &fCallbacks, 0, sizeof(fCallbacks));
|
||||
|
||||
fCallbacks.size = sizeof(fCallbacks);
|
||||
|
||||
nsresult result = pfnGetEntryPoints(&fCallbacks);
|
||||
NS_ASSERTION( NS_OK == result,"Failed to get callbacks");
|
||||
|
||||
NS_ASSERTION(HIBYTE(fCallbacks.version) >= NP_VERSION_MAJOR,
|
||||
"callback version is less than NP version");
|
||||
|
||||
fShutdownEntry = (NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
|
||||
#elif defined(XP_MAC)
|
||||
// get the main entry point
|
||||
#if TARGET_CARBON
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main");
|
||||
#else
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD");
|
||||
#endif
|
||||
|
||||
if(pfnMain == NULL)
|
||||
{
|
||||
NS_ASSERTION(pfnMain, "failed to get entry points");
|
||||
return;
|
||||
}
|
||||
|
||||
// call into the entry point
|
||||
NPError error;
|
||||
NS_TRY_SAFE_CALL_RETURN(error, CallNPP_MainEntryProc(pfnMain,
|
||||
&(ns4xPlugin::CALLBACKS),
|
||||
&fCallbacks,
|
||||
&fShutdownEntry), aLibrary);
|
||||
|
||||
if(error != NPERR_NO_ERROR || ((fCallbacks.version >> 8) < NP_VERSION_MAJOR))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#else // for everyone else
|
||||
memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
|
||||
fShutdownEntry = aShutdown;
|
||||
|
||||
fLibrary = aLibrary;
|
||||
gServiceMgr = serviceMgr;
|
||||
#endif
|
||||
|
||||
fLibrary = aLibrary;
|
||||
}
|
||||
|
||||
|
||||
@ -253,8 +305,9 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
memcpy((void*) &(plptr->fCallbacks), (void*)&callbacks, sizeof(callbacks));
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
// XXX this only applies on Windows
|
||||
#if defined(XP_PC) && !defined(XP_WIN)
|
||||
// XXX this probably should be factored out and
|
||||
// just use trailing XP_WIN.
|
||||
NP_GETENTRYPOINTS pfnGetEntryPoints =
|
||||
(NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
|
||||
|
||||
@ -269,17 +322,20 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
if (pfnGetEntryPoints(&callbacks) != NS_OK)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
#ifdef XP_PC // XXX This is really XP, but we need to figure out how to do HIBYTE()
|
||||
if (HIBYTE(callbacks.version) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
NP_PLUGINSHUTDOWN pfnShutdown =
|
||||
(NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
|
||||
|
||||
// create the new plugin handler
|
||||
// create the new plugin handler
|
||||
*aResult = new ns4xPlugin(&callbacks, aLibrary, pfnShutdown, aServiceMgr);
|
||||
|
||||
#elif defined(XP_WIN)
|
||||
// Note: on Windows, we must use the fCallback because plugins may change
|
||||
// the function table. The Shockwave installer makes changes in the table while running
|
||||
*aResult = new ns4xPlugin(nsnull, aLibrary, nsnull, aServiceMgr);
|
||||
#endif
|
||||
#ifdef XP_PC
|
||||
if (*aResult == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -311,26 +367,11 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
#endif
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#if TARGET_CARBON
|
||||
// get the main entry point
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "main");
|
||||
#else
|
||||
// get the mainRD entry point
|
||||
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(aLibrary, "mainRD");
|
||||
#endif
|
||||
if(pfnMain == NULL)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NPP_ShutdownUPP pfnShutdown;
|
||||
NPPluginFuncs callbacks;
|
||||
memset((void*) &callbacks, 0, sizeof(callbacks));
|
||||
callbacks.size = sizeof(callbacks);
|
||||
#if defined(XP_MAC)
|
||||
nsPluginsDir pluginsDir(PLUGINS_DIR_LOCATION_MAC_SYSTEM_PLUGINS_FOLDER);
|
||||
if(!pluginsDir.Valid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPluginsDir pluginsDir(PLUGINS_DIR_LOCATION_MAC_SYSTEM_PLUGINS_FOLDER);
|
||||
if(!pluginsDir.Valid())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
short appRefNum = ::CurResFile();
|
||||
short pluginRefNum;
|
||||
Boolean found = false;
|
||||
@ -374,28 +415,14 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr,
|
||||
}
|
||||
|
||||
|
||||
// call into the entry point
|
||||
NPError error;
|
||||
NS_TRY_SAFE_CALL_RETURN(error, CallNPP_MainEntryProc(pfnMain,
|
||||
&(ns4xPlugin::CALLBACKS),
|
||||
&callbacks,
|
||||
&pfnShutdown), fLibrary);
|
||||
if(error != NPERR_NO_ERROR)
|
||||
return NS_ERROR_FAILURE;
|
||||
ns4xPlugin* plugin = new ns4xPlugin(nsnull, aLibrary, nsnull, aServiceMgr);
|
||||
if(plugin == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
::UseResFile(appRefNum);
|
||||
|
||||
::UseResFile(appRefNum);
|
||||
plugin->SetPluginRefNum(pluginRefNum);
|
||||
|
||||
if ((callbacks.version >> 8) < NP_VERSION_MAJOR)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// create the new plugin handler
|
||||
ns4xPlugin* plugin = new ns4xPlugin(&callbacks, aLibrary, (NP_PLUGINSHUTDOWN)pfnShutdown, aServiceMgr);
|
||||
|
||||
if(plugin == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
plugin->SetPluginRefNum(pluginRefNum);
|
||||
|
||||
*aResult = plugin;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -213,6 +213,7 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
// if WriteReady returned 0, the plugin is not ready to handle
|
||||
// the data, return FAILURE for now
|
||||
if (numtowrite <= 0) {
|
||||
NS_ASSERTION(numtowrite,"WriteReady returned Zero");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
goto error;
|
||||
}
|
||||
@ -242,8 +243,10 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
goto error;
|
||||
}
|
||||
|
||||
amountRead -= numtowrite;
|
||||
mPosition += numtowrite;
|
||||
amountRead -= writeCount;
|
||||
mPosition += writeCount;
|
||||
if (amountRead > 0)
|
||||
strncpy(mStreamBuffer,mStreamBuffer+writeCount,amountRead);
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,8 +474,12 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// check to see if we have a call back
|
||||
if (callbacks->urlnotify != NULL && mNotifyData != nsnull)
|
||||
// check to see if we have a call back and a
|
||||
// XXX nasty hack for Shockwave Registration.
|
||||
// we seem to crash doing URLNotify so just always exclude it.
|
||||
// See bug 85334.
|
||||
if (callbacks->urlnotify != NULL && mNotifyData != nsnull &&
|
||||
strcmp(mNPStream.url,"http://pinger.macromedia.com") < 0 )
|
||||
{
|
||||
PRLibrary* lib = nsnull;
|
||||
lib = mInst->fLibrary;
|
||||
|
@ -1644,7 +1644,8 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, nsISupports* aCo
|
||||
if (NS_FAILED(rv)) {
|
||||
// The channel doesn't want to do our bidding, lets cache it to disk ourselves
|
||||
rv = SetupPluginCacheFile(channel);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "No Cache Aval. Some plugins wont work.");
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("No Cache Aval. Some plugins wont work OR we don't have a URL");
|
||||
}
|
||||
|
||||
char* aContentType = nsnull;
|
||||
@ -2076,17 +2077,6 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
|
||||
rv = mPStreamListener->OnStartBinding((nsIPluginStreamInfo*)mPluginStreamInfo);
|
||||
|
||||
mStartBinding = PR_TRUE;
|
||||
|
||||
if(rv == NS_OK)
|
||||
{
|
||||
mPStreamListener->GetStreamType(&mStreamType);
|
||||
// check to see if we need to cache the file as well
|
||||
if ((mStreamType == nsPluginStreamType_AsFile) ||
|
||||
(mStreamType == nsPluginStreamType_AsFileOnly))
|
||||
// wtf does this do?!
|
||||
rv = SetUpCache(aURL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user