Bug 771202 - Implement post-transplant plugin behavior. r=bsmedberg

This commit is contained in:
Bobby Holley 2012-07-13 10:55:14 +02:00
parent c3555699ca
commit b629b15aeb
2 changed files with 14 additions and 3 deletions

View File

@ -9890,7 +9890,13 @@ NS_IMETHODIMP
nsHTMLPluginObjElementSH::PostTransplant(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj)
{
// XXXbholley - Implement me!
// Call through to PostCreate to do the prototype setup all over again. We
// may reuse the same prototype, in which case our prototype will be a wrapped
// version of the original.
nsresult rv = PostCreate(wrapper, cx, obj);
if (NS_FAILED(rv)) {
NS_WARNING("Calling PostCreate during PostTransplant for plugin element failed.");
}
return NS_OK;
}

View File

@ -1812,8 +1812,13 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
}
if (PL_DHASH_ENTRY_IS_BUSY(entry) && entry->mJSObj) {
// Found a live NPObject wrapper, return it.
return entry->mJSObj;
// Found a live NPObject wrapper. It may not be in the same compartment
// as cx, so we need to wrap it before returning it.
JSObject *obj = entry->mJSObj;
if (!JS_WrapObject(cx, &obj)) {
return NULL;
}
return obj;
}
entry->mNPObj = npobj;