mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Properly detect failure in receiving plugin NPObjects.
Properly handles NPError reporting and makes sure that, in the case of failure, it does not return junk for the NPObject.
This commit is contained in:
parent
e26dc7595a
commit
db34f0e7be
1 changed files with 8 additions and 5 deletions
|
|
@ -310,9 +310,10 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue,
|
|||
switch (aValue) {
|
||||
case NPNVWindowNPObject:
|
||||
if (!(actor = mCachedWindowActor)) {
|
||||
result = NPERR_GENERIC_ERROR;
|
||||
PPluginScriptableObjectChild* actorProtocol;
|
||||
CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result);
|
||||
if (result == NPERR_NO_ERROR) {
|
||||
if (CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result) &&
|
||||
result == NPERR_NO_ERROR) {
|
||||
actor = mCachedWindowActor =
|
||||
static_cast<PluginScriptableObjectChild*>(actorProtocol);
|
||||
NS_ASSERTION(actor, "Null actor!");
|
||||
|
|
@ -324,10 +325,10 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue,
|
|||
|
||||
case NPNVPluginElementNPObject:
|
||||
if (!(actor = mCachedElementActor)) {
|
||||
result = NPERR_GENERIC_ERROR;
|
||||
PPluginScriptableObjectChild* actorProtocol;
|
||||
CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol,
|
||||
&result);
|
||||
if (result == NPERR_NO_ERROR) {
|
||||
if (CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol, &result) &&
|
||||
result == NPERR_NO_ERROR) {
|
||||
actor = mCachedElementActor =
|
||||
static_cast<PluginScriptableObjectChild*>(actorProtocol);
|
||||
NS_ASSERTION(actor, "Null actor!");
|
||||
|
|
@ -338,6 +339,7 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue,
|
|||
break;
|
||||
|
||||
default:
|
||||
result = NPERR_GENERIC_ERROR;
|
||||
NS_NOTREACHED("Don't know what to do with this value type!");
|
||||
}
|
||||
|
||||
|
|
@ -434,6 +436,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
|
|||
case NPNVWindowNPObject: // Intentional fall-through
|
||||
case NPNVPluginElementNPObject: {
|
||||
NPObject* object;
|
||||
*((NPObject**)aValue) = nullptr;
|
||||
NPError result = InternalGetNPObjectForValue(aVar, &object);
|
||||
if (result == NPERR_NO_ERROR) {
|
||||
*((NPObject**)aValue) = object;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue