mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
bug 530007: fix crashing edge cases in the hope of getting better diagnostics about failed tests
This commit is contained in:
parent
37505766aa
commit
d6c803e859
@ -141,6 +141,9 @@ PluginModuleParent::NPP_Destroy(NPP instance,
|
||||
PluginInstanceParent* parentInstance =
|
||||
static_cast<PluginInstanceParent*>(instance->pdata);
|
||||
|
||||
if (!parentInstance)
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
parentInstance->Destroy();
|
||||
|
||||
NPError prv;
|
||||
@ -150,8 +153,7 @@ PluginModuleParent::NPP_Destroy(NPP instance,
|
||||
instance->pdata = nsnull;
|
||||
|
||||
return prv;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleParent::EnsureValidNPIdentifier(NPIdentifier aIdentifier)
|
||||
@ -542,6 +544,11 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
names, values, error)) {
|
||||
// |parentInstance| is automatically deleted.
|
||||
instance->pdata = nsnull;
|
||||
// if IPC is down, we'll get an immediate "failed" return, but
|
||||
// without *error being set. So make sure that the error
|
||||
// condition is signaled to nsNPAPIPluginInstance
|
||||
if (NPERR_NO_ERROR == *error)
|
||||
*error = NPERR_GENERIC_ERROR;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -738,8 +738,20 @@ NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
|
||||
|
||||
if (instanceData->streamMode == NP_ASFILE &&
|
||||
instanceData->functionToFail == FUNCTION_NONE) {
|
||||
if (!instanceData->streamBuf) {
|
||||
instanceData->err <<
|
||||
"Error: no data written with NPP_Write";
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
if (!instanceData->fileBuf) {
|
||||
instanceData->err <<
|
||||
"Error: no data written with NPP_StreamAsFile";
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
if (strcmp(reinterpret_cast<char *>(instanceData->fileBuf),
|
||||
reinterpret_cast<char *>(instanceData->streamBuf)) != 0) {
|
||||
reinterpret_cast<char *>(instanceData->streamBuf))) {
|
||||
instanceData->err <<
|
||||
"Error: data passed to NPP_Write and NPP_StreamAsFile differed";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user