本文整理汇总了C++中MutableHandleValue::isPrimitive方法的典型用法代码示例。如果您正苦于以下问题:C++ MutableHandleValue::isPrimitive方法的具体用法?C++ MutableHandleValue::isPrimitive怎么用?C++ MutableHandleValue::isPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableHandleValue
的用法示例。
在下文中一共展示了MutableHandleValue::isPrimitive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetIIDArg
NS_IMETHODIMP
nsJSCID::CreateInstance(HandleValue iidval, JSContext* cx,
uint8_t optionalArgc, MutableHandleValue retval)
{
if (!mDetails->IsValid())
return NS_ERROR_XPC_BAD_CID;
if (NS_FAILED(nsXPConnect::SecurityManager()->CanCreateInstance(cx, mDetails->ID()))) {
NS_ERROR("how are we not being called from chrome here?");
return NS_OK;
}
// If an IID was passed in then use it
const nsID* iid = GetIIDArg(optionalArgc, iidval, cx);
if (!iid)
return NS_ERROR_XPC_BAD_IID;
nsCOMPtr<nsIComponentManager> compMgr;
nsresult rv = NS_GetComponentManager(getter_AddRefs(compMgr));
if (NS_FAILED(rv))
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsISupports> inst;
rv = compMgr->CreateInstance(mDetails->ID(), nullptr, *iid, getter_AddRefs(inst));
MOZ_ASSERT(NS_FAILED(rv) || inst, "component manager returned success, but instance is null!");
if (NS_FAILED(rv) || !inst)
return NS_ERROR_XPC_CI_RETURNED_FAILURE;
rv = nsContentUtils::WrapNative(cx, inst, iid, retval);
if (NS_FAILED(rv) || retval.isPrimitive())
return NS_ERROR_XPC_CANT_CREATE_WN;
return NS_OK;
}
示例2: JS_WrapValue
// Call WaiveXrayAndWrap when you have a JS object that you don't want to be
// wrapped in an Xray wrapper. cx->compartment is the compartment that will be
// using the returned object. If the object to be wrapped is already in the
// correct compartment, then this returns the unwrapped object.
bool
WrapperFactory::WaiveXrayAndWrap(JSContext *cx, MutableHandleValue vp)
{
if (vp.isPrimitive())
return JS_WrapValue(cx, vp);
RootedObject obj(cx, &vp.toObject());
if (!WaiveXrayAndWrap(cx, &obj))
return false;
vp.setObject(*obj);
return true;
}