mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 952650 (part 16) - Remove JSVAL_TO_PRIVATE. r=till.
--HG-- extra : rebase_source : 603bb66a90484b488bedf1dd4da6935324c148c6
This commit is contained in:
parent
46355af5ad
commit
4ace98fae9
@ -3844,8 +3844,7 @@ nsStorage2SH::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<nsString> *keys =
|
||||
(nsTArray<nsString> *)JSVAL_TO_PRIVATE(*statep);
|
||||
nsTArray<nsString> *keys = (nsTArray<nsString> *)statep->toPrivate();
|
||||
|
||||
if (enum_op == JSENUMERATE_NEXT && keys->Length() != 0) {
|
||||
nsString& key = keys->ElementAt(0);
|
||||
|
@ -1498,7 +1498,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp
|
||||
break;
|
||||
|
||||
case JSENUMERATE_NEXT:
|
||||
state = (NPObjectEnumerateState *)JSVAL_TO_PRIVATE(*statep);
|
||||
state = (NPObjectEnumerateState *)statep->toPrivate();
|
||||
enum_value = state->value;
|
||||
length = state->length;
|
||||
if (state->index != length) {
|
||||
@ -1509,7 +1509,7 @@ NPObjWrapper_newEnumerate(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp
|
||||
// FALL THROUGH
|
||||
|
||||
case JSENUMERATE_DESTROY:
|
||||
state = (NPObjectEnumerateState *)JSVAL_TO_PRIVATE(*statep);
|
||||
state = (NPObjectEnumerateState *)statep->toPrivate();
|
||||
if (state->value)
|
||||
PR_Free(state->value);
|
||||
delete state;
|
||||
|
@ -780,7 +780,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
||||
|
||||
JS::Value protoBinding = ::JS_GetReservedSlot(proto, 0);
|
||||
|
||||
if (JSVAL_TO_PRIVATE(protoBinding) != mPrototypeBinding) {
|
||||
if (protoBinding.toPrivate() != mPrototypeBinding) {
|
||||
// Not the right binding
|
||||
continue;
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
|
||||
jsval closure)
|
||||
{
|
||||
JS::RootedScript script(cx, script_);
|
||||
JSDExecHook* jsdhook = (JSDExecHook*) JSVAL_TO_PRIVATE(closure);
|
||||
JSDExecHook* jsdhook = (JSDExecHook*) closure.toPrivate();
|
||||
JSD_ExecutionHookProc hook;
|
||||
void* hookData;
|
||||
JSDContext* jsdc;
|
||||
|
@ -1882,13 +1882,6 @@ PRIVATE_TO_JSVAL(void *ptr)
|
||||
return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr));
|
||||
}
|
||||
|
||||
static inline void *
|
||||
JSVAL_TO_PRIVATE(jsval v)
|
||||
{
|
||||
MOZ_ASSERT(v.isDouble());
|
||||
return JSVAL_TO_PRIVATE_PTR_IMPL(JSVAL_TO_IMPL(v));
|
||||
}
|
||||
|
||||
// JS constants. For efficiency, prefer predicates (e.g. v.isNull()) and
|
||||
// constructing values from scratch (e.g. Int32Value(0)). These constants are
|
||||
// stored in memory and initialized at startup, so testing against them and
|
||||
|
@ -1289,7 +1289,7 @@ GetCallbacks(JSObject* obj)
|
||||
if (result.isUndefined())
|
||||
return nullptr;
|
||||
|
||||
return static_cast<JSCTypesCallbacks*>(JSVAL_TO_PRIVATE(result));
|
||||
return static_cast<JSCTypesCallbacks*>(result.toPrivate());
|
||||
}
|
||||
|
||||
// Utility function to access a property of an object as an object
|
||||
@ -1388,7 +1388,7 @@ SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj)
|
||||
bool owns = slot.toBoolean();
|
||||
slot = JS_GetReservedSlot(obj, ctypes::SLOT_DATA);
|
||||
if (!slot.isUndefined()) {
|
||||
char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot));
|
||||
char** buffer = static_cast<char**>(slot.toPrivate());
|
||||
n += mallocSizeOf(buffer);
|
||||
if (owns)
|
||||
n += mallocSizeOf(*buffer);
|
||||
@ -3299,7 +3299,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
// Free the FunctionInfo.
|
||||
slot = JS_GetReservedSlot(obj, SLOT_FNINFO);
|
||||
if (!slot.isUndefined())
|
||||
FreeOp::get(fop)->delete_(static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot)));
|
||||
FreeOp::get(fop)->delete_(static_cast<FunctionInfo*>(slot.toPrivate()));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3307,7 +3307,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
// Free the FieldInfoHash table.
|
||||
slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO);
|
||||
if (!slot.isUndefined()) {
|
||||
void* info = JSVAL_TO_PRIVATE(slot);
|
||||
void* info = slot.toPrivate();
|
||||
FreeOp::get(fop)->delete_(static_cast<FieldInfoHash*>(info));
|
||||
}
|
||||
}
|
||||
@ -3317,7 +3317,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
// Free the ffi_type info.
|
||||
slot = JS_GetReservedSlot(obj, SLOT_FFITYPE);
|
||||
if (!slot.isUndefined()) {
|
||||
ffi_type* ffiType = static_cast<ffi_type*>(JSVAL_TO_PRIVATE(slot));
|
||||
ffi_type* ffiType = static_cast<ffi_type*>(slot.toPrivate());
|
||||
FreeOp::get(fop)->free_(ffiType->elements);
|
||||
FreeOp::get(fop)->delete_(ffiType);
|
||||
}
|
||||
@ -3345,8 +3345,7 @@ CType::Trace(JSTracer* trc, JSObject* obj)
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
|
||||
FieldInfoHash* fields =
|
||||
static_cast<FieldInfoHash*>(JSVAL_TO_PRIVATE(slot));
|
||||
FieldInfoHash* fields = static_cast<FieldInfoHash*>(slot.toPrivate());
|
||||
for (FieldInfoHash::Enum e(*fields); !e.empty(); e.popFront()) {
|
||||
JSString *key = e.front().key();
|
||||
JS_CallStringTracer(trc, &key, "fieldName");
|
||||
@ -3363,7 +3362,7 @@ CType::Trace(JSTracer* trc, JSObject* obj)
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
|
||||
FunctionInfo* fninfo = static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot));
|
||||
FunctionInfo* fninfo = static_cast<FunctionInfo*>(slot.toPrivate());
|
||||
JS_ASSERT(fninfo);
|
||||
|
||||
// Identify our objects to the tracer.
|
||||
@ -3539,7 +3538,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj)
|
||||
jsval slot = JS_GetReservedSlot(obj, SLOT_FFITYPE);
|
||||
|
||||
if (!slot.isUndefined()) {
|
||||
return static_cast<ffi_type*>(JSVAL_TO_PRIVATE(slot));
|
||||
return static_cast<ffi_type*>(slot.toPrivate());
|
||||
}
|
||||
|
||||
AutoPtr<ffi_type> result;
|
||||
@ -5090,9 +5089,9 @@ StructType::GetFieldInfo(JSObject* obj)
|
||||
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct);
|
||||
|
||||
jsval slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO);
|
||||
JS_ASSERT(!slot.isUndefined() && JSVAL_TO_PRIVATE(slot));
|
||||
JS_ASSERT(!slot.isUndefined() && slot.toPrivate());
|
||||
|
||||
return static_cast<const FieldInfoHash*>(JSVAL_TO_PRIVATE(slot));
|
||||
return static_cast<const FieldInfoHash*>(slot.toPrivate());
|
||||
}
|
||||
|
||||
const FieldInfo*
|
||||
@ -5906,9 +5905,9 @@ FunctionType::GetFunctionInfo(JSObject* obj)
|
||||
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_function);
|
||||
|
||||
jsval slot = JS_GetReservedSlot(obj, SLOT_FNINFO);
|
||||
JS_ASSERT(!slot.isUndefined() && JSVAL_TO_PRIVATE(slot));
|
||||
JS_ASSERT(!slot.isUndefined() && slot.toPrivate());
|
||||
|
||||
return static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot));
|
||||
return static_cast<FunctionInfo*>(slot.toPrivate());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -6089,7 +6088,7 @@ CClosure::Trace(JSTracer* trc, JSObject* obj)
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
|
||||
ClosureInfo* cinfo = static_cast<ClosureInfo*>(JSVAL_TO_PRIVATE(slot));
|
||||
ClosureInfo* cinfo = static_cast<ClosureInfo*>(slot.toPrivate());
|
||||
|
||||
// Identify our objects to the tracer. (There's no need to identify
|
||||
// 'closureObj', since that's us.)
|
||||
@ -6107,7 +6106,7 @@ CClosure::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
|
||||
ClosureInfo* cinfo = static_cast<ClosureInfo*>(JSVAL_TO_PRIVATE(slot));
|
||||
ClosureInfo* cinfo = static_cast<ClosureInfo*>(slot.toPrivate());
|
||||
FreeOp::get(fop)->delete_(cinfo);
|
||||
}
|
||||
|
||||
@ -6356,7 +6355,7 @@ CData::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
slot = JS_GetReservedSlot(obj, SLOT_DATA);
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot));
|
||||
char** buffer = static_cast<char**>(slot.toPrivate());
|
||||
|
||||
if (owns)
|
||||
FreeOp::get(fop)->free_(*buffer);
|
||||
@ -6381,7 +6380,7 @@ CData::GetData(JSObject* dataObj)
|
||||
|
||||
jsval slot = JS_GetReservedSlot(dataObj, SLOT_DATA);
|
||||
|
||||
void** buffer = static_cast<void**>(JSVAL_TO_PRIVATE(slot));
|
||||
void** buffer = static_cast<void**>(slot.toPrivate());
|
||||
JS_ASSERT(buffer);
|
||||
JS_ASSERT(*buffer);
|
||||
return *buffer;
|
||||
@ -7300,7 +7299,7 @@ Int64Base::Finalize(JSFreeOp *fop, JSObject* obj)
|
||||
if (slot.isUndefined())
|
||||
return;
|
||||
|
||||
FreeOp::get(fop)->delete_(static_cast<uint64_t*>(JSVAL_TO_PRIVATE(slot)));
|
||||
FreeOp::get(fop)->delete_(static_cast<uint64_t*>(slot.toPrivate()));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
@ -7308,7 +7307,7 @@ Int64Base::GetInt(JSObject* obj) {
|
||||
JS_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj));
|
||||
|
||||
jsval slot = JS_GetReservedSlot(obj, SLOT_INT64);
|
||||
return *static_cast<uint64_t*>(JSVAL_TO_PRIVATE(slot));
|
||||
return *static_cast<uint64_t*>(slot.toPrivate());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -178,7 +178,7 @@ Library::GetLibrary(JSObject* obj)
|
||||
JS_ASSERT(IsLibrary(obj));
|
||||
|
||||
jsval slot = JS_GetReservedSlot(obj, SLOT_LIBRARY);
|
||||
return static_cast<PRLibrary*>(JSVAL_TO_PRIVATE(slot));
|
||||
return static_cast<PRLibrary*>(slot.toPrivate());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -764,7 +764,7 @@ nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
nsCOMPtr<nsISupports> isup;
|
||||
bool hasMore;
|
||||
e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
|
||||
e = (nsISimpleEnumerator*) statep->toPrivate();
|
||||
|
||||
if (NS_SUCCEEDED(e->HasMoreElements(&hasMore)) && hasMore &&
|
||||
NS_SUCCEEDED(e->GetNext(getter_AddRefs(isup))) && isup) {
|
||||
@ -786,7 +786,7 @@ nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
case JSENUMERATE_DESTROY:
|
||||
default:
|
||||
e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
|
||||
e = (nsISimpleEnumerator*) statep->toPrivate();
|
||||
NS_IF_RELEASE(e);
|
||||
*statep = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
@ -1004,7 +1004,7 @@ nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
nsCOMPtr<nsISupports> isup;
|
||||
bool hasMore;
|
||||
e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
|
||||
e = (nsISimpleEnumerator*) statep->toPrivate();
|
||||
|
||||
if (NS_SUCCEEDED(e->HasMoreElements(&hasMore)) && hasMore &&
|
||||
NS_SUCCEEDED(e->GetNext(getter_AddRefs(isup))) && isup) {
|
||||
@ -1027,7 +1027,7 @@ nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
case JSENUMERATE_DESTROY:
|
||||
default:
|
||||
e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
|
||||
e = (nsISimpleEnumerator*) statep->toPrivate();
|
||||
NS_IF_RELEASE(e);
|
||||
*statep = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
@ -1264,7 +1264,7 @@ nsXPCComponents_Results::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
case JSENUMERATE_NEXT:
|
||||
{
|
||||
const char* name;
|
||||
iter = (const void**) JSVAL_TO_PRIVATE(*statep);
|
||||
iter = (const void**) statep->toPrivate();
|
||||
if (nsXPCException::IterateNSResults(nullptr, &name, nullptr, iter)) {
|
||||
RootedString idstr(cx, JS_NewStringCopyZ(cx, name));
|
||||
JS::RootedId id(cx);
|
||||
@ -1278,7 +1278,7 @@ nsXPCComponents_Results::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
case JSENUMERATE_DESTROY:
|
||||
default:
|
||||
iter = (const void**) JSVAL_TO_PRIVATE(*statep);
|
||||
iter = (const void**) statep->toPrivate();
|
||||
delete [] (char*) iter;
|
||||
*statep = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
|
@ -30,8 +30,8 @@ XPCNativeMember::GetCallInfo(JSObject* funobj,
|
||||
jsval ifaceVal = js::GetFunctionNativeReserved(funobj, 0);
|
||||
jsval memberVal = js::GetFunctionNativeReserved(funobj, 1);
|
||||
|
||||
*pInterface = (XPCNativeInterface*) JSVAL_TO_PRIVATE(ifaceVal);
|
||||
*pMember = (XPCNativeMember*) JSVAL_TO_PRIVATE(memberVal);
|
||||
*pInterface = (XPCNativeInterface*) ifaceVal.toPrivate();
|
||||
*pMember = (XPCNativeMember*) memberVal.toPrivate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user