mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 959787 - Handlify JS_GetProperty and related APIs r=terrence r=bz
This commit is contained in:
parent
e0514d8124
commit
ba27569312
@ -3620,7 +3620,7 @@ nsGenericArraySH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
||||
nsresult
|
||||
nsGenericArraySH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, uint32_t *length)
|
||||
JS::Handle<JSObject*> obj, uint32_t *length)
|
||||
{
|
||||
*length = 0;
|
||||
|
||||
@ -3995,7 +3995,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
||||
// If we are called via document.all(id) instead of document.all.item(i) or
|
||||
// another method, use the document.all callee object as self.
|
||||
JSObject *self;
|
||||
JS::Rooted<JSObject*> self(cx);
|
||||
if (args.calleev().isObject() &&
|
||||
JS_GetClass(&args.calleev().toObject()) == &sHTMLDocumentAllClass) {
|
||||
self = &args.calleev().toObject();
|
||||
|
@ -328,16 +328,16 @@ protected:
|
||||
virtual ~nsGenericArraySH()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
JSObject **objp, bool *_retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
|
||||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, uint32_t *length);
|
||||
JS::Handle<JSObject*> obj, uint32_t *length);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
|
@ -2422,7 +2422,6 @@ class InternedStringId
|
||||
InternedStringId() : id(JSID_VOID) {}
|
||||
|
||||
bool init(JSContext *cx, const char *string) {
|
||||
MOZ_ASSERT(id == JSID_VOID);
|
||||
JSString* str = JS_InternString(cx, string);
|
||||
if (!str)
|
||||
return false;
|
||||
|
@ -16,7 +16,7 @@ bool
|
||||
CallbackInterface::GetCallableProperty(JSContext* cx, const char* aPropName,
|
||||
JS::MutableHandle<JS::Value> aCallable)
|
||||
{
|
||||
if (!JS_GetProperty(cx, mCallback, aPropName, aCallable)) {
|
||||
if (!JS_GetProperty(cx, CallbackPreserveColor(), aPropName, aCallable)) {
|
||||
return false;
|
||||
}
|
||||
if (!aCallable.isObject() ||
|
||||
|
@ -9102,9 +9102,11 @@ if (cx) {
|
||||
if memberInits:
|
||||
body += (
|
||||
"bool isNull = val.isNullOrUndefined();\n"
|
||||
"// We only need |temp| if !isNull, in which case we have |cx|.\n"
|
||||
"// We only need these if !isNull, in which case we have |cx|.\n"
|
||||
"Maybe<JS::Rooted<JSObject *> > object;\n"
|
||||
"Maybe<JS::Rooted<JS::Value> > temp;\n"
|
||||
"if (!isNull) {\n"
|
||||
" object.construct(cx, &val.toObject());\n"
|
||||
" temp.construct(cx);\n"
|
||||
"}\n")
|
||||
body += "\n\n".join(memberInits) + "\n"
|
||||
@ -9170,7 +9172,7 @@ if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
|
||||
|
||||
def initIdsMethod(self):
|
||||
assert self.needToInitIds
|
||||
idinit = [CGGeneric('!InternJSString(cx, atomsCache->%s, "%s")' %
|
||||
idinit = [CGGeneric('!atomsCache->%s.init(cx, "%s")' %
|
||||
(m.identifier.name + "_id", m.identifier.name))
|
||||
for m in self.dictionary.members]
|
||||
idinit.reverse();
|
||||
@ -9355,7 +9357,7 @@ if (""",
|
||||
replacements["haveValue"] = "!isNull && !temp.ref().isUndefined()"
|
||||
|
||||
propId = self.makeIdName(member.identifier.name);
|
||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), atomsCache->%s, &temp.ref())" %
|
||||
propGet = ("JS_GetPropertyById(cx, object.ref(), atomsCache->%s, &temp.ref())" %
|
||||
propId)
|
||||
|
||||
conversionReplacements = {
|
||||
@ -11432,7 +11434,8 @@ class CallbackGetter(CallbackAccessor):
|
||||
self.attrName)
|
||||
}
|
||||
return string.Template(
|
||||
'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n'
|
||||
'JS::Rooted<JSObject *> callback(cx, mCallback);\n'
|
||||
'if (!JS_GetProperty(cx, callback, "${attrName}", &rval)) {\n'
|
||||
' aRv.Throw(NS_ERROR_UNEXPECTED);\n'
|
||||
' return${errorReturn};\n'
|
||||
'}\n').substitute(replacements);
|
||||
@ -11499,9 +11502,8 @@ class GlobalGenRoots():
|
||||
continue
|
||||
|
||||
classMembers = [ClassMember(m.identifier.name + "_id",
|
||||
"jsid",
|
||||
visibility="public",
|
||||
body="JSID_VOID") for m in dictMembers]
|
||||
"InternedStringId",
|
||||
visibility="public") for m in dictMembers]
|
||||
|
||||
structName = dict.identifier.name + "Atoms"
|
||||
structs.append((structName,
|
||||
@ -11525,6 +11527,11 @@ class GlobalGenRoots():
|
||||
CGWrapper(structs, pre='\n'))
|
||||
curr = CGWrapper(curr, post='\n')
|
||||
|
||||
# Add include statement for InternedStringId.
|
||||
declareIncludes = ['mozilla/dom/BindingUtils.h']
|
||||
curr = CGHeaders([], [], [], [], declareIncludes, [], 'GeneratedAtomList',
|
||||
curr)
|
||||
|
||||
# Add include guards.
|
||||
curr = CGIncludeGuard('GeneratedAtomList', curr)
|
||||
|
||||
|
@ -98,7 +98,8 @@ static nsresult CompareDictionaries(JSContext* aCx, JSObject *aA,
|
||||
|
||||
for (size_t i = 0; i < props.length(); i++) {
|
||||
JS::Rooted<JS::Value> bprop(aCx);
|
||||
if (!JS_GetPropertyById(aCx, b, props[i], &bprop)) {
|
||||
JS::Rooted<jsid> id(aCx, props[i]);
|
||||
if (!JS_GetPropertyById(aCx, b, id, &bprop)) {
|
||||
LOG(("Error parsing dictionary!\n"));
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ TCPSocketParent::SendEvent(const nsAString& aType, JS::Handle<JS::Value> aDataVa
|
||||
data = mozilla::void_t();
|
||||
|
||||
} else if (aDataVal.isObject()) {
|
||||
JSObject* obj = &aDataVal.toObject();
|
||||
JS::Rooted<JSObject *> obj(aCx, &aDataVal.toObject());
|
||||
if (JS_IsArrayBufferObject(obj)) {
|
||||
uint32_t nbytes = JS_GetArrayBufferByteLength(obj);
|
||||
uint8_t* buffer = JS_GetArrayBufferData(obj);
|
||||
|
@ -557,11 +557,13 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj)
|
||||
}
|
||||
|
||||
static bool
|
||||
GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle<JS::Value> rval)
|
||||
GetProperty(JSContext *cx, JSObject *objArg, NPIdentifier npid, JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id),
|
||||
NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
|
||||
"id must be either string or int!\n");
|
||||
return ::JS_GetPropertyById(cx, obj, NPIdentifierToJSId(id), rval);
|
||||
JS::Rooted<JSObject *> obj(cx, objArg);
|
||||
JS::Rooted<jsid> id(cx, NPIdentifierToJSId(npid));
|
||||
return ::JS_GetPropertyById(cx, obj, id, rval);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -17,8 +17,9 @@ BEGIN_TEST(testException_bug860435)
|
||||
JS::RootedValue v(cx);
|
||||
JS_CallFunctionValue(cx, global, fun, 0, v.address(), v.address());
|
||||
CHECK(v.isObject());
|
||||
JS::RootedObject obj(cx, &v.toObject());
|
||||
|
||||
JS_GetProperty(cx, &v.toObject(), "stack", &v);
|
||||
JS_GetProperty(cx, obj, "stack", &v);
|
||||
CHECK(v.isString());
|
||||
return true;
|
||||
}
|
||||
|
@ -31,11 +31,12 @@ BEGIN_TEST(testStructuredClone_object)
|
||||
|
||||
CHECK(JS_StructuredClone(cx, v1, &v2, nullptr, nullptr));
|
||||
CHECK(v2.isObject());
|
||||
JS::RootedObject obj(cx, &v2.toObject());
|
||||
|
||||
JS::RootedValue prop(cx);
|
||||
CHECK(JS_GetProperty(cx, &v2.toObject(), "prop", &prop));
|
||||
CHECK(JS_GetProperty(cx, obj, "prop", &prop));
|
||||
CHECK(prop.isInt32());
|
||||
CHECK(&v1.toObject() != &v2.toObject());
|
||||
CHECK(&v1.toObject() != obj);
|
||||
CHECK_EQUAL(prop.toInt32(), 1337);
|
||||
}
|
||||
|
||||
|
@ -3366,11 +3366,8 @@ JS_GetPropertyDescriptor(JSContext *cx, JSObject *objArg, const char *name, unsi
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp)
|
||||
JS_GetPropertyById(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
|
||||
return JS_ForwardGetPropertyTo(cx, obj, id, obj, vp);
|
||||
}
|
||||
|
||||
@ -3388,7 +3385,7 @@ JS_ForwardGetPropertyTo(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetElement(JSContext *cx, JSObject *objArg, uint32_t index, MutableHandleValue vp)
|
||||
JS_GetElement(JSContext *cx, HandleObject objArg, uint32_t index, MutableHandleValue vp)
|
||||
{
|
||||
return JS_ForwardGetElementTo(cx, objArg, index, objArg, vp);
|
||||
}
|
||||
@ -3408,20 +3405,24 @@ JS_ForwardGetElementTo(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetProperty(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue vp)
|
||||
JS_GetProperty(JSContext *cx, HandleObject obj, const char *name, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = Atomize(cx, name, strlen(name));
|
||||
return atom && JS_GetPropertyById(cx, obj, AtomToId(atom), vp);
|
||||
if (!atom)
|
||||
return false;
|
||||
RootedId id(cx, AtomToId(atom));
|
||||
return JS_GetPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
|
||||
JS_GetUCProperty(JSContext *cx, HandleObject obj, const jschar *name, size_t namelen,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen));
|
||||
return atom && JS_GetPropertyById(cx, obj, AtomToId(atom), vp);
|
||||
if (!atom)
|
||||
return false;
|
||||
RootedId id(cx, AtomToId(atom));
|
||||
return JS_GetPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
@ -3550,10 +3551,9 @@ JS_DeleteProperty2(JSContext *cx, HandleObject obj, const char *name, bool *resu
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
|
||||
JS_DeleteUCProperty2(JSContext *cx, HandleObject obj, const jschar *name, size_t namelen,
|
||||
bool *result)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
@ -3027,10 +3027,10 @@ JS_GetPropertyDescriptor(JSContext *cx, JSObject *obj, const char *name, unsigne
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandleValue vp);
|
||||
JS_GetProperty(JSContext *cx, JS::HandleObject obj, const char *name, JS::MutableHandleValue vp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandleValue vp);
|
||||
JS_GetPropertyById(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_ForwardGetPropertyTo(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject onBehalfOf,
|
||||
@ -3082,7 +3082,7 @@ JS_LookupUCProperty(JSContext *cx, JS::HandleObject obj,
|
||||
JS::MutableHandleValue vp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *obj,
|
||||
JS_GetUCProperty(JSContext *cx, JS::HandleObject obj,
|
||||
const jschar *name, size_t namelen,
|
||||
JS::MutableHandleValue vp);
|
||||
|
||||
@ -3092,7 +3092,7 @@ JS_SetUCProperty(JSContext *cx, JS::HandleObject obj,
|
||||
JS::HandleValue v);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_DeleteUCProperty2(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen,
|
||||
JS_DeleteUCProperty2(JSContext *cx, JS::HandleObject obj, const jschar *name, size_t namelen,
|
||||
bool *succeeded);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
@ -3124,7 +3124,7 @@ extern JS_PUBLIC_API(bool)
|
||||
JS_LookupElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, uint32_t index, JS::MutableHandleValue vp);
|
||||
JS_GetElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_ForwardGetElementTo(JSContext *cx, JSObject *obj, uint32_t index, JSObject *onBehalfOf,
|
||||
|
@ -456,7 +456,8 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> file_holder;
|
||||
rv = xpc->WrapNative(cx, entry->obj, file,
|
||||
RootedObject entryObj(cx, entry->obj);
|
||||
rv = xpc->WrapNative(cx, entryObj, file,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(file_holder));
|
||||
|
||||
@ -472,7 +473,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
|
||||
JSCLAutoErrorReporterSetter aers(cx, xpc::SystemErrorReporter);
|
||||
|
||||
RootedValue NSGetFactory_val(cx);
|
||||
if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", &NSGetFactory_val) ||
|
||||
if (!JS_GetProperty(cx, entryObj, "NSGetFactory", &NSGetFactory_val) ||
|
||||
JSVAL_IS_VOID(NSGetFactory_val)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -508,7 +509,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
if (!mReuseLoaderGlobal) {
|
||||
xpc::SetLocationForGlobal(entry->obj, spec);
|
||||
xpc::SetLocationForGlobal(entryObj, spec);
|
||||
}
|
||||
|
||||
// The hash owns the ModuleEntry now, forget about it
|
||||
@ -1265,7 +1266,8 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
|
||||
JSAutoCompartment ac(mContext, mod->obj);
|
||||
|
||||
RootedValue symbols(mContext);
|
||||
if (!JS_GetProperty(mContext, mod->obj,
|
||||
RootedObject modObj(mContext, mod->obj);
|
||||
if (!JS_GetProperty(mContext, modObj,
|
||||
"EXPORTED_SYMBOLS", &symbols)) {
|
||||
return ReportOnCaller(cxhelper, ERROR_NOT_PRESENT,
|
||||
PromiseFlatCString(aLocation).get());
|
||||
@ -1300,7 +1302,8 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
|
||||
PromiseFlatCString(aLocation).get(), i);
|
||||
}
|
||||
|
||||
if (!JS_GetPropertyById(mContext, mod->obj, symbolId, &value)) {
|
||||
RootedObject modObj(mContext, mod->obj);
|
||||
if (!JS_GetPropertyById(mContext, modObj, symbolId, &value)) {
|
||||
JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId));
|
||||
if (!bytes)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -188,7 +188,6 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
|
||||
RootedValue retval(cx);
|
||||
RootedObject retObj(cx);
|
||||
bool success = false;
|
||||
jsid funid;
|
||||
RootedValue fun(cx);
|
||||
|
||||
// Don't call the actual function on a content object. We'll determine
|
||||
@ -208,7 +207,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
|
||||
return nullptr;
|
||||
|
||||
// check upfront for the existence of the function property
|
||||
funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE);
|
||||
HandleId funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE);
|
||||
if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun))
|
||||
return nullptr;
|
||||
|
||||
@ -292,8 +291,8 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
|
||||
|
||||
static bool
|
||||
GetNamedPropertyAsVariantRaw(XPCCallContext& ccx,
|
||||
JSObject* aJSObj,
|
||||
jsid aName,
|
||||
HandleObject aJSObj,
|
||||
HandleId aName,
|
||||
nsIVariant** aResult,
|
||||
nsresult* pErr)
|
||||
{
|
||||
@ -1357,11 +1356,15 @@ pre_call_clean_up:
|
||||
|
||||
if (param.IsRetval())
|
||||
val = rval;
|
||||
else if (JSVAL_IS_PRIMITIVE(argv[i]) ||
|
||||
!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
|
||||
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
|
||||
&val))
|
||||
else if (argv[i].isPrimitive())
|
||||
break;
|
||||
else {
|
||||
RootedObject obj(cx, &argv[i].toObject());
|
||||
if (!JS_GetPropertyById(cx, obj,
|
||||
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
|
||||
&val))
|
||||
break;
|
||||
}
|
||||
|
||||
// setup allocator and/or iid
|
||||
|
||||
@ -1402,10 +1405,13 @@ pre_call_clean_up:
|
||||
|
||||
if (param.IsRetval())
|
||||
val = rval;
|
||||
else if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
|
||||
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
|
||||
&val))
|
||||
break;
|
||||
else {
|
||||
RootedObject obj(cx, &argv[i].toObject());
|
||||
if (!JS_GetPropertyById(cx, obj,
|
||||
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
|
||||
&val))
|
||||
break;
|
||||
}
|
||||
|
||||
// setup allocator and/or iid
|
||||
|
||||
|
@ -1854,18 +1854,18 @@ CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp)
|
||||
MOZ_ASSERT(paramIndex < mArgc || paramInfo.IsOptional(),
|
||||
"Expected either enough arguments or an optional argument");
|
||||
jsval arg = paramIndex < mArgc ? mArgv[paramIndex] : JSVAL_NULL;
|
||||
if (paramIndex < mArgc &&
|
||||
(JSVAL_IS_PRIMITIVE(arg) ||
|
||||
!JS_GetPropertyById(mCallContext,
|
||||
JSVAL_TO_OBJECT(arg),
|
||||
mIdxValueId,
|
||||
srcp))) {
|
||||
// Explicitly passed in unusable value for out param. Note
|
||||
// that if i >= mArgc we already know that |arg| is JSVAL_NULL,
|
||||
// and that's ok.
|
||||
ThrowBadParam(NS_ERROR_XPC_NEED_OUT_OBJECT, paramIndex,
|
||||
mCallContext);
|
||||
return false;
|
||||
if (paramIndex < mArgc) {
|
||||
RootedObject obj(mCallContext);
|
||||
if (!arg.isPrimitive())
|
||||
obj = &arg.toObject();
|
||||
if (!obj || !JS_GetPropertyById(mCallContext, obj, mIdxValueId, srcp)) {
|
||||
// Explicitly passed in unusable value for out param. Note
|
||||
// that if i >= mArgc we already know that |arg| is JSVAL_NULL,
|
||||
// and that's ok.
|
||||
ThrowBadParam(NS_ERROR_XPC_NEED_OUT_OBJECT, paramIndex,
|
||||
mCallContext);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ Module::~Module()
|
||||
#include "xpc_map_end.h"
|
||||
|
||||
static bool
|
||||
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
|
||||
{
|
||||
JS::Rooted<JS::Value> prop(cx);
|
||||
if (!JS_GetProperty(cx, parent, name, &prop))
|
||||
|
@ -40,7 +40,7 @@ Module::~Module()
|
||||
#include "xpc_map_end.h"
|
||||
|
||||
static bool
|
||||
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
|
||||
{
|
||||
JS::Rooted<JS::Value> prop(cx);
|
||||
if (!JS_GetProperty(cx, parent, name, &prop))
|
||||
|
@ -293,7 +293,7 @@ GetJSValueAsURI(JSContext* aCtx,
|
||||
*/
|
||||
already_AddRefed<nsIURI>
|
||||
GetURIFromJSObject(JSContext* aCtx,
|
||||
JSObject* aObject,
|
||||
JS::Handle<JSObject *> aObject,
|
||||
const char* aProperty)
|
||||
{
|
||||
JS::Rooted<JS::Value> uriVal(aCtx);
|
||||
@ -350,7 +350,7 @@ GetJSValueAsString(JSContext* aCtx,
|
||||
*/
|
||||
void
|
||||
GetStringFromJSObject(JSContext* aCtx,
|
||||
JSObject* aObject,
|
||||
JS::Handle<JSObject *> aObject,
|
||||
const char* aProperty,
|
||||
nsString& _string)
|
||||
{
|
||||
@ -380,7 +380,7 @@ GetStringFromJSObject(JSContext* aCtx,
|
||||
template <typename IntType>
|
||||
nsresult
|
||||
GetIntFromJSObject(JSContext* aCtx,
|
||||
JSObject* aObject,
|
||||
JS::Handle<JSObject *> aObject,
|
||||
const char* aProperty,
|
||||
IntType* _int)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user