зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1177892 part 3 - Remove OBJECT_TO_JSVAL. r=evilpie
This commit is contained in:
Родитель
fdfaf1fa60
Коммит
303b210317
|
@ -201,7 +201,7 @@ ArchiveRequest::GetFilenamesResult(JSContext* aCx,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aValue = OBJECT_TO_JSVAL(array);
|
||||
aValue->setObject(*array);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1764,7 +1764,7 @@ WebSocket::CreateAndDispatchMessageEvent(JSContext* aCx,
|
|||
nsresult rv = nsContentUtils::CreateArrayBuffer(aCx, aData,
|
||||
arrayBuf.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
jsData = OBJECT_TO_JSVAL(arrayBuf);
|
||||
jsData.setObject(*arrayBuf);
|
||||
} else {
|
||||
NS_RUNTIMEABORT("Unknown binary type!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -1885,7 +1885,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
}
|
||||
}
|
||||
|
||||
v = OBJECT_TO_JSVAL(dot_prototype);
|
||||
v.setObject(*dot_prototype);
|
||||
|
||||
JSAutoCompartment ac(cx, class_obj);
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
|
|||
JS::Rooted<JSObject*> arrayBuf(cx);
|
||||
rv = nsContentUtils::CreateArrayBuffer(cx, aData, arrayBuf.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
jsData = OBJECT_TO_JSVAL(arrayBuf);
|
||||
jsData.setObject(*arrayBuf);
|
||||
} else {
|
||||
NS_RUNTIMEABORT("Unknown binary type!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
|
@ -365,7 +365,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
|||
}
|
||||
}
|
||||
|
||||
*aOutVal = OBJECT_TO_JSVAL(arrayObj);
|
||||
aOutVal->setObject(*arrayObj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
|
|||
nsNPObjWrapper::GetNewOrUsed(npp, cx, NPVARIANT_TO_OBJECT(*variant));
|
||||
|
||||
if (obj) {
|
||||
return OBJECT_TO_JSVAL(obj);
|
||||
return JS::ObjectValue(*obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@ workerdebuggersandbox_convert(JSContext *cx, JS::Handle<JSObject *> obj,
|
|||
JSType type, JS::MutableHandle<JS::Value> vp)
|
||||
{
|
||||
if (type == JSTYPE_OBJECT) {
|
||||
vp.set(OBJECT_TO_JSVAL(obj));
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1971,14 +1971,6 @@ UINT_TO_JSVAL(uint32_t i)
|
|||
: DOUBLE_TO_JSVAL((double)i);
|
||||
}
|
||||
|
||||
static inline jsval
|
||||
OBJECT_TO_JSVAL(JSObject* obj)
|
||||
{
|
||||
if (obj)
|
||||
return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj));
|
||||
return IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_NULL, 0));
|
||||
}
|
||||
|
||||
namespace JS {
|
||||
|
||||
extern JS_PUBLIC_DATA(const HandleValue) NullHandleValue;
|
||||
|
|
|
@ -1645,7 +1645,7 @@ InitTypeConstructor(JSContext* cx,
|
|||
|
||||
// Stash ctypes.{Pointer,Array,Struct}Type.prototype on a reserved slot of
|
||||
// the type constructor, for faster lookup.
|
||||
js::SetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO, OBJECT_TO_JSVAL(typeProto));
|
||||
js::SetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO, ObjectValue(*typeProto));
|
||||
|
||||
// Create an object to serve as the common ancestor for all CData objects
|
||||
// created from the given type constructor. This has ctypes.CData.prototype
|
||||
|
@ -1665,7 +1665,7 @@ InitTypeConstructor(JSContext* cx,
|
|||
return false;
|
||||
|
||||
// Link the type prototype to the data prototype.
|
||||
JS_SetReservedSlot(typeProto, SLOT_OURDATAPROTO, OBJECT_TO_JSVAL(dataProto));
|
||||
JS_SetReservedSlot(typeProto, SLOT_OURDATAPROTO, ObjectValue(*dataProto));
|
||||
|
||||
if (!JS_FreezeObject(cx, obj) ||
|
||||
//!JS_FreezeObject(cx, dataProto) || // XXX fixme - see bug 541212!
|
||||
|
@ -1702,8 +1702,7 @@ InitInt64Class(JSContext* cx,
|
|||
if (!fun)
|
||||
return nullptr;
|
||||
|
||||
js::SetFunctionNativeReserved(fun, SLOT_FN_INT64PROTO,
|
||||
OBJECT_TO_JSVAL(prototype));
|
||||
js::SetFunctionNativeReserved(fun, SLOT_FN_INT64PROTO, ObjectValue(*prototype));
|
||||
|
||||
if (!JS_FreezeObject(cx, ctor))
|
||||
return nullptr;
|
||||
|
@ -1720,7 +1719,7 @@ AttachProtos(JSObject* proto, const AutoObjectVector& protos)
|
|||
// to the appropriate CTypeProtoSlot. (SLOT_CTYPES is the last slot
|
||||
// of [[Class]] "CTypeProto" that we fill in this automated manner.)
|
||||
for (uint32_t i = 0; i <= SLOT_CTYPES; ++i)
|
||||
JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i]));
|
||||
JS_SetReservedSlot(proto, i, ObjectOrNullValue(protos[i]));
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1759,7 +1758,7 @@ InitTypeClasses(JSContext* cx, HandleObject ctypesObj)
|
|||
return false;
|
||||
|
||||
// Link CTypeProto to CDataProto.
|
||||
JS_SetReservedSlot(CTypeProto, SLOT_OURDATAPROTO, OBJECT_TO_JSVAL(CDataProto));
|
||||
JS_SetReservedSlot(CTypeProto, SLOT_OURDATAPROTO, ObjectValue(*CDataProto));
|
||||
|
||||
// Create and attach the special class constructors: ctypes.PointerType,
|
||||
// ctypes.ArrayType, ctypes.StructType, and ctypes.FunctionType.
|
||||
|
@ -3948,7 +3947,7 @@ CType::Create(JSContext* cx,
|
|||
// Set the 'prototype' object.
|
||||
//if (!JS_FreezeObject(cx, prototype)) // XXX fixme - see bug 541212!
|
||||
// return nullptr;
|
||||
JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype));
|
||||
JS_SetReservedSlot(typeObj, SLOT_PROTO, ObjectValue(*prototype));
|
||||
}
|
||||
|
||||
if (!JS_FreezeObject(cx, typeObj))
|
||||
|
@ -4630,10 +4629,10 @@ PointerType::CreateInternal(JSContext* cx, HandleObject baseType)
|
|||
return nullptr;
|
||||
|
||||
// Set the target type. (This will be 'null' for an opaque pointer type.)
|
||||
JS_SetReservedSlot(typeObj, SLOT_TARGET_T, OBJECT_TO_JSVAL(baseType));
|
||||
JS_SetReservedSlot(typeObj, SLOT_TARGET_T, ObjectValue(*baseType));
|
||||
|
||||
// Finally, cache our newly-created PointerType on our pointed-to CType.
|
||||
JS_SetReservedSlot(baseType, SLOT_PTR, OBJECT_TO_JSVAL(typeObj));
|
||||
JS_SetReservedSlot(baseType, SLOT_PTR, ObjectValue(*typeObj));
|
||||
|
||||
return typeObj;
|
||||
}
|
||||
|
@ -4955,7 +4954,7 @@ ArrayType::CreateInternal(JSContext* cx,
|
|||
return nullptr;
|
||||
|
||||
// Set the element type.
|
||||
JS_SetReservedSlot(typeObj, SLOT_ELEMENT_T, OBJECT_TO_JSVAL(baseType));
|
||||
JS_SetReservedSlot(typeObj, SLOT_ELEMENT_T, ObjectValue(*baseType));
|
||||
|
||||
// Set the length.
|
||||
JS_SetReservedSlot(typeObj, SLOT_LENGTH, lengthVal);
|
||||
|
@ -5642,7 +5641,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
|||
JS_SetReservedSlot(typeObj, SLOT_ALIGN, INT_TO_JSVAL(structAlign));
|
||||
//if (!JS_FreezeObject(cx, prototype)0 // XXX fixme - see bug 541212!
|
||||
// return false;
|
||||
JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype));
|
||||
JS_SetReservedSlot(typeObj, SLOT_PROTO, ObjectValue(*prototype));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5922,7 +5921,7 @@ StructType::FieldsArrayGetter(JSContext* cx, JS::CallArgs args)
|
|||
JSObject* fields = BuildFieldsArray(cx, obj);
|
||||
if (!fields)
|
||||
return false;
|
||||
JS_SetReservedSlot(obj, SLOT_FIELDS, OBJECT_TO_JSVAL(fields));
|
||||
JS_SetReservedSlot(obj, SLOT_FIELDS, ObjectValue(*fields));
|
||||
|
||||
args.rval().setObject(*fields);
|
||||
}
|
||||
|
@ -6207,7 +6206,7 @@ PrepareCIF(JSContext* cx,
|
|||
FunctionInfo* fninfo)
|
||||
{
|
||||
ffi_abi abi;
|
||||
if (!GetABI(cx, OBJECT_TO_JSVAL(fninfo->mABI), &abi)) {
|
||||
if (!GetABI(cx, ObjectOrNullValue(fninfo->mABI), &abi)) {
|
||||
JS_ReportError(cx, "Invalid ABI specification");
|
||||
return false;
|
||||
}
|
||||
|
@ -6473,7 +6472,7 @@ FunctionType::ConstructData(JSContext* cx,
|
|||
return false;
|
||||
|
||||
// Set the closure object as the referent of the new CData object.
|
||||
JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(closureObj));
|
||||
JS_SetReservedSlot(dataObj, SLOT_REFERENT, ObjectValue(*closureObj));
|
||||
|
||||
// Seal the CData object, to prevent modification of the function pointer.
|
||||
// This permanently associates this object with the closure, and avoids
|
||||
|
@ -6595,7 +6594,7 @@ FunctionType::Call(JSContext* cx,
|
|||
return false;
|
||||
}
|
||||
if (!(type = CData::GetCType(obj)) ||
|
||||
!(type = PrepareType(cx, OBJECT_TO_JSVAL(type))) ||
|
||||
!(type = PrepareType(cx, ObjectValue(*type))) ||
|
||||
// Relying on ImplicitConvert only for the limited purpose of
|
||||
// converting one CType to another (e.g., T[] to T*).
|
||||
!ConvertArgument(cx, obj, i, args[i], type, &values[i], &strings) ||
|
||||
|
@ -7079,11 +7078,11 @@ CData::Create(JSContext* cx,
|
|||
return nullptr;
|
||||
|
||||
// set the CData's associated type
|
||||
JS_SetReservedSlot(dataObj, SLOT_CTYPE, OBJECT_TO_JSVAL(typeObj));
|
||||
JS_SetReservedSlot(dataObj, SLOT_CTYPE, ObjectValue(*typeObj));
|
||||
|
||||
// Stash the referent object, if any, for GC safety.
|
||||
if (refObj)
|
||||
JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(refObj));
|
||||
JS_SetReservedSlot(dataObj, SLOT_REFERENT, ObjectValue(*refObj));
|
||||
|
||||
// Set our ownership flag.
|
||||
JS_SetReservedSlot(dataObj, SLOT_OWNS, BooleanValue(ownResult));
|
||||
|
@ -7777,15 +7776,15 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval* vp)
|
|||
// Used by GetCType
|
||||
JS_SetReservedSlot(objResult,
|
||||
SLOT_DATAFINALIZER_VALTYPE,
|
||||
OBJECT_TO_JSVAL(objBestArgType));
|
||||
ObjectOrNullValue(objBestArgType));
|
||||
|
||||
// Used by ToSource
|
||||
JS_SetReservedSlot(objResult,
|
||||
SLOT_DATAFINALIZER_CODETYPE,
|
||||
OBJECT_TO_JSVAL(objCodePtrType));
|
||||
ObjectValue(*objCodePtrType));
|
||||
|
||||
ffi_abi abi;
|
||||
if (!GetABI(cx, OBJECT_TO_JSVAL(funInfoFinalizer->mABI), &abi)) {
|
||||
if (!GetABI(cx, ObjectOrNullValue(funInfoFinalizer->mABI), &abi)) {
|
||||
JS_ReportError(cx, "Internal Error: "
|
||||
"Invalid ABI specification in CDataFinalizer");
|
||||
return false;
|
||||
|
|
|
@ -32,13 +32,13 @@ BEGIN_TEST(testAddPropertyHook)
|
|||
|
||||
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||
CHECK(obj);
|
||||
JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS::RootedValue proto(cx, JS::ObjectValue(*obj));
|
||||
JS_InitClass(cx, global, obj, &AddPropertyClass, nullptr, 0, nullptr, nullptr, nullptr,
|
||||
nullptr);
|
||||
|
||||
obj = JS_NewArrayObject(cx, 0);
|
||||
CHECK(obj);
|
||||
JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS::RootedValue arr(cx, JS::ObjectValue(*obj));
|
||||
|
||||
CHECK(JS_DefineProperty(cx, global, "arr", arr,
|
||||
JSPROP_ENUMERATE,
|
||||
|
|
|
@ -20,17 +20,17 @@ BEGIN_TEST(testDefineGetterSetterNonEnumerable)
|
|||
JS::RootedValue vobj(cx);
|
||||
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||
CHECK(obj);
|
||||
vobj = OBJECT_TO_JSVAL(obj);
|
||||
vobj.setObject(*obj);
|
||||
|
||||
JSFunction* funGet = JS_NewFunction(cx, NativeGetterSetter, 0, 0, "get");
|
||||
CHECK(funGet);
|
||||
JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
|
||||
JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
|
||||
JS::RootedValue vget(cx, JS::ObjectValue(*funGetObj));
|
||||
|
||||
JSFunction* funSet = JS_NewFunction(cx, NativeGetterSetter, 1, 0, "set");
|
||||
CHECK(funSet);
|
||||
JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
|
||||
JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
|
||||
JS::RootedValue vset(cx, JS::ObjectValue(*funSetObj));
|
||||
|
||||
JS::RootedObject vObject(cx, vobj.toObjectOrNull());
|
||||
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
||||
|
|
|
@ -57,7 +57,7 @@ struct LooseEqualityData
|
|||
i42 = INT_TO_JSVAL(42);
|
||||
undef = JS::UndefinedValue();
|
||||
null = JS::NullValue();
|
||||
obj = OBJECT_TO_JSVAL(JS::CurrentGlobalOrNull(cx));
|
||||
obj = JS::ObjectOrNullValue(JS::CurrentGlobalOrNull(cx));
|
||||
poszero = DOUBLE_TO_JSVAL(0.0);
|
||||
negzero = DOUBLE_TO_JSVAL(-0.0);
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -125,7 +125,7 @@ bool TestCloneObject()
|
|||
JS::RootedObject obj1(cx, CreateNewObject(8, 12));
|
||||
CHECK(obj1);
|
||||
JSAutoStructuredCloneBuffer cloned_buffer;
|
||||
JS::RootedValue v1(cx, OBJECT_TO_JSVAL(obj1));
|
||||
JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
|
||||
const JSStructuredCloneCallbacks* callbacks = js::GetContextStructuredCloneCallbacks(cx);
|
||||
CHECK(cloned_buffer.write(cx, v1, callbacks, nullptr));
|
||||
JS::RootedValue v2(cx);
|
||||
|
@ -152,14 +152,14 @@ bool TestTransferObject()
|
|||
{
|
||||
JS::RootedObject obj1(cx, CreateNewObject(8, 12));
|
||||
CHECK(obj1);
|
||||
JS::RootedValue v1(cx, OBJECT_TO_JSVAL(obj1));
|
||||
JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
|
||||
|
||||
// Create an Array of transferable values.
|
||||
JS::AutoValueVector argv(cx);
|
||||
argv.append(v1);
|
||||
JS::RootedObject obj(cx, JS_NewArrayObject(cx, JS::HandleValueArray::subarray(argv, 0, 1)));
|
||||
CHECK(obj);
|
||||
JS::RootedValue transferable(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS::RootedValue transferable(cx, JS::ObjectValue(*obj));
|
||||
|
||||
JSAutoStructuredCloneBuffer cloned_buffer;
|
||||
const JSStructuredCloneCallbacks* callbacks = js::GetContextStructuredCloneCallbacks(cx);
|
||||
|
|
|
@ -75,7 +75,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
argv[0].setInt32(4);
|
||||
obj = JS_New(cx, Array, JS::HandleValueArray::subarray(argv, 0, 1));
|
||||
CHECK(obj);
|
||||
rt = OBJECT_TO_JSVAL(obj);
|
||||
rt = JS::ObjectValue(*obj);
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetArrayLength(cx, obj, &len));
|
||||
CHECK_EQUAL(len, 4u);
|
||||
|
@ -85,7 +85,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
argv[i].setInt32(i);
|
||||
obj = JS_New(cx, Array, JS::HandleValueArray::subarray(argv, 0, N));
|
||||
CHECK(obj);
|
||||
rt = OBJECT_TO_JSVAL(obj);
|
||||
rt = JS::ObjectValue(*obj);
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetArrayLength(cx, obj, &len));
|
||||
CHECK_EQUAL(len, N);
|
||||
|
@ -102,7 +102,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
};
|
||||
JS::RootedObject ctor(cx, JS_NewObject(cx, &cls));
|
||||
CHECK(ctor);
|
||||
JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
|
||||
JS::RootedValue rt2(cx, JS::ObjectValue(*ctor));
|
||||
obj = JS_New(cx, ctor, JS::HandleValueArray::subarray(argv, 0, 3));
|
||||
CHECK(obj);
|
||||
CHECK(JS_GetElement(cx, ctor, 0, &v));
|
||||
|
|
|
@ -34,7 +34,7 @@ createMyObject(JSContext* context, unsigned argc, jsval* vp)
|
|||
//JS_GC(context); //<- if we make GC here, all is ok
|
||||
|
||||
JSObject* myObject = JS_NewObject(context, &myClass);
|
||||
*vp = OBJECT_TO_JSVAL(myObject);
|
||||
*vp = JS::ObjectOrNullValue(myObject);
|
||||
|
||||
JS_EndRequest(context);
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ BEGIN_TEST(testParseJSON_reviver)
|
|||
JSFunction* fun = JS_NewFunction(cx, Censor, 0, 0, "censor");
|
||||
CHECK(fun);
|
||||
|
||||
JS::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)));
|
||||
JS::RootedValue filter(cx, JS::ObjectValue(*JS_GetFunctionObject(fun)));
|
||||
|
||||
CHECK(TryParse(cx, "true", filter));
|
||||
CHECK(TryParse(cx, "false", filter));
|
||||
|
|
|
@ -990,7 +990,7 @@ CacheEntry_setBytecode(JSContext* cx, HandleObject cache, uint8_t* buffer, uint3
|
|||
if (!arrayBuffer)
|
||||
return false;
|
||||
|
||||
SetReservedSlot(cache, CacheEntry_BYTECODE, OBJECT_TO_JSVAL(arrayBuffer));
|
||||
SetReservedSlot(cache, CacheEntry_BYTECODE, ObjectValue(*arrayBuffer));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ static bool
|
|||
sandbox_convert(JSContext* cx, HandleObject obj, JSType type, MutableHandleValue vp)
|
||||
{
|
||||
if (type == JSTYPE_OBJECT) {
|
||||
vp.set(OBJECT_TO_JSVAL(obj));
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1189,7 +1189,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
|
|||
goto pre_call_clean_up;
|
||||
}
|
||||
}
|
||||
*sp++ = OBJECT_TO_JSVAL(out_obj);
|
||||
*sp++ = JS::ObjectValue(*out_obj);
|
||||
} else
|
||||
*sp++ = val;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
|
|||
js::SetFunctionNativeReserved(funobj, XPC_FUNCTION_PARENT_OBJECT_SLOT,
|
||||
ObjectValue(*parent));
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(funobj);
|
||||
vp->setObject(*funobj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ static bool
|
|||
XPC_WN_Shared_Convert(JSContext* cx, HandleObject obj, JSType type, MutableHandleValue vp)
|
||||
{
|
||||
if (type == JSTYPE_OBJECT) {
|
||||
vp.set(OBJECT_TO_JSVAL(obj));
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ XPC_WN_Shared_Convert(JSContext* cx, HandleObject obj, JSType type, MutableHandl
|
|||
XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
|
||||
if (si && (si->GetFlags().WantCall() ||
|
||||
si->GetFlags().WantConstruct())) {
|
||||
vp.set(OBJECT_TO_JSVAL(obj));
|
||||
vp.setObject(*obj);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1002,7 +1002,7 @@ XrayTraits::attachExpandoObject(JSContext* cx, HandleObject target,
|
|||
|
||||
// Note the exclusive global, if any.
|
||||
JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_EXCLUSIVE_GLOBAL,
|
||||
OBJECT_TO_JSVAL(exclusiveGlobal));
|
||||
ObjectOrNullValue(exclusiveGlobal));
|
||||
|
||||
// If this is our first expando object, take the opportunity to preserve
|
||||
// the wrapper. This keeps our expandos alive even if the Xray wrapper gets
|
||||
|
@ -1012,7 +1012,7 @@ XrayTraits::attachExpandoObject(JSContext* cx, HandleObject target,
|
|||
preserveWrapper(target);
|
||||
|
||||
// Insert it at the front of the chain.
|
||||
JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_NEXT, OBJECT_TO_JSVAL(chain));
|
||||
JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_NEXT, ObjectOrNullValue(chain));
|
||||
setExpandoChain(cx, target, expandoObject);
|
||||
|
||||
return expandoObject;
|
||||
|
|
|
@ -66,7 +66,7 @@ AsyncStatementJSHelper::getParams(AsyncStatement *aStatement,
|
|||
obj = aStatement->mStatementParamsHolder->GetJSObject();
|
||||
NS_ENSURE_STATE(obj);
|
||||
|
||||
*_params = OBJECT_TO_JSVAL(obj);
|
||||
_params->setObject(*obj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ StatementJSHelper::getRow(Statement *aStatement,
|
|||
obj = aStatement->mStatementRowHolder->GetJSObject();
|
||||
NS_ENSURE_STATE(obj);
|
||||
|
||||
*_row = OBJECT_TO_JSVAL(obj);
|
||||
_row->setObject(*obj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ StatementJSHelper::getParams(Statement *aStatement,
|
|||
obj = aStatement->mStatementParamsHolder->GetJSObject();
|
||||
NS_ENSURE_STATE(obj);
|
||||
|
||||
*_params = OBJECT_TO_JSVAL(obj);
|
||||
_params->setObject(*obj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ StatementRow::GetProperty(nsIXPConnectWrappedNative *aWrapper,
|
|||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
*_vp = OBJECT_TO_JSVAL(obj);
|
||||
_vp->setObject(*obj);
|
||||
|
||||
// Copy the blob over to the JS array.
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
|
|
|
@ -254,7 +254,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext)
|
|||
"unable to get jsobj from xpconnect wrapper");
|
||||
if (!jsobj) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
JS::Rooted<JS::Value> jslistener(cx, OBJECT_TO_JSVAL(jsobj));
|
||||
JS::Rooted<JS::Value> jslistener(cx, JS::ObjectValue(*jsobj));
|
||||
|
||||
// ...and stuff it into the global context
|
||||
bool ok = JS_SetProperty(cx, global, "HTTPIndex", jslistener);
|
||||
|
|
Загрузка…
Ссылка в новой задаче