本文整理汇总了C++中MutableHandleValue::address方法的典型用法代码示例。如果您正苦于以下问题:C++ MutableHandleValue::address方法的具体用法?C++ MutableHandleValue::address怎么用?C++ MutableHandleValue::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableHandleValue
的用法示例。
在下文中一共展示了MutableHandleValue::address方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cur
nsresult
castNative(JSContext *cx,
XPCWrappedNative *wrapper,
JSObject *curArg,
XPCWrappedNativeTearOff *tearoff,
const nsIID &iid,
void **ppThis,
nsISupports **pThisRef,
MutableHandleValue vp)
{
RootedObject cur(cx, curArg);
if (wrapper) {
nsresult rv = getNativeFromWrapper(cx,wrapper, iid, ppThis, pThisRef,
vp.address());
if (rv != NS_ERROR_NO_INTERFACE)
return rv;
} else if (cur) {
nsISupports *native;
if (!(native = mozilla::dom::UnwrapDOMObjectToISupports(cur))) {
*pThisRef = nullptr;
return NS_ERROR_ILLEGAL_VALUE;
}
if (NS_SUCCEEDED(getNative(native, cur, iid, ppThis, pThisRef, vp.address()))) {
return NS_OK;
}
}
*pThisRef = nullptr;
return NS_ERROR_XPC_BAD_OP_ON_WN_PROTO;
}
示例2: shId
bool
GlobalObject::getSelfHostedFunction(JSContext *cx, HandleAtom selfHostedName, HandleAtom name,
unsigned nargs, MutableHandleValue funVal)
{
RootedId shId(cx, AtomToId(selfHostedName));
RootedObject holder(cx, cx->global()->intrinsicsHolder());
if (HasDataProperty(cx, holder, shId, funVal.address()))
return true;
if (!cx->runtime()->maybeWrappedSelfHostedFunction(cx, shId, funVal))
return false;
if (!funVal.isUndefined())
return true;
JSFunction *fun = NewFunction(cx, NullPtr(), nullptr, nargs, JSFunction::INTERPRETED_LAZY,
holder, name, JSFunction::ExtendedFinalizeKind, SingletonObject);
if (!fun)
return false;
fun->setIsSelfHostedBuiltin();
fun->setExtendedSlot(0, StringValue(selfHostedName));
funVal.setObject(*fun);
return JSObject::defineGeneric(cx, holder, shId, funVal, nullptr, nullptr, 0);
}
示例3: wrapperProto
bool
ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper,
HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
assertEnteredPolicy(cx, wrapper, id);
vp.setUndefined();
JSPropertyDescriptor desc;
// Only call through to the get trap on the underlying object if we're
// allowed to see the property, and if what we'll find is not on a standard
// prototype.
if (AllowedByBase(cx, wrapper, id, js::Wrapper::GET) &&
!PropIsFromStandardPrototype(cx, wrapper, id))
{
// Call the get trap.
if (!ChromeObjectWrapperBase::get(cx, wrapper, receiver, id, vp))
return false;
// If we found something, we're done.
if (!vp.isUndefined())
return true;
}
// If we have no proto, we're done.
RootedObject wrapperProto(cx);
if (!JS_GetPrototype(cx, wrapper, wrapperProto.address()))
return false;
if (!wrapperProto)
return true;
// Try the prototype.
MOZ_ASSERT(js::IsObjectInContextCompartment(wrapper, cx));
return js::GetGeneric(cx, wrapperProto, receiver, id, vp.address());
}
示例4: holder
bool
WatchpointMap::triggerWatchpoint(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp)
{
Map::Ptr p = map.lookup(WatchKey(obj, id));
if (!p || p->value().held)
return true;
AutoEntryHolder holder(cx, map, p);
/* Copy the entry, since GC would invalidate p. */
JSWatchPointHandler handler = p->value().handler;
RootedObject closure(cx, p->value().closure);
/* Determine the property's old value. */
Value old;
old.setUndefined();
if (obj->isNative()) {
NativeObject* nobj = &obj->as<NativeObject>();
if (Shape* shape = nobj->lookup(cx, id)) {
if (shape->hasSlot())
old = nobj->getSlot(shape->slot());
}
}
// Read barrier to prevent an incorrectly gray closure from escaping the
// watchpoint. See the comment before UnmarkGrayChildren in gc/Marking.cpp
JS::ExposeObjectToActiveJS(closure);
/* Call the handler. */
return handler(cx, obj, id, old, vp.address(), closure);
}
示例5: call
bool
CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, bool *bp)
{
AutoCompartment call(cx, wrappedObject(wrapper));
if (!cx->compartment->wrap(cx, v.address()))
return false;
return Wrapper::hasInstance(cx, wrapper, v, bp);
}
示例6: get
bool
WaiveXrayWrapper::get(JSContext *cx, HandleObject wrapper,
HandleObject receiver, HandleId id,
MutableHandleValue vp)
{
return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) &&
WrapperFactory::WaiveXrayAndWrap(cx, vp.address());
}
示例7: SetProperty
bool
XPC_WN_Helper_SetProperty(JSContext* cx, HandleObject obj, HandleId id,
MutableHandleValue vp, ObjectOpResult& result)
{
PRE_HELPER_STUB
SetProperty(wrapper, cx, obj, id, vp.address(), &retval);
POST_HELPER_STUB_WITH_OBJECTOPRESULT(failReadOnly)
}
示例8: GetProperty
bool
XPC_WN_Helper_GetProperty(JSContext* cx, HandleObject obj, HandleId id,
MutableHandleValue vp)
{
PRE_HELPER_STUB
GetProperty(wrapper, cx, obj, id, vp.address(), &retval);
POST_HELPER_STUB
}
示例9: shg
bool
JSRuntime::getUnclonedSelfHostedValue(JSContext *cx, Handle<PropertyName*> name,
MutableHandleValue vp)
{
RootedObject shg(cx, selfHostingGlobal_);
AutoCompartment ac(cx, shg);
return JS_GetPropertyById(cx, shg, NameToId(name), vp.address());
}
示例10: script
/* static */ bool
ModuleObject::evaluate(JSContext* cx, HandleModuleObject self, MutableHandleValue rval)
{
RootedScript script(cx, self->script());
RootedModuleEnvironmentObject scope(cx, self->environment());
if (!scope) {
JS_ReportError(cx, "Module declarations have not yet been instantiated");
return false;
}
return Execute(cx, script, *scope, rval.address());
}
示例11: adi
bool
ArrayShiftDense(JSContext *cx, HandleObject obj, MutableHandleValue rval)
{
JS_ASSERT(obj->is<ArrayObject>());
AutoDetectInvalidation adi(cx, rval.address());
Value argv[] = { UndefinedValue(), ObjectValue(*obj) };
AutoValueArray ava(cx, argv, 2);
if (!js::array_shift(cx, 0, argv))
return false;
// If the result is |undefined|, the array was probably empty and we
// have to monitor the return value.
rval.set(argv[0]);
if (rval.isUndefined())
types::TypeScript::Monitor(cx, rval);
return true;
}
示例12: adi
bool
ArrayPopDense(JSContext *cx, HandleObject obj, MutableHandleValue rval)
{
JS_ASSERT(obj->is<ArrayObject>());
AutoDetectInvalidation adi(cx, rval.address());
JS::AutoValueArray<2> argv(cx);
argv[0].setUndefined();
argv[1].setObject(*obj);
if (!js::array_pop(cx, 0, argv.begin()))
return false;
// If the result is |undefined|, the array was probably empty and we
// have to monitor the return value.
rval.set(argv[0]);
if (rval.isUndefined())
types::TypeScript::Monitor(cx, rval);
return true;
}
示例13: shId
bool
GlobalObject::getSelfHostedFunction(JSContext* cx, HandleAtom selfHostedName, HandleAtom name,
unsigned nargs, MutableHandleValue funVal)
{
RootedId shId(cx, AtomToId(selfHostedName));
RootedObject holder(cx, cx->global()->intrinsicsHolder());
if (cx->global()->maybeGetIntrinsicValue(shId, funVal.address()))
return true;
JSFunction* fun =
NewScriptedFunction(cx, nargs, JSFunction::INTERPRETED_LAZY,
name, JSFunction::ExtendedFinalizeKind, SingletonObject);
if (!fun)
return false;
fun->setIsSelfHostedBuiltin();
fun->setExtendedSlot(0, StringValue(selfHostedName));
funVal.setObject(*fun);
return cx->global()->addIntrinsicValue(cx, shId, funVal);
}
示例14: linearStr
bool
js::DirectEvalStringFromIon(JSContext* cx,
HandleObject scopeObj, HandleScript callerScript,
HandleValue newTargetValue, HandleString str,
jsbytecode* pc, MutableHandleValue vp)
{
AssertInnerizedScopeChain(cx, *scopeObj);
Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeObj->global());
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
return false;
}
// ES5 15.1.2.1 steps 2-8.
RootedLinearString linearStr(cx, str->ensureLinear(cx));
if (!linearStr)
return false;
EvalJSONResult ejr = TryEvalJSON(cx, linearStr, vp);
if (ejr != EvalJSON_NotJSON)
return ejr == EvalJSON_Success;
EvalScriptGuard esg(cx);
esg.lookupInEvalCache(linearStr, callerScript, pc);
if (!esg.foundScript()) {
RootedScript maybeScript(cx);
const char* filename;
unsigned lineno;
bool mutedErrors;
uint32_t pcOffset;
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset,
&mutedErrors, CALLED_FROM_JSOP_EVAL);
const char* introducerFilename = filename;
if (maybeScript && maybeScript->scriptSource()->introducerFilename())
introducerFilename = maybeScript->scriptSource()->introducerFilename();
RootedObject enclosing(cx, callerScript->innermostStaticScope(pc));
Rooted<StaticEvalScope*> staticScope(cx, StaticEvalScope::create(cx, enclosing));
if (!staticScope)
return false;
CompileOptions options(cx);
options.setIsRunOnce(true)
.setForEval(true)
.setNoScriptRval(false)
.setMutedErrors(mutedErrors)
.maybeMakeStrictMode(IsStrictEvalPC(pc));
if (introducerFilename) {
options.setFileAndLine(filename, 1);
options.setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset);
} else {
options.setFileAndLine("eval", 1);
options.setIntroductionType("eval");
}
AutoStableStringChars linearChars(cx);
if (!linearChars.initTwoByte(cx, linearStr))
return false;
const char16_t* chars = linearChars.twoByteRange().start().get();
SourceBufferHolder::Ownership ownership = linearChars.maybeGiveOwnershipToCaller()
? SourceBufferHolder::GiveOwnership
: SourceBufferHolder::NoOwnership;
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
scopeObj, staticScope, callerScript,
options, srcBuf, linearStr);
if (!compiled)
return false;
if (compiled->strict())
staticScope->setStrict();
esg.setNewScript(compiled);
}
return ExecuteKernel(cx, esg.script(), *scopeObj, newTargetValue,
NullFramePtr() /* evalInFrame */, vp.address());
}
示例15: str
//.........这里部分代码省略.........
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
return false;
}
// ES5 15.1.2.1 step 1.
if (!v.isString()) {
vp.set(v);
return true;
}
RootedString str(cx, v.toString());
// ES5 15.1.2.1 steps 2-8.
// Per ES5, indirect eval runs in the global scope. (eval is specified this
// way so that the compiler can make assumptions about what bindings may or
// may not exist in the current frame if it doesn't see 'eval'.)
MOZ_ASSERT_IF(evalType != DIRECT_EVAL,
cx->global() == &scopeobj->as<ClonedBlockObject>().global());
RootedLinearString linearStr(cx, str->ensureLinear(cx));
if (!linearStr)
return false;
RootedScript callerScript(cx, caller ? caller.script() : nullptr);
EvalJSONResult ejr = TryEvalJSON(cx, linearStr, vp);
if (ejr != EvalJSON_NotJSON)
return ejr == EvalJSON_Success;
EvalScriptGuard esg(cx);
if (evalType == DIRECT_EVAL && caller.isFunctionFrame())
esg.lookupInEvalCache(linearStr, callerScript, pc);
if (!esg.foundScript()) {
RootedScript maybeScript(cx);
unsigned lineno;
const char* filename;
bool mutedErrors;
uint32_t pcOffset;
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset,
&mutedErrors,
evalType == DIRECT_EVAL
? CALLED_FROM_JSOP_EVAL
: NOT_CALLED_FROM_JSOP_EVAL);
const char* introducerFilename = filename;
if (maybeScript && maybeScript->scriptSource()->introducerFilename())
introducerFilename = maybeScript->scriptSource()->introducerFilename();
RootedObject enclosing(cx);
if (evalType == DIRECT_EVAL)
enclosing = callerScript->innermostStaticScope(pc);
else
enclosing = &cx->global()->lexicalScope().staticBlock();
Rooted<StaticEvalScope*> staticScope(cx, StaticEvalScope::create(cx, enclosing));
if (!staticScope)
return false;
CompileOptions options(cx);
options.setIsRunOnce(true)
.setForEval(true)
.setNoScriptRval(false)
.setMutedErrors(mutedErrors)
.maybeMakeStrictMode(evalType == DIRECT_EVAL && IsStrictEvalPC(pc));
if (introducerFilename) {
options.setFileAndLine(filename, 1);
options.setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset);
} else {
options.setFileAndLine("eval", 1);
options.setIntroductionType("eval");
}
AutoStableStringChars linearChars(cx);
if (!linearChars.initTwoByte(cx, linearStr))
return false;
const char16_t* chars = linearChars.twoByteRange().start().get();
SourceBufferHolder::Ownership ownership = linearChars.maybeGiveOwnershipToCaller()
? SourceBufferHolder::GiveOwnership
: SourceBufferHolder::NoOwnership;
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
scopeobj, staticScope, callerScript,
options, srcBuf, linearStr);
if (!compiled)
return false;
if (compiled->strict())
staticScope->setStrict();
esg.setNewScript(compiled);
}
// Look up the newTarget from the frame iterator.
Value newTargetVal = NullValue();
return ExecuteKernel(cx, esg.script(), *scopeobj, newTargetVal,
NullFramePtr() /* evalInFrame */, vp.address());
}