Fixing regression bug 241592. Make the default plugin deal with the new fixed plugin streaming code, and make the new streaming code deal with the stream being closed from a Write[Ready] call. r=darin@meer.net, sr=brendan@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@155829 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -508,6 +508,13 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
"return(towrite)=%d, url=%s\n",
|
||||
this, npp, numtowrite, mNPStream.url));
|
||||
|
||||
if (!mStreamStarted) {
|
||||
// The plugin called NPN_DestroyStream() from within
|
||||
// NPP_WriteReady(), kill the stream.
|
||||
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
// if WriteReady returned 0, the plugin is not ready to handle
|
||||
// the data, suspend the stream (if it isn't already
|
||||
// suspended).
|
||||
@@ -544,6 +551,13 @@ ns4xPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo,
|
||||
this, npp, streamPosition, numtowrite,
|
||||
ptrStreamBuffer, writeCount, mNPStream.url));
|
||||
|
||||
if (!mStreamStarted) {
|
||||
// The plugin called NPN_DestroyStream() from within
|
||||
// NPP_WriteReady(), kill the stream.
|
||||
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
if (writeCount > 0) {
|
||||
NS_ASSERTION(writeCount <= mStreamBufferByteCount,
|
||||
"Plugin read past the end of the available data!");
|
||||
@@ -656,9 +670,9 @@ ns4xPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
||||
{
|
||||
StopDataPump();
|
||||
|
||||
if (mIsSuspended && NS_FAILED(status)) {
|
||||
// We're suspended, and the stream was destroyed, or died for some
|
||||
// reason. Make sure we cancel the suspended request.
|
||||
if (NS_FAILED(status)) {
|
||||
// The stream was destroyed, or died for some reason. Make sure we
|
||||
// cancel the underlying request.
|
||||
nsCOMPtr<nsI4xPluginStreamInfo> pluginInfo4x =
|
||||
do_QueryInterface(mStreamInfo);
|
||||
|
||||
|
||||
@@ -252,6 +252,9 @@ NPP_WriteReady(NPP pInstance, NPStream *stream)
|
||||
CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
|
||||
assert(pPlugin != NULL);
|
||||
|
||||
// We don't want any data, kill the stream
|
||||
NPN_DestroyStream(pInstance, stream, NPRES_DONE);
|
||||
|
||||
return -1L; // dont accept any bytes in NPP_Write()
|
||||
}
|
||||
|
||||
@@ -268,6 +271,9 @@ NPP_Write(NPP pInstance, NPStream *stream, int32 offset, int32 len, void *buffer
|
||||
CPlugin * pPlugin = (CPlugin *)pInstance->pdata;
|
||||
assert(pPlugin != NULL);
|
||||
|
||||
// We don't want any data, kill the stream
|
||||
NPN_DestroyStream(pInstance, stream, NPRES_DONE);
|
||||
|
||||
return -1; // tell the browser to abort the stream, don't need it
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user