Bug 1136930: Hook PluginAsyncSurrogate into NPP_DestroyStream; r=jimm
This commit is contained in:
@@ -172,11 +172,11 @@ PluginAsyncSurrogate::NP_GetEntryPoints(NPPluginFuncs* aFuncs)
|
||||
aFuncs->setwindow = &NPP_SetWindow;
|
||||
aFuncs->writeready = &NPP_WriteReady;
|
||||
aFuncs->event = &NPP_HandleEvent;
|
||||
aFuncs->destroystream = &NPP_DestroyStream;
|
||||
// We need to set these so that content code doesn't make assumptions
|
||||
// about these operations not being supported
|
||||
aFuncs->write = &PluginModuleParent::NPP_Write;
|
||||
aFuncs->asfile = &PluginModuleParent::NPP_StreamAsFile;
|
||||
aFuncs->destroystream = &PluginModuleParent::NPP_DestroyStream;
|
||||
}
|
||||
|
||||
NPError
|
||||
@@ -267,6 +267,19 @@ PluginAsyncSurrogate::NPP_WriteReady(NPStream* aStream)
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPError
|
||||
PluginAsyncSurrogate::NPP_DestroyStream(NPStream* aStream, NPReason aReason)
|
||||
{
|
||||
for (uint32_t idx = 0, len = mPendingNewStreamCalls.Length(); idx < len; ++idx) {
|
||||
PendingNewStreamCall& curPendingCall = mPendingNewStreamCalls[idx];
|
||||
if (curPendingCall.mStream == aStream) {
|
||||
mPendingNewStreamCalls.RemoveElementAt(idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
/* static */ NPError
|
||||
PluginAsyncSurrogate::NPP_Destroy(NPP aInstance, NPSavedData** aSave)
|
||||
{
|
||||
@@ -350,6 +363,16 @@ PluginAsyncSurrogate::NPP_WriteReady(NPP aInstance, NPStream* aStream)
|
||||
return surrogate->NPP_WriteReady(aStream);
|
||||
}
|
||||
|
||||
/* static */ NPError
|
||||
PluginAsyncSurrogate::NPP_DestroyStream(NPP aInstance,
|
||||
NPStream* aStream,
|
||||
NPReason aReason)
|
||||
{
|
||||
PluginAsyncSurrogate* surrogate = Cast(aInstance);
|
||||
MOZ_ASSERT(surrogate);
|
||||
return surrogate->NPP_DestroyStream(aStream, aReason);
|
||||
}
|
||||
|
||||
PluginAsyncSurrogate::PendingNewStreamCall::PendingNewStreamCall(
|
||||
NPMIMEType aType, NPStream* aStream, NPBool aSeekable)
|
||||
: mType(NullableString(aType))
|
||||
@@ -403,7 +426,7 @@ PluginAsyncSurrogate::OnInstanceCreated(PluginInstanceParent* aInstance)
|
||||
&streamType);
|
||||
if (curError != NPERR_NO_ERROR) {
|
||||
// If we failed here then the send failed and we need to clean up
|
||||
parent::_destroystream(mInstance, curPendingCall.mStream, NPRES_DONE);
|
||||
DestroyAsyncStream(curPendingCall.mStream);
|
||||
}
|
||||
}
|
||||
mPendingNewStreamCalls.Clear();
|
||||
|
||||
Reference in New Issue
Block a user