Skip to content
Permalink
Browse files
2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
        Reviewed by Geoff.

        Bug 19907: REGRESSION(r34824-r34941): Reproducible crash trying to log in to MediaTemple.net Account Center
        <https://bugs.webkit.org/show_bug.cgi?id=19907>

        Clear exceptions set on ExecStates before returning from NPAPI
        callbacks, in order to avoid causing problems for the next script that
        executes.

        While fixing this bug, the question was raised of whether we are
        correctly propagating exception information back to the caller:

        Bug 19936: Correctly propagate exception information from NPAPI callbacks
        <https://bugs.webkit.org/show_bug.cgi?id=19936>

        * bridge/NP_jsobject.cpp:
        (_NPN_InvokeDefault):
        (_NPN_Invoke):
        (_NPN_Evaluate):
        (_NPN_GetProperty):
        (_NPN_SetProperty):
        (_NPN_RemoveProperty):
        (_NPN_HasProperty):
        (_NPN_HasMethod):
        (_NPN_Enumerate):


Canonical link: https://commits.webkit.org/27490@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Cameron Zwarich committed Jul 7, 2008
1 parent 257fb62 commit 266e67b8e50c7a5c4e094d886d3b537e4c929575
Showing 2 changed files with 53 additions and 8 deletions.
@@ -1,3 +1,31 @@
2008-07-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>

Reviewed by Geoff.

Bug 19907: REGRESSION(r34824-r34941): Reproducible crash trying to log in to MediaTemple.net Account Center
<https://bugs.webkit.org/show_bug.cgi?id=19907>

Clear exceptions set on ExecStates before returning from NPAPI
callbacks, in order to avoid causing problems for the next script that
executes.

While fixing this bug, the question was raised of whether we are
correctly propagating exception information back to the caller:

Bug 19936: Correctly propagate exception information from NPAPI callbacks
<https://bugs.webkit.org/show_bug.cgi?id=19936>

* bridge/NP_jsobject.cpp:
(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_RemoveProperty):
(_NPN_HasProperty):
(_NPN_HasMethod):
(_NPN_Enumerate):

2008-07-07 Dan Bernstein <mitz@apple.com>

Reviewed by Darin Adler.
@@ -123,6 +123,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou

// Convert and return the result of the function call.
convertValueToNPVariant(exec, resultV, result);
exec->clearException();
return true;
}

@@ -171,6 +172,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant*

// Convert and return the result of the function call.
convertValueToNPVariant(exec, resultV, result);
exec->clearException();
return true;
}

@@ -208,7 +210,7 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant)
result = jsUndefined();

convertValueToNPVariant(exec, result, variant);

exec->clearException();
return true;
}

@@ -236,6 +238,7 @@ bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* va
result = obj->imp->get(exec, i->value.number);

convertValueToNPVariant(exec, result, variant);
exec->clearException();
return true;
}

@@ -265,6 +268,7 @@ bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVaria
obj->imp->put(exec, identifierFromNPIdentifier(i->value.string), convertNPVariantToValue(exec, variant, rootObject));
else
obj->imp->put(exec, i->value.number, convertNPVariantToValue(exec, variant, rootObject));
exec->clearException();
return true;
}

@@ -286,19 +290,24 @@ bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName)
ExecState* exec = rootObject->globalObject()->globalExec();
PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName);
if (i->isString) {
if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string)))
if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string))) {
exec->clearException();
return false;
}
} else {
if (!obj->imp->hasProperty(exec, i->value.number))
if (!obj->imp->hasProperty(exec, i->value.number)) {
exec->clearException();
return false;
}
}

JSLock lock(false);
if (i->isString)
obj->imp->deleteProperty(exec, identifierFromNPIdentifier(i->value.string));
else
obj->imp->deleteProperty(exec, i->value.number);


exec->clearException();
return true;
}
return false;
@@ -316,9 +325,15 @@ bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName)
ExecState* exec = rootObject->globalObject()->globalExec();
PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName);
JSLock lock(false);
if (i->isString)
return obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string));
return obj->imp->hasProperty(exec, i->value.number);
if (i->isString) {
bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string));
exec->clearException();
return result;
}

bool result = obj->imp->hasProperty(exec, i->value.number);
exec->clearException();
return result;
}

if (o->_class->hasProperty)
@@ -343,6 +358,7 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName)
ExecState* exec = rootObject->globalObject()->globalExec();
JSLock lock(false);
JSValue* func = obj->imp->get(exec, identifierFromNPIdentifier(i->value.string));
exec->clearException();
return !func->isUndefined();
}

@@ -382,7 +398,8 @@ bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count

*identifier = identifiers;
*count = size;


exec->clearException();
return true;
}

0 comments on commit 266e67b

Please sign in to comment.