Bug 952650 (part 3) - Remove JSVAL_TO_BOOLEAN. r=njn.

--HG--
extra : rebase_source : fbe97c23a4893b8c4c5641f41947f3a96f7111d3
This commit is contained in:
Rodrigo Rodriguez Jr. 2014-04-27 19:34:12 -07:00
parent ce08f289ef
commit 2898f2d2f9
7 changed files with 9 additions and 16 deletions

View File

@ -387,7 +387,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
} else if (val.isNull()) {
NULL_TO_NPVARIANT(*variant);
} else if (JSVAL_IS_BOOLEAN(val)) {
BOOLEAN_TO_NPVARIANT(JSVAL_TO_BOOLEAN(val), *variant);
BOOLEAN_TO_NPVARIANT(val.toBoolean(), *variant);
} else if (JSVAL_IS_INT(val)) {
INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
} else if (JSVAL_IS_DOUBLE(val)) {

View File

@ -70,7 +70,7 @@ public:
NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
{
if (JSVAL_IS_BOOLEAN(aResult)) {
bool isSharingEnabled = JSVAL_TO_BOOLEAN(aResult);
bool isSharingEnabled = aResult.toBoolean();
SetAutoMounterSharingMode(mVolumeName, isSharingEnabled);
}
return NS_OK;

View File

@ -308,7 +308,7 @@ JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsva
jsval value = *vp;
switch (infoType) {
case SkType_Boolean:
s32 = JSVAL_TO_BOOLEAN(value);
s32 = value.toBoolean();
break;
case SkType_Color:
case SkType_S32:

View File

@ -147,7 +147,7 @@ jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval)
jsval val = jsdval->val;
if(!JSVAL_IS_BOOLEAN(val))
return false;
return JSVAL_TO_BOOLEAN(val);
return val.toBoolean();
}
int32_t

View File

@ -1932,13 +1932,6 @@ JSVAL_IS_BOOLEAN(jsval v)
return JSVAL_IS_BOOLEAN_IMPL(JSVAL_TO_IMPL(v));
}
static inline bool
JSVAL_TO_BOOLEAN(jsval v)
{
MOZ_ASSERT(JSVAL_IS_BOOLEAN(v));
return JSVAL_TO_BOOLEAN_IMPL(JSVAL_TO_IMPL(v));
}
static inline jsval
BOOLEAN_TO_JSVAL(bool b)
{

View File

@ -1385,7 +1385,7 @@ SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj)
size_t n = 0;
jsval slot = JS_GetReservedSlot(obj, ctypes::SLOT_OWNS);
if (!slot.isUndefined()) {
bool owns = JSVAL_TO_BOOLEAN(slot);
bool owns = slot.toBoolean();
slot = JS_GetReservedSlot(obj, ctypes::SLOT_DATA);
if (!slot.isUndefined()) {
char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot));
@ -1576,7 +1576,7 @@ static bool
jsvalToBool(JSContext* cx, jsval val, bool* result)
{
if (JSVAL_IS_BOOLEAN(val)) {
*result = JSVAL_TO_BOOLEAN(val);
*result = val.toBoolean();
return true;
}
if (JSVAL_IS_INT(val)) {
@ -1675,7 +1675,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
}
if (JSVAL_IS_BOOLEAN(val)) {
// Implicitly promote boolean values to 0 or 1, like C.
*result = JSVAL_TO_BOOLEAN(val);
*result = val.toBoolean();
JS_ASSERT(*result == 0 || *result == 1);
return true;
}
@ -6357,7 +6357,7 @@ CData::Finalize(JSFreeOp *fop, JSObject* obj)
if (slot.isUndefined())
return;
bool owns = JSVAL_TO_BOOLEAN(slot);
bool owns = slot.toBoolean();
slot = JS_GetReservedSlot(obj, SLOT_DATA);
if (slot.isUndefined())

View File

@ -1903,7 +1903,7 @@ IonBuilder::inlineAssertFloat32(CallInfo &callInfo)
JS_ASSERT(secondArg->type() == MIRType_Boolean);
JS_ASSERT(secondArg->isConstant());
bool mustBeFloat32 = JSVAL_TO_BOOLEAN(secondArg->toConstant()->value());
bool mustBeFloat32 = secondArg->toConstant()->value().toBoolean();
current->add(MAssertFloat32::New(alloc(), callInfo.getArg(0), mustBeFloat32));
MConstant *undefined = MConstant::New(alloc(), UndefinedValue());