зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952650 (part 13) - Remove JSVAL_IS_PRIMITIVE. r=till.
--HG-- extra : rebase_source : 450ba0261ef5a8546c81f9f645605e312585d6c6
This commit is contained in:
Родитель
530542eecd
Коммит
1c5751ac95
|
@ -2450,7 +2450,7 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult, uint64_t* aContentLe
|
|||
JS::Rooted<JS::Value> realVal(cx);
|
||||
|
||||
nsresult rv = aBody->GetAsJSVal(&realVal);
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(realVal)) {
|
||||
if (NS_SUCCEEDED(rv) && !realVal.isPrimitive()) {
|
||||
JS::Rooted<JSObject*> obj(cx, realVal.toObjectOrNull());
|
||||
if (JS_IsArrayBufferObject(obj)) {
|
||||
ArrayBuffer buf(obj);
|
||||
|
|
|
@ -106,7 +106,7 @@ JSValToDashArray(JSContext* cx, const JS::Value& patternArray,
|
|||
// anybody...
|
||||
static const uint32_t MAX_NUM_DASHES = 1 << 14;
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(patternArray)) {
|
||||
if (!patternArray.isPrimitive()) {
|
||||
JS::Rooted<JSObject*> obj(cx, patternArray.toObjectOrNull());
|
||||
uint32_t length;
|
||||
if (!JS_GetArrayLength(cx, obj, &length)) {
|
||||
|
|
|
@ -1428,7 +1428,7 @@ nsDOMClassInfo::ResolveConstructor(JSContext *cx, JSObject *aObj,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
// If val is not an (non-null) object there either is no
|
||||
// constructor for this class, or someone messed with
|
||||
// window.classname, just fall through and let the JS engine
|
||||
|
@ -2273,7 +2273,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
{
|
||||
// No need to look these up in the hash.
|
||||
*bp = false;
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (v.isPrimitive()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2305,7 +2305,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (val.isPrimitive()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3034,7 +3034,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(prop_val) && !prop_val.isNull()) {
|
||||
if (prop_val.isPrimitive() && !prop_val.isNull()) {
|
||||
if (aWin->IsOuterWindow()) {
|
||||
nsGlobalWindow *inner = aWin->GetCurrentInnerWindowInternal();
|
||||
NS_ENSURE_TRUE(inner, NS_ERROR_UNEXPECTED);
|
||||
|
|
|
@ -2386,7 +2386,7 @@ nsDOMWindowUtils::GetClassName(JS::Handle<JS::Value> aObject, JSContext* aCx,
|
|||
}
|
||||
|
||||
// Our argument must be a non-null object.
|
||||
if (JSVAL_IS_PRIMITIVE(aObject)) {
|
||||
if (aObject.isPrimitive()) {
|
||||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
}
|
||||
|
||||
|
@ -3212,7 +3212,7 @@ nsDOMWindowUtils::GetFileId(JS::Handle<JS::Value> aFile, JSContext* aCx,
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(aFile)) {
|
||||
if (!aFile.isPrimitive()) {
|
||||
JSObject* obj = aFile.toObjectOrNull();
|
||||
|
||||
file::FileHandle* fileHandle;
|
||||
|
|
|
@ -96,7 +96,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
nsString targetObjectPropName;
|
||||
JS::Rooted<JSObject*> targetObject(aCx, nullptr);
|
||||
JS::Rooted<JSObject*> obj(aCx,
|
||||
JSVAL_IS_PRIMITIVE(aValue) ? nullptr : aValue.toObjectOrNull());
|
||||
aValue.isPrimitive() ? nullptr : aValue.toObjectOrNull());
|
||||
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
const nsDependentSubstring& token = tokenizer.nextToken();
|
||||
|
@ -129,7 +129,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
}
|
||||
if (tokenizer.hasMoreTokens()) {
|
||||
// ...and walk to it if there are more steps...
|
||||
if (JSVAL_IS_PRIMITIVE(intermediate)) {
|
||||
if (intermediate.isPrimitive()) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
||||
}
|
||||
obj = intermediate.toObjectOrNull();
|
||||
|
|
|
@ -411,7 +411,7 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
|
|||
JS::Rooted<JS::Value> result(cx, mOpenRequest->GetResult(cx, error));
|
||||
ENSURE_SUCCESS(error, error.ErrorCode());
|
||||
|
||||
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
|
||||
MOZ_ASSERT(!result.isPrimitive());
|
||||
|
||||
IDBDatabase *database;
|
||||
rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
|
||||
|
|
|
@ -381,7 +381,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
|
|||
{
|
||||
NS_ASSERTION(npp, "Must have an NPP to wrap a jsval!");
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (val.isPrimitive()) {
|
||||
if (val == JSVAL_VOID) {
|
||||
VOID_TO_NPVARIANT(*variant);
|
||||
} else if (val.isNull()) {
|
||||
|
@ -593,7 +593,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
|
|||
JS::Rooted<JS::Value> v(cx);
|
||||
bool ok = GetProperty(cx, npjsobj->mJSObj, id, &v);
|
||||
|
||||
return ok && !JSVAL_IS_PRIMITIVE(v) &&
|
||||
return ok && !v.isPrimitive() &&
|
||||
::JS_ObjectIsFunction(cx, v.toObjectOrNull());
|
||||
}
|
||||
|
||||
|
@ -1594,10 +1594,10 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
|
|||
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
|
||||
if (!JS_GetProperty(cx, obj, "toString", &v))
|
||||
return false;
|
||||
if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, v.toObjectOrNull())) {
|
||||
if (!v.isPrimitive() && JS_ObjectIsCallable(cx, v.toObjectOrNull())) {
|
||||
if (!JS_CallFunctionValue(cx, obj, v, JS::HandleValueArray::empty(), vp))
|
||||
return false;
|
||||
if (JSVAL_IS_PRIMITIVE(vp))
|
||||
if (vp.isPrimitive())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2098,7 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
|
|||
// Our NPIdentifier is not always interned, so we must root it explicitly.
|
||||
JS_CallHeapIdTracer(trc, &memberPrivate->methodName, "NPObjectMemberPrivate.methodName");
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) {
|
||||
if (!memberPrivate->fieldValue.isPrimitive()) {
|
||||
JS_CallHeapValueTracer(trc, &memberPrivate->fieldValue,
|
||||
"NPObject Member => fieldValue");
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ PostToNFC(JSContext* aCx,
|
|||
|
||||
data = abs.ptr();
|
||||
size = abs.length();
|
||||
} else if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
} else if (!v.isPrimitive()) {
|
||||
JSObject* obj = v.toObjectOrNull();
|
||||
if (!JS_IsTypedArrayObject(obj)) {
|
||||
JS_ReportError(aCx, "Object passed in wasn't a typed array");
|
||||
|
|
|
@ -103,7 +103,7 @@ PostToRIL(JSContext *aCx,
|
|||
|
||||
data = abs.ptr();
|
||||
size = abs.length();
|
||||
} else if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
} else if (!v.isPrimitive()) {
|
||||
JSObject *obj = v.toObjectOrNull();
|
||||
if (!JS_IsTypedArrayObject(obj)) {
|
||||
JS_ReportError(aCx, "Object passed in wasn't a typed array");
|
||||
|
|
|
@ -24,7 +24,7 @@ void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval)
|
|||
if(!JS_CLIST_IS_EMPTY(&jsdval->props))
|
||||
{
|
||||
MOZ_ASSERT(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS));
|
||||
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(jsdval->val));
|
||||
MOZ_ASSERT(!jsdval->val.isPrimitive());
|
||||
}
|
||||
|
||||
if(jsdval->proto)
|
||||
|
@ -60,7 +60,7 @@ void JSD_ASSERT_VALID_PROPERTY(JSDProperty* jsdprop)
|
|||
bool
|
||||
jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
return !JSVAL_IS_PRIMITIVE(jsdval->val) || jsdval->val.isNull();
|
||||
return !jsdval->val.isPrimitive() || jsdval->val.isNull();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -108,14 +108,14 @@ jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval)
|
|||
bool
|
||||
jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
return JSVAL_IS_PRIMITIVE(jsdval->val);
|
||||
return jsdval->val.isPrimitive();
|
||||
}
|
||||
|
||||
bool
|
||||
jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
AutoSafeJSContext cx; // NB: Actually unused.
|
||||
return !JSVAL_IS_PRIMITIVE(jsdval->val) &&
|
||||
return !jsdval->val.isPrimitive() &&
|
||||
JS_ObjectIsCallable(cx, jsdval->val.toObjectOrNull());
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval)
|
|||
MOZ_ASSERT(fun);
|
||||
return ok;
|
||||
}
|
||||
return !JSVAL_IS_PRIMITIVE(jsdval->val);
|
||||
return !jsdval->val.isPrimitive();
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -185,7 +185,7 @@ jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval)
|
|||
}
|
||||
|
||||
/* Objects call JS_ValueToString in their own compartment. */
|
||||
scopeObj = !JSVAL_IS_PRIMITIVE(jsdval->val) ? jsdval->val.toObjectOrNull() : jsdc->glob;
|
||||
scopeObj = !jsdval->val.isPrimitive() ? jsdval->val.toObjectOrNull() : jsdc->glob;
|
||||
{
|
||||
JSAutoCompartment ac(cx, scopeObj);
|
||||
AutoSaveExceptionState as(cx);
|
||||
|
@ -362,9 +362,9 @@ static bool _buildProps(JSDContext* jsdc, JSDValue* jsdval)
|
|||
|
||||
MOZ_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props));
|
||||
MOZ_ASSERT(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS)));
|
||||
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(jsdval->val));
|
||||
MOZ_ASSERT(!jsdval->val.isPrimitive());
|
||||
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
if(jsdval->val.isPrimitive())
|
||||
return false;
|
||||
|
||||
obj = jsdval->val.toObjectOrNull();
|
||||
|
@ -567,7 +567,7 @@ jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval)
|
|||
JS::RootedObject obj(cx);
|
||||
JS::RootedFunction fun(cx);
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
if (jsdval->val.isPrimitive())
|
||||
return nullptr;
|
||||
|
||||
obj = js::UncheckedUnwrap(jsdval->val.toObjectOrNull());
|
||||
|
@ -588,7 +588,7 @@ jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
|||
JS::RootedObject proto(cx);
|
||||
MOZ_ASSERT(!jsdval->proto);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_PROTO);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
if(jsdval->val.isPrimitive())
|
||||
return nullptr;
|
||||
obj = jsdval->val.toObjectOrNull();
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
|
@ -612,7 +612,7 @@ jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval)
|
|||
JS::RootedObject parent(cx);
|
||||
MOZ_ASSERT(!jsdval->parent);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_PARENT);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
if(jsdval->val.isPrimitive())
|
||||
return nullptr;
|
||||
obj = jsdval->val.toObjectOrNull();
|
||||
{
|
||||
|
@ -639,7 +639,7 @@ jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
|||
JS::RootedObject ctor(cx);
|
||||
MOZ_ASSERT(!jsdval->ctor);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_CTOR);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
if(jsdval->val.isPrimitive())
|
||||
return nullptr;
|
||||
obj = jsdval->val.toObjectOrNull();
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
|
@ -663,7 +663,7 @@ const char*
|
|||
jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
jsval val = jsdval->val;
|
||||
if(!jsdval->className && !JSVAL_IS_PRIMITIVE(val))
|
||||
if(!jsdval->className && !val.isPrimitive())
|
||||
{
|
||||
JS::RootedObject obj(jsdc->jsrt, val.toObjectOrNull());
|
||||
AutoSafeJSContext cx;
|
||||
|
|
|
@ -2172,7 +2172,7 @@ jsdValue::GetJsType (uint32_t *_rval)
|
|||
*_rval = TYPE_VOID;
|
||||
else if (JSD_IsValueFunction (mCx, mValue))
|
||||
*_rval = TYPE_FUNCTION;
|
||||
else if (!JSVAL_IS_PRIMITIVE(val))
|
||||
else if (!val.isPrimitive())
|
||||
*_rval = TYPE_OBJECT;
|
||||
else
|
||||
NS_ASSERTION (0, "Value has no discernible type.");
|
||||
|
|
|
@ -397,7 +397,7 @@ CallArgsFromSp(unsigned argc, Value *sp)
|
|||
MOZ_ALWAYS_INLINE JS::Value
|
||||
JS_THIS(JSContext *cx, JS::Value *vp)
|
||||
{
|
||||
return JSVAL_IS_PRIMITIVE(vp[1]) ? JS_ComputeThis(cx, vp) : vp[1];
|
||||
return vp[1].isPrimitive() ? JS_ComputeThis(cx, vp) : vp[1];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -914,10 +914,7 @@ CanonicalizeNaN(double d)
|
|||
* - The JS::Value operations are preferred. The JSVAL_* operations remain for
|
||||
* compatibility; they may be removed at some point. These operations mostly
|
||||
* provide similar functionality. But there are a few key differences. One
|
||||
* is that JS::Value gives null a separate type. Thus
|
||||
*
|
||||
* !JSVAL_IS_PRIMITIVE(v) === v.isObject()
|
||||
*
|
||||
* is that JS::Value gives null a separate type.
|
||||
* Also, to help prevent mistakenly boxing a nullable JSObject* as an object,
|
||||
* Value::setObject takes a JSObject&. (Conversely, Value::toObject returns a
|
||||
* JSObject&.) A convenience member Value::setObjectOrNull is provided.
|
||||
|
@ -1877,12 +1874,6 @@ BOOLEAN_TO_JSVAL(bool b)
|
|||
return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
JSVAL_IS_PRIMITIVE(jsval v)
|
||||
{
|
||||
return JSVAL_IS_PRIMITIVE_IMPL(JSVAL_TO_IMPL(v));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
JSVAL_IS_GCTHING(jsval v)
|
||||
{
|
||||
|
|
|
@ -1303,7 +1303,7 @@ static bool GetObjectProperty(JSContext *cx, HandleObject obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (val.isPrimitive()) {
|
||||
JS_ReportError(cx, "missing or non-object field");
|
||||
return false;
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
|
|||
double d = val.toDouble();
|
||||
return ConvertExact(d, result);
|
||||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
JSObject* obj = val.toObjectOrNull();
|
||||
if (CData::IsCData(obj)) {
|
||||
JSObject* typeObj = CData::GetCType(obj);
|
||||
|
@ -1704,7 +1704,7 @@ jsvalToFloat(JSContext *cx, jsval val, FloatType* result)
|
|||
*result = FloatType(val.toDouble());
|
||||
return true;
|
||||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
JSObject* obj = val.toObjectOrNull();
|
||||
if (CData::IsCData(obj)) {
|
||||
JSObject* typeObj = CData::GetCType(obj);
|
||||
|
@ -1827,7 +1827,7 @@ jsvalToBigInteger(JSContext* cx,
|
|||
// toString() on the object for us.)
|
||||
return StringToInteger(cx, val.toString(), result);
|
||||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
// Allow conversion from an Int64 or UInt64 object directly.
|
||||
JSObject* obj = val.toObjectOrNull();
|
||||
|
||||
|
@ -1950,7 +1950,7 @@ jsvalToIntegerExplicit(jsval val, IntegerType* result)
|
|||
*result = mozilla::IsFinite(d) ? IntegerType(d) : 0;
|
||||
return true;
|
||||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
// Convert Int64 and UInt64 values by C-style cast.
|
||||
JSObject* obj = val.toObjectOrNull();
|
||||
if (Int64::IsInt64(obj)) {
|
||||
|
@ -1995,7 +1995,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
|
|||
*result = Convert<uintptr_t>(d);
|
||||
return double(*result) == d;
|
||||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
JSObject* obj = val.toObjectOrNull();
|
||||
if (Int64::IsInt64(obj)) {
|
||||
int64_t i = Int64Base::GetInt(obj);
|
||||
|
@ -2242,7 +2242,7 @@ ImplicitConvert(JSContext* cx,
|
|||
JSObject* sourceData = nullptr;
|
||||
JSObject* sourceType = nullptr;
|
||||
RootedObject valObj(cx, nullptr);
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!val.isPrimitive()) {
|
||||
valObj = val.toObjectOrNull();
|
||||
if (CData::IsCData(valObj)) {
|
||||
sourceData = valObj;
|
||||
|
@ -2409,7 +2409,7 @@ ImplicitConvert(JSContext* cx,
|
|||
return TypeError(cx, "string pointer", val);
|
||||
}
|
||||
break;
|
||||
} else if (!JSVAL_IS_PRIMITIVE(val) && JS_IsArrayBufferObject(valObj)) {
|
||||
} else if (!val.isPrimitive() && JS_IsArrayBufferObject(valObj)) {
|
||||
// Convert ArrayBuffer to pointer without any copy.
|
||||
// Just as with C arrays, we make no effort to
|
||||
// keep the ArrayBuffer alive.
|
||||
|
@ -2418,7 +2418,7 @@ ImplicitConvert(JSContext* cx,
|
|||
return false;
|
||||
*static_cast<void**>(buffer) = p;
|
||||
break;
|
||||
} if (!JSVAL_IS_PRIMITIVE(val) && JS_IsTypedArrayObject(valObj)) {
|
||||
} if (!val.isPrimitive() && JS_IsTypedArrayObject(valObj)) {
|
||||
if(!CanConvertTypedArrayItemTo(baseType, valObj, cx)) {
|
||||
return TypeError(cx, "typed array with the appropriate type", val);
|
||||
}
|
||||
|
@ -2484,7 +2484,7 @@ ImplicitConvert(JSContext* cx,
|
|||
return TypeError(cx, "array", val);
|
||||
}
|
||||
|
||||
} else if (!JSVAL_IS_PRIMITIVE(val) && JS_IsArrayObject(cx, valObj)) {
|
||||
} else if (!val.isPrimitive() && JS_IsArrayObject(cx, valObj)) {
|
||||
// Convert each element of the array by calling ImplicitConvert.
|
||||
uint32_t sourceLength;
|
||||
if (!JS_GetArrayLength(cx, valObj, &sourceLength) ||
|
||||
|
@ -2514,7 +2514,7 @@ ImplicitConvert(JSContext* cx,
|
|||
|
||||
memcpy(buffer, intermediate.get(), arraySize);
|
||||
|
||||
} else if (!JSVAL_IS_PRIMITIVE(val) &&
|
||||
} else if (!val.isPrimitive() &&
|
||||
JS_IsArrayBufferObject(valObj)) {
|
||||
// Check that array is consistent with type, then
|
||||
// copy the array.
|
||||
|
@ -2527,7 +2527,7 @@ ImplicitConvert(JSContext* cx,
|
|||
}
|
||||
memcpy(buffer, JS_GetArrayBufferData(valObj), sourceLength);
|
||||
break;
|
||||
} else if (!JSVAL_IS_PRIMITIVE(val) &&
|
||||
} else if (!val.isPrimitive() &&
|
||||
JS_IsTypedArrayObject(valObj)) {
|
||||
// Check that array is consistent with type, then
|
||||
// copy the array.
|
||||
|
@ -2552,7 +2552,7 @@ ImplicitConvert(JSContext* cx,
|
|||
break;
|
||||
}
|
||||
case TYPE_struct: {
|
||||
if (!JSVAL_IS_PRIMITIVE(val) && !sourceData) {
|
||||
if (!val.isPrimitive() && !sourceData) {
|
||||
// Enumerate the properties of the object; if they match the struct
|
||||
// specification, convert the fields.
|
||||
RootedObject iter(cx, JS_NewPropertyIterator(cx, valObj));
|
||||
|
@ -3611,7 +3611,7 @@ CType::GetProtoFromType(JSContext* cx, JSObject* objArg, CTypeProtoSlot slot)
|
|||
|
||||
// Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype.
|
||||
jsval result = JS_GetReservedSlot(proto, slot);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(result));
|
||||
JS_ASSERT(!result.isPrimitive());
|
||||
return result.toObjectOrNull();
|
||||
}
|
||||
|
||||
|
@ -3779,7 +3779,7 @@ CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, bool*
|
|||
JS_ASSERT(CData::IsCDataProto(prototype));
|
||||
|
||||
*bp = false;
|
||||
if (JSVAL_IS_PRIMITIVE(v))
|
||||
if (v.isPrimitive())
|
||||
return true;
|
||||
|
||||
RootedObject proto(cx, &v.toObject());
|
||||
|
@ -3809,9 +3809,7 @@ CType::GetGlobalCTypes(JSContext* cx, JSObject* objArg)
|
|||
JS_ASSERT(CType::IsCTypeProto(objTypeProto));
|
||||
|
||||
jsval valCTypes = JS_GetReservedSlot(objTypeProto, SLOT_CTYPES);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCTypes));
|
||||
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCTypes));
|
||||
JS_ASSERT(!valCTypes.isPrimitive());
|
||||
return &valCTypes.toObject();
|
||||
}
|
||||
|
||||
|
@ -3881,7 +3879,7 @@ PointerType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
|
||||
jsval arg = args[0];
|
||||
RootedObject obj(cx);
|
||||
if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(obj = &arg.toObject())) {
|
||||
if (arg.isPrimitive() || !CType::IsCType(obj = &arg.toObject())) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return false;
|
||||
}
|
||||
|
@ -3994,7 +3992,7 @@ PointerType::ConstructData(JSContext* cx,
|
|||
if (args.length() >= 2) {
|
||||
if (args[1].isNull()) {
|
||||
thisObj = nullptr;
|
||||
} else if (!JSVAL_IS_PRIMITIVE(args[1])) {
|
||||
} else if (!args[1].isPrimitive()) {
|
||||
thisObj = &args[1].toObject();
|
||||
} else if (!JS_ValueToObject(cx, args[1], &thisObj)) {
|
||||
return false;
|
||||
|
@ -4181,7 +4179,7 @@ ArrayType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
if (args[0].isPrimitive() ||
|
||||
!CType::IsCType(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return false;
|
||||
|
@ -4295,7 +4293,7 @@ ArrayType::ConstructData(JSContext* cx,
|
|||
// Have a length, rather than an object to initialize from.
|
||||
convertObject = false;
|
||||
|
||||
} else if (!JSVAL_IS_PRIMITIVE(args[0])) {
|
||||
} else if (!args[0].isPrimitive()) {
|
||||
// We were given an object with a .length property.
|
||||
// This could be a JS array, or a CData array.
|
||||
RootedObject arg(cx, &args[0].toObject());
|
||||
|
@ -4634,7 +4632,7 @@ ArrayType::AddressOfElement(JSContext* cx, unsigned argc, jsval* vp)
|
|||
static JSFlatString*
|
||||
ExtractStructField(JSContext* cx, jsval val, JSObject** typeObj)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (val.isPrimitive()) {
|
||||
JS_ReportError(cx, "struct field descriptors require a valid name and type");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -4742,7 +4740,7 @@ StructType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
return false;
|
||||
|
||||
if (args.length() == 2) {
|
||||
RootedObject arr(cx, JSVAL_IS_PRIMITIVE(args[1]) ? nullptr : &args[1].toObject());
|
||||
RootedObject arr(cx, args[1].isPrimitive() ? nullptr : &args[1].toObject());
|
||||
if (!arr || !JS_IsArrayObject(cx, arr)) {
|
||||
JS_ReportError(cx, "second argument must be an array");
|
||||
return false;
|
||||
|
@ -4999,7 +4997,7 @@ StructType::Define(JSContext* cx, unsigned argc, jsval* vp)
|
|||
}
|
||||
|
||||
jsval arg = args[0];
|
||||
if (JSVAL_IS_PRIMITIVE(arg)) {
|
||||
if (arg.isPrimitive()) {
|
||||
JS_ReportError(cx, "argument must be an array");
|
||||
return false;
|
||||
}
|
||||
|
@ -5311,7 +5309,7 @@ struct AutoValue
|
|||
static bool
|
||||
GetABI(JSContext* cx, jsval abiType, ffi_abi* result)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(abiType))
|
||||
if (abiType.isPrimitive())
|
||||
return false;
|
||||
|
||||
ABICode abi = GetABICode(abiType.toObjectOrNull());
|
||||
|
@ -5343,7 +5341,7 @@ GetABI(JSContext* cx, jsval abiType, ffi_abi* result)
|
|||
static JSObject*
|
||||
PrepareType(JSContext* cx, jsval type)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(type) || !CType::IsCType(type.toObjectOrNull())) {
|
||||
if (type.isPrimitive() || !CType::IsCType(type.toObjectOrNull())) {
|
||||
JS_ReportError(cx, "not a ctypes type");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5379,7 +5377,7 @@ PrepareType(JSContext* cx, jsval type)
|
|||
static JSObject*
|
||||
PrepareReturnType(JSContext* cx, jsval type)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(type) || !CType::IsCType(type.toObjectOrNull())) {
|
||||
if (type.isPrimitive() || !CType::IsCType(type.toObjectOrNull())) {
|
||||
JS_ReportError(cx, "not a ctypes type");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5599,7 +5597,7 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
|
||||
if (args.length() == 3) {
|
||||
// Prepare an array of jsvals for the arguments.
|
||||
if (!JSVAL_IS_PRIMITIVE(args[2]))
|
||||
if (!args[2].isPrimitive())
|
||||
arrayObj = &args[2].toObject();
|
||||
if (!arrayObj || !JS_IsArrayObject(cx, arrayObj)) {
|
||||
JS_ReportError(cx, "third argument must be an array");
|
||||
|
@ -5805,7 +5803,7 @@ FunctionType::Call(JSContext* cx,
|
|||
RootedObject type(cx); // RootedObject, but readability would suffer.
|
||||
|
||||
for (uint32_t i = argcFixed; i < args.length(); ++i) {
|
||||
if (JSVAL_IS_PRIMITIVE(args[i]) ||
|
||||
if (args[i].isPrimitive() ||
|
||||
!CData::IsCData(obj = &args[i].toObject())) {
|
||||
// Since we know nothing about the CTypes of the ... arguments,
|
||||
// they absolutely must be CData objects already.
|
||||
|
@ -6293,7 +6291,7 @@ CData::Create(JSContext* cx,
|
|||
|
||||
// Get the 'prototype' property from the type.
|
||||
jsval slot = JS_GetReservedSlot(typeObj, SLOT_PROTO);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(slot));
|
||||
JS_ASSERT(!slot.isPrimitive());
|
||||
|
||||
RootedObject proto(cx, slot.toObjectOrNull());
|
||||
RootedObject parent(cx, JS_GetParent(typeObj));
|
||||
|
@ -6471,16 +6469,14 @@ CData::Cast(JSContext* cx, unsigned argc, jsval* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
!CData::IsCData(&args[0].toObject())) {
|
||||
if (args[0].isPrimitive() || !CData::IsCData(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "first argument must be a CData");
|
||||
return false;
|
||||
}
|
||||
RootedObject sourceData(cx, &args[0].toObject());
|
||||
JSObject* sourceType = CData::GetCType(sourceData);
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(args[1]) ||
|
||||
!CType::IsCType(&args[1].toObject())) {
|
||||
if (args[1].isPrimitive() || !CType::IsCType(&args[1].toObject())) {
|
||||
JS_ReportError(cx, "second argument must be a CType");
|
||||
return false;
|
||||
}
|
||||
|
@ -6514,8 +6510,7 @@ CData::GetRuntime(JSContext* cx, unsigned argc, jsval* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
!CType::IsCType(&args[0].toObject())) {
|
||||
if (args[0].isPrimitive() || !CType::IsCType(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return false;
|
||||
}
|
||||
|
@ -6740,7 +6735,7 @@ CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp)
|
|||
AppendString(source, ", ");
|
||||
jsval valCodePtrType = JS_GetReservedSlot(objThis,
|
||||
SLOT_DATAFINALIZER_CODETYPE);
|
||||
if (JSVAL_IS_PRIMITIVE(valCodePtrType)) {
|
||||
if (valCodePtrType.isPrimitive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6833,7 +6828,7 @@ CDataFinalizer::GetCData(JSContext *cx, JSObject *obj)
|
|||
return nullptr;
|
||||
}
|
||||
RootedValue val(cx);
|
||||
if (!CDataFinalizer::GetValue(cx, obj, val.address()) || JSVAL_IS_PRIMITIVE(val)) {
|
||||
if (!CDataFinalizer::GetValue(cx, obj, val.address()) || val.isPrimitive()) {
|
||||
JS_ReportError(cx, "Empty CDataFinalizer");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -6991,7 +6986,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp)
|
|||
// This is the type that we should capture, not that
|
||||
// of the function, which may be less precise.
|
||||
JSObject *objBestArgType = objArgType;
|
||||
if (!JSVAL_IS_PRIMITIVE(valData)) {
|
||||
if (!valData.isPrimitive()) {
|
||||
JSObject *objData = &valData.toObject();
|
||||
if (CData::IsCData(objData)) {
|
||||
objBestArgType = CData::GetCType(objData);
|
||||
|
@ -7171,14 +7166,14 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
jsval valType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_VALTYPE);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valType));
|
||||
JS_ASSERT(!valType.isPrimitive());
|
||||
|
||||
JSObject *objCTypes = CType::GetGlobalCTypes(cx, &valType.toObject());
|
||||
if (!objCTypes)
|
||||
return false;
|
||||
|
||||
jsval valCodePtrType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_CODETYPE);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCodePtrType));
|
||||
JS_ASSERT(!valCodePtrType.isPrimitive());
|
||||
JSObject *objCodePtrType = &valCodePtrType.toObject();
|
||||
|
||||
JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType);
|
||||
|
@ -7458,8 +7453,8 @@ Int64::Compare(JSContext* cx, unsigned argc, jsval* vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 2 ||
|
||||
JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
JSVAL_IS_PRIMITIVE(args[1]) ||
|
||||
args[0].isPrimitive() ||
|
||||
args[1].isPrimitive() ||
|
||||
!Int64::IsInt64(&args[0].toObject()) ||
|
||||
!Int64::IsInt64(&args[1].toObject())) {
|
||||
JS_ReportError(cx, "compare takes two Int64 arguments");
|
||||
|
@ -7490,7 +7485,7 @@ bool
|
|||
Int64::Lo(JSContext* cx, unsigned argc, jsval* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 1 || JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
if (args.length() != 1 || args[0].isPrimitive() ||
|
||||
!Int64::IsInt64(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "lo takes one Int64 argument");
|
||||
return false;
|
||||
|
@ -7508,7 +7503,7 @@ bool
|
|||
Int64::Hi(JSContext* cx, unsigned argc, jsval* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 1 || JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
if (args.length() != 1 || args[0].isPrimitive() ||
|
||||
!Int64::IsInt64(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "hi takes one Int64 argument");
|
||||
return false;
|
||||
|
@ -7628,8 +7623,8 @@ UInt64::Compare(JSContext* cx, unsigned argc, jsval* vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 2 ||
|
||||
JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
JSVAL_IS_PRIMITIVE(args[1]) ||
|
||||
args[0].isPrimitive() ||
|
||||
args[1].isPrimitive() ||
|
||||
!UInt64::IsUInt64(&args[0].toObject()) ||
|
||||
!UInt64::IsUInt64(&args[1].toObject())) {
|
||||
JS_ReportError(cx, "compare takes two UInt64 arguments");
|
||||
|
@ -7656,7 +7651,7 @@ bool
|
|||
UInt64::Lo(JSContext* cx, unsigned argc, jsval* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 1 || JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
if (args.length() != 1 || args[0].isPrimitive() ||
|
||||
!UInt64::IsUInt64(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "lo takes one UInt64 argument");
|
||||
return false;
|
||||
|
@ -7674,7 +7669,7 @@ bool
|
|||
UInt64::Hi(JSContext* cx, unsigned argc, jsval* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 1 || JSVAL_IS_PRIMITIVE(args[0]) ||
|
||||
if (args.length() != 1 || args[0].isPrimitive() ||
|
||||
!UInt64::IsUInt64(&args[0].toObject())) {
|
||||
JS_ReportError(cx, "hi takes one UInt64 argument");
|
||||
return false;
|
||||
|
|
|
@ -48,7 +48,7 @@ nonStrictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing,
|
|||
bool *allWrapped = (bool *) closure;
|
||||
JS::RootedValue thisv(cx);
|
||||
frame.getThisValue(cx, &thisv);
|
||||
*allWrapped = *allWrapped && !JSVAL_IS_PRIMITIVE(thisv);
|
||||
*allWrapped = *allWrapped && !thisv.isPrimitive();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ strictThisHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, boo
|
|||
bool *anyWrapped = (bool *) closure;
|
||||
JS::RootedValue thisv(cx);
|
||||
frame.getThisValue(cx, &thisv);
|
||||
*anyWrapped = *anyWrapped || !JSVAL_IS_PRIMITIVE(thisv);
|
||||
*anyWrapped = *anyWrapped || !thisv.isPrimitive();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -103,14 +103,14 @@ BEGIN_TEST(testParseJSON_success)
|
|||
JS::RootedObject obj(cx);
|
||||
|
||||
CHECK(Parse(cx, "[]", &v));
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
CHECK(!v.isPrimitive());
|
||||
obj = v.toObjectOrNull();
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "length", &v2));
|
||||
CHECK_SAME(v2, JSVAL_ZERO);
|
||||
|
||||
CHECK(Parse(cx, "[1]", &v));
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
CHECK(!v.isPrimitive());
|
||||
obj = v.toObjectOrNull();
|
||||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "0", &v2));
|
||||
|
@ -121,12 +121,12 @@ BEGIN_TEST(testParseJSON_success)
|
|||
|
||||
// Objects
|
||||
CHECK(Parse(cx, "{}", &v));
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
CHECK(!v.isPrimitive());
|
||||
obj = v.toObjectOrNull();
|
||||
CHECK(!JS_IsArrayObject(cx, obj));
|
||||
|
||||
CHECK(Parse(cx, "{ \"f\": 17 }", &v));
|
||||
CHECK(!JSVAL_IS_PRIMITIVE(v));
|
||||
CHECK(!v.isPrimitive());
|
||||
obj = v.toObjectOrNull();
|
||||
CHECK(!JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetProperty(cx, obj, "f", &v2));
|
||||
|
|
|
@ -755,7 +755,7 @@ js_ReportUncaughtException(JSContext *cx)
|
|||
* to protect all of these values.
|
||||
*/
|
||||
RootedObject exnObject(cx);
|
||||
if (JSVAL_IS_PRIMITIVE(exn)) {
|
||||
if (exn.isPrimitive()) {
|
||||
exnObject = nullptr;
|
||||
} else {
|
||||
exnObject = exn.toObjectOrNull();
|
||||
|
|
|
@ -822,7 +822,7 @@ ToDisassemblySource(JSContext *cx, HandleValue v, JSAutoByteString *bytes)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (!v.isPrimitive()) {
|
||||
JSObject *obj = v.toObjectOrNull();
|
||||
if (obj->is<StaticBlockObject>()) {
|
||||
Rooted<StaticBlockObject*> block(cx, &obj->as<StaticBlockObject>());
|
||||
|
|
|
@ -262,7 +262,7 @@ RegisterPerfMeasurement(JSContext *cx, HandleObject globalArg)
|
|||
PerfMeasurement*
|
||||
ExtractPerfMeasurement(jsval wrapper)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(wrapper))
|
||||
if (wrapper.isPrimitive())
|
||||
return 0;
|
||||
|
||||
// This is what JS_GetInstancePrivate does internally. We can't
|
||||
|
|
|
@ -1771,7 +1771,7 @@ GetScriptAndPCArgs(JSContext *cx, unsigned argc, jsval *argv, MutableHandleScrip
|
|||
if (argc != 0) {
|
||||
jsval v = argv[0];
|
||||
unsigned intarg = 0;
|
||||
if (!JSVAL_IS_PRIMITIVE(v) &&
|
||||
if (!v.isPrimitive() &&
|
||||
JS_GetClass(&v.toObject()) == Jsvalify(&JSFunction::class_)) {
|
||||
script = ValueToScript(cx, v);
|
||||
if (!script)
|
||||
|
@ -2569,7 +2569,7 @@ Clone(JSContext *cx, unsigned argc, jsval *vp)
|
|||
|
||||
{
|
||||
Maybe<JSAutoCompartment> ac;
|
||||
RootedObject obj(cx, JSVAL_IS_PRIMITIVE(args[0]) ? nullptr : &args[0].toObject());
|
||||
RootedObject obj(cx, args[0].isPrimitive() ? nullptr : &args[0].toObject());
|
||||
|
||||
if (obj && obj->is<CrossCompartmentWrapperObject>()) {
|
||||
obj = UncheckedUnwrap(obj);
|
||||
|
@ -3495,7 +3495,7 @@ Parent(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
Value v = args[0];
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (v.isPrimitive()) {
|
||||
JS_ReportError(cx, "Only objects have parents!");
|
||||
return false;
|
||||
}
|
||||
|
@ -4196,7 +4196,7 @@ Wrap(JSContext *cx, unsigned argc, jsval *vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
Value v = args.get(0);
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (v.isPrimitive()) {
|
||||
args.rval().set(v);
|
||||
return true;
|
||||
}
|
||||
|
@ -4979,7 +4979,7 @@ Help(JSContext *cx, unsigned argc, jsval *vp)
|
|||
RootedId id(cx, ida[i]);
|
||||
if (!JS_LookupPropertyById(cx, global, id, &v))
|
||||
return false;
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (v.isPrimitive()) {
|
||||
JS_ReportError(cx, "primitive arg");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 394967;
|
||||
var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(vp[1])';
|
||||
var summary = 'Do not assert: !vp[1].isPrimitive()';
|
||||
var actual = 'No Crash';
|
||||
var expect = 'No Crash';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 469405;
|
||||
var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(regs.sp[-2])';
|
||||
var summary = 'Do not assert: !regs.sp[-2].isPrimitive()';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 469405;
|
||||
var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(regs.sp[-2])';
|
||||
var summary = 'Do not assert: !regs.sp[-2].isPrimitive()';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 452960;
|
||||
var summary = 'Do not assert with JIT: !JSVAL_IS_PRIMITIVE(v)';
|
||||
var summary = 'Do not assert with JIT: !v.isPrimitive()';
|
||||
var actual = 'No Crash';
|
||||
var expect = 'No Crash';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 477581;
|
||||
var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(regs.sp[-2])';
|
||||
var summary = 'Do not assert: !regs.sp[-2].isPrimitive()';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ function test()
|
|||
}
|
||||
f();
|
||||
|
||||
// Assertion failure: !JSVAL_IS_PRIMITIVE(regs.sp[-2]), at ../jsinterp.cpp:3243
|
||||
// Assertion failure: !regs.sp[-2].isPrimitive(), at ../jsinterp.cpp:3243
|
||||
// Opt crash [@ JS_GetMethodById] near null
|
||||
// =====
|
||||
new Function("for(x1 in ((function (){ yield x } )())){var c, x = []} function x(){} ");
|
||||
|
|
|
@ -1122,7 +1122,7 @@ XPCConvert::JSValToXPCException(MutableHandleValue s,
|
|||
AutoJSContext cx;
|
||||
AutoExceptionRestorer aer(cx, s);
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(s)) {
|
||||
if (!s.isPrimitive()) {
|
||||
// we have a JSObject
|
||||
RootedObject obj(cx, s.toObjectOrNull());
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ GetIIDArg(uint32_t argc, const JS::Value& val, JSContext* cx)
|
|||
// If an IID was passed in then use it
|
||||
if (argc) {
|
||||
JSObject* iidobj;
|
||||
if (JSVAL_IS_PRIMITIVE(val) ||
|
||||
if (val.isPrimitive() ||
|
||||
!(iidobj = val.toObjectOrNull()) ||
|
||||
!(iid = xpc_JSObjectToID(cx, iidobj))) {
|
||||
return nullptr;
|
||||
|
|
|
@ -544,7 +544,7 @@ Parent(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
Value v = args[0];
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (v.isPrimitive()) {
|
||||
JS_ReportError(cx, "Only objects have parents!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ XPCVariant::VariantDataToJS(nsIVariant* variant,
|
|||
nsresult rv = variant->GetAsJSVal(&realVal);
|
||||
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(JSVAL_IS_PRIMITIVE(realVal) ||
|
||||
(realVal.isPrimitive() ||
|
||||
type == nsIDataType::VTYPE_ARRAY ||
|
||||
type == nsIDataType::VTYPE_EMPTY_ARRAY ||
|
||||
type == nsIDataType::VTYPE_ID)) {
|
||||
|
|
|
@ -191,7 +191,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
|
|||
|
||||
// check upfront for the existence of the function property
|
||||
HandleId funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE);
|
||||
if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun))
|
||||
if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || fun.isPrimitive())
|
||||
return nullptr;
|
||||
|
||||
// Ensure that we are asking for a scriptable interface.
|
||||
|
@ -1265,7 +1265,7 @@ pre_call_clean_up:
|
|||
rval = *argv;
|
||||
success = JS_SetProperty(cx, obj, name, rval);
|
||||
} else {
|
||||
if (!JSVAL_IS_PRIMITIVE(fval)) {
|
||||
if (!fval.isPrimitive()) {
|
||||
AutoSaveContextOptions asco(cx);
|
||||
ContextOptionsRef(cx).setDontReportUncaught(true);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper)
|
|||
|
||||
RootedValue val(ccx);
|
||||
if (JS_GetPropertyById(ccx, mainObj, id, &val) &&
|
||||
!JSVAL_IS_PRIMITIVE(val)) {
|
||||
!val.isPrimitive()) {
|
||||
obj = val.toObjectOrNull();
|
||||
}
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ XPC_WN_Shared_Convert(JSContext *cx, HandleObject obj, JSType type, MutableHandl
|
|||
if (!XPCWrappedNative::CallMethod(ccx))
|
||||
return false;
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(vp))
|
||||
if (vp.isPrimitive())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -831,10 +831,10 @@ nsXPConnect::CreateSandbox(JSContext *cx, nsIPrincipal *principal,
|
|||
RootedValue rval(cx);
|
||||
SandboxOptions options;
|
||||
nsresult rv = CreateSandboxObject(cx, &rval, principal, options);
|
||||
MOZ_ASSERT(NS_FAILED(rv) || !JSVAL_IS_PRIMITIVE(rval),
|
||||
MOZ_ASSERT(NS_FAILED(rv) || !rval.isPrimitive(),
|
||||
"Bad return value from xpc_CreateSandboxObject()!");
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_PRIMITIVE(rval)) {
|
||||
if (NS_SUCCEEDED(rv) && !rval.isPrimitive()) {
|
||||
*_retval = XPCJSObjectHolder::newHolder(rval.toObjectOrNull());
|
||||
NS_ENSURE_TRUE(*_retval, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
|
|
@ -3174,7 +3174,7 @@ public:
|
|||
* kept alive past the next CC.
|
||||
*/
|
||||
jsval GetJSVal() const {
|
||||
if (!JSVAL_IS_PRIMITIVE(mJSVal))
|
||||
if (!mJSVal.isPrimitive())
|
||||
JS::ExposeObjectToActiveJS(&mJSVal.toObject());
|
||||
return mJSVal;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ GetJSArrayFromJSValue(JS::Handle<JS::Value> aValue,
|
|||
already_AddRefed<nsIURI>
|
||||
GetJSValueAsURI(JSContext* aCtx,
|
||||
const JS::Value& aValue) {
|
||||
if (!JSVAL_IS_PRIMITIVE(aValue)) {
|
||||
if (!aValue.isPrimitive()) {
|
||||
nsCOMPtr<nsIXPConnect> xpc = mozilla::services::GetXPConnect();
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrappedObj;
|
||||
|
@ -390,7 +390,7 @@ GetIntFromJSObject(JSContext* aCtx,
|
|||
if (value.isUndefined()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
NS_ENSURE_ARG(JSVAL_IS_PRIMITIVE(value));
|
||||
NS_ENSURE_ARG(value.isPrimitive());
|
||||
NS_ENSURE_ARG(value.isNumber());
|
||||
|
||||
double num;
|
||||
|
@ -2763,7 +2763,7 @@ History::UpdatePlaces(JS::Handle<JS::Value> aPlaceInfos,
|
|||
JSContext* aCtx)
|
||||
{
|
||||
NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(aPlaceInfos), NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(!aPlaceInfos.isPrimitive(), NS_ERROR_INVALID_ARG);
|
||||
|
||||
uint32_t infosLength;
|
||||
JS::Rooted<JSObject*> infos(aCtx);
|
||||
|
@ -2810,7 +2810,7 @@ History::UpdatePlaces(JS::Handle<JS::Value> aPlaceInfos,
|
|||
JS::Rooted<JS::Value> visitsVal(aCtx);
|
||||
bool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
if (!JSVAL_IS_PRIMITIVE(visitsVal)) {
|
||||
if (!visitsVal.isPrimitive()) {
|
||||
visits = visitsVal.toObjectOrNull();
|
||||
NS_ENSURE_ARG(JS_IsArrayObject(aCtx, visits));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче