NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
nsHTMLEmbedElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject) { if (mReflectedPlugin) return mInner.GetScriptObject(aContext, aScriptObject);  nsresult rv; *aScriptObject = nsnull;     JSObject* elementObject = nsnull; rv = mInner.GetScriptObject(aContext, (void**)&elementObject); if (NS_FAILED(rv) || !elementObject) return rv;  nsCOMPtr<nsIPluginInstance> pi; rv = GetPluginInstance(getter_AddRefs(pi));       nsIID *scriptableInterface = nsnull; nsCOMPtr<nsISupports> scriptablePeer; if (NS_SUCCEEDED(rv) && pi) { nsCOMPtr<nsIScriptablePlugin> spi(do_QueryInterface(pi, &rv)); if (NS_SUCCEEDED(rv) && spi) { rv = spi->GetScriptableInterface(&scriptableInterface); if (NS_SUCCEEDED(rv) && scriptableInterface) rv = spi->GetScriptablePeer(getter_AddRefs(scriptablePeer)); } }  if (NS_FAILED(rv) || !scriptableInterface || !scriptablePeer) {  *aScriptObject = elementObject; return NS_OK; }   JSObject* parentObject; nsCOMPtr<nsIScriptObjectOwner> owner; if (mInner.mParent) { owner = do_QueryInterface(mInner.mParent, &rv); } else if (mInner.mDocument) { owner = do_QueryInterface(mInner.mDocument, &rv); } if (NS_SUCCEEDED(rv) && owner) { rv = owner->GetScriptObject(aContext, (void **)&parentObject); } if (NS_FAILED(rv) || !parentObject) parentObject = elementObject;   JSObject* interfaceObject; JSContext *cx = (JSContext *)aContext->GetNativeContext(); nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID()); if (cx && xpc) { nsCOMPtr<nsIXPConnectJSObjectHolder> holder; if (NS_SUCCEEDED(xpc->WrapNative(cx, parentObject, scriptablePeer, *scriptableInterface, getter_AddRefs(holder))) && holder && NS_SUCCEEDED(holder->GetJSObject(&interfaceObject)) && interfaceObject) { *aScriptObject = interfaceObject; } }    if (!*aScriptObject || !JS_SetPrototype(cx, interfaceObject, elementObject)) { *aScriptObject = elementObject; return NS_OK; }   if (NS_SUCCEEDED(mInner.SetScriptObject(*aScriptObject))) mReflectedPlugin = PR_TRUE;  return NS_OK; }
  NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)