зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1006629 - Remove GetCalleeWrapper. r=gabor
This commit is contained in:
Родитель
e6bf081ec6
Коммит
d0fda7850b
|
@ -534,26 +534,7 @@ mozJSComponentLoader::FindTargetObject(JSContext* aCx,
|
|||
// instance).
|
||||
if (!targetObject) {
|
||||
// Our targetObject is the caller's global object. Let's get it.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpc =
|
||||
do_GetService(kXPConnectServiceContractID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAXPCNativeCallContext *cc = nullptr;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wn;
|
||||
rv = cc->GetCalleeWrapper(getter_AddRefs(wn));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
targetObject = wn->GetJSObject();
|
||||
if (!targetObject) {
|
||||
NS_ERROR("null calling object");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
targetObject = JS_GetGlobalForObject(aCx, targetObject);
|
||||
targetObject = CurrentGlobalOrNull(aCx);
|
||||
}
|
||||
|
||||
aTargetObject.set(targetObject);
|
||||
|
|
|
@ -19,7 +19,6 @@ class nsAXPCNativeCallContext
|
|||
public:
|
||||
NS_IMETHOD GetCallee(nsISupports **aResult) = 0;
|
||||
NS_IMETHOD GetCalleeMethodIndex(uint16_t *aResult) = 0;
|
||||
NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative **aResult) = 0;
|
||||
NS_IMETHOD GetJSContext(JSContext **aResult) = 0;
|
||||
NS_IMETHOD GetArgc(uint32_t *aResult) = 0;
|
||||
NS_IMETHOD GetArgvPtr(JS::Value **aResult) = 0;
|
||||
|
|
|
@ -258,15 +258,6 @@ XPCCallContext::GetCalleeMethodIndex(uint16_t *aCalleeMethodIndex)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIXPConnectWrappedNative CalleeWrapper; */
|
||||
NS_IMETHODIMP
|
||||
XPCCallContext::GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper)
|
||||
{
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> rval = mWrapper;
|
||||
rval.forget(aCalleeWrapper);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute XPCNativeInterface CalleeInterface; */
|
||||
NS_IMETHODIMP
|
||||
XPCCallContext::GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface)
|
||||
|
|
|
@ -634,21 +634,6 @@ GetIIDArg(uint32_t argc, const JS::Value& val, JSContext* cx)
|
|||
return iid;
|
||||
}
|
||||
|
||||
static void
|
||||
GetWrapperObject(MutableHandleObject obj)
|
||||
{
|
||||
obj.set(nullptr);
|
||||
nsXPConnect* xpc = nsXPConnect::XPConnect();
|
||||
nsAXPCNativeCallContext *ccxp = nullptr;
|
||||
xpc->GetCurrentNativeCallContext(&ccxp);
|
||||
if (!ccxp)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||
ccxp->GetCalleeWrapper(getter_AddRefs(wrapper));
|
||||
obj.set(wrapper->GetJSObject());
|
||||
}
|
||||
|
||||
/* nsISupports createInstance (); */
|
||||
NS_IMETHODIMP
|
||||
nsJSCID::CreateInstance(HandleValue iidval, JSContext *cx,
|
||||
|
@ -657,12 +642,6 @@ nsJSCID::CreateInstance(HandleValue iidval, JSContext *cx,
|
|||
if (!mDetails.IsValid())
|
||||
return NS_ERROR_XPC_BAD_CID;
|
||||
|
||||
RootedObject obj(cx);
|
||||
GetWrapperObject(&obj);
|
||||
if (!obj) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (NS_FAILED(nsXPConnect::SecurityManager()->CanCreateInstance(cx, mDetails.ID()))) {
|
||||
NS_ERROR("how are we not being called from chrome here?");
|
||||
return NS_OK;
|
||||
|
@ -685,7 +664,7 @@ nsJSCID::CreateInstance(HandleValue iidval, JSContext *cx,
|
|||
if (NS_FAILED(rv) || !inst)
|
||||
return NS_ERROR_XPC_CI_RETURNED_FAILURE;
|
||||
|
||||
rv = nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, obj, inst, nullptr, iid, true, retval);
|
||||
rv = nsContentUtils::WrapNative(cx, inst, iid, retval);
|
||||
if (NS_FAILED(rv) || retval.isPrimitive())
|
||||
return NS_ERROR_XPC_CANT_CREATE_WN;
|
||||
return NS_OK;
|
||||
|
@ -699,12 +678,6 @@ nsJSCID::GetService(HandleValue iidval, JSContext *cx, uint8_t optionalArgc,
|
|||
if (!mDetails.IsValid())
|
||||
return NS_ERROR_XPC_BAD_CID;
|
||||
|
||||
RootedObject obj(cx);
|
||||
GetWrapperObject(&obj);
|
||||
if (!obj) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (NS_FAILED(nsXPConnect::SecurityManager()->CanCreateInstance(cx, mDetails.ID()))) {
|
||||
MOZ_ASSERT(JS_IsExceptionPending(cx),
|
||||
"security manager vetoed GetService without setting exception");
|
||||
|
@ -727,12 +700,12 @@ nsJSCID::GetService(HandleValue iidval, JSContext *cx, uint8_t optionalArgc,
|
|||
if (NS_FAILED(rv) || !srvc)
|
||||
return NS_ERROR_XPC_GS_RETURNED_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv = nsXPConnect::XPConnect()->WrapNative(cx, obj, srvc, *iid, getter_AddRefs(holder));
|
||||
if (NS_FAILED(rv) || !holder || !holder->GetJSObject())
|
||||
RootedValue v(cx);
|
||||
rv = nsContentUtils::WrapNative(cx, srvc, iid, &v);
|
||||
if (NS_FAILED(rv) || !v.isObject())
|
||||
return NS_ERROR_XPC_CANT_CREATE_WN;
|
||||
|
||||
retval.setObject(*holder->GetJSObject());
|
||||
retval.set(v);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -724,7 +724,6 @@ class MOZ_STACK_CLASS XPCCallContext : public nsAXPCNativeCallContext
|
|||
public:
|
||||
NS_IMETHOD GetCallee(nsISupports **aResult);
|
||||
NS_IMETHOD GetCalleeMethodIndex(uint16_t *aResult);
|
||||
NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative **aResult);
|
||||
NS_IMETHOD GetJSContext(JSContext **aResult);
|
||||
NS_IMETHOD GetArgc(uint32_t *aResult);
|
||||
NS_IMETHOD GetArgvPtr(jsval **aResult);
|
||||
|
|
Загрузка…
Ссылка в новой задаче