Bug 952650 (part 2) - Remove JSVAL_IS_VOID. r=evilpies.

--HG--
extra : rebase_source : 0ae81cd69dc13d944927de906abc656536b4d425
This commit is contained in:
Rodrigo Rodriguez Jr. 2014-04-27 19:32:05 -07:00
parent 5b7e66980d
commit ce08f289ef
25 changed files with 69 additions and 75 deletions

View File

@ -71,7 +71,7 @@ CoerceDouble(JS::Value v, double* d)
*d = JSVAL_TO_DOUBLE(v);
} else if (JSVAL_IS_INT(v)) {
*d = double(JSVAL_TO_INT(v));
} else if (JSVAL_IS_VOID(v)) {
} else if (v.isUndefined()) {
*d = 0.0;
} else {
return false;

View File

@ -141,7 +141,7 @@ JSValToDashArray(JSContext* cx, const JS::Value& patternArray,
// An all-zero pattern makes no sense.
return NS_ERROR_ILLEGAL_VALUE;
}
} else if (!(JSVAL_IS_VOID(patternArray) || patternArray.isNull())) {
} else if (!(patternArray.isUndefined() || patternArray.isNull())) {
// undefined and null mean "reset to no dash". Any other
// random garbage is a type error.
return NS_ERROR_INVALID_ARG;

View File

@ -517,12 +517,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(IDBCursor)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_ASSERTION(tmp->mHaveCachedKey || JSVAL_IS_VOID(tmp->mCachedKey),
NS_ASSERTION(tmp->mHaveCachedKey || tmp->mCachedKey.isUndefined(),
"Should have a cached key");
NS_ASSERTION(tmp->mHaveCachedPrimaryKey ||
JSVAL_IS_VOID(tmp->mCachedPrimaryKey),
tmp->mCachedPrimaryKey.isUndefined(),
"Should have a cached primary key");
NS_ASSERTION(tmp->mHaveCachedValue || JSVAL_IS_VOID(tmp->mCachedValue),
NS_ASSERTION(tmp->mHaveCachedValue || tmp->mCachedValue.isUndefined(),
"Should have a cached value");
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mScriptOwner)
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mCachedKey)

View File

@ -831,7 +831,7 @@ IDBIndex::GetKeyPath(JSContext* aCx, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!JSVAL_IS_VOID(mCachedKeyPath)) {
if (!mCachedKeyPath.isUndefined()) {
return mCachedKeyPath;
}

View File

@ -1837,7 +1837,7 @@ IDBObjectStore::GetAddInfo(JSContext* aCx,
// Return DATA_ERR if a key was passed in and this objectStore uses inline
// keys.
if (!JSVAL_IS_VOID(aKeyVal) && HasValidKeyPath()) {
if (!aKeyVal.isUndefined() && HasValidKeyPath()) {
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
@ -2615,7 +2615,7 @@ IDBObjectStore::GetKeyPath(JSContext* aCx, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!JSVAL_IS_VOID(mCachedKeyPath)) {
if (!mCachedKeyPath.isUndefined()) {
return mCachedKeyPath;
}

View File

@ -169,7 +169,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(!mHaveResultOrErrorCode, "Already called!");
NS_ASSERTION(JSVAL_IS_VOID(mResultVal), "Should be undefined!");
NS_ASSERTION(mResultVal.isUndefined(), "Should be undefined!");
mHaveResultOrErrorCode = true;
@ -225,7 +225,7 @@ IDBRequest::NotifyHelperSentResultsToChildProcess(nsresult aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(!mHaveResultOrErrorCode, "Already called!");
NS_ASSERTION(JSVAL_IS_VOID(mResultVal), "Should be undefined!");
NS_ASSERTION(mResultVal.isUndefined(), "Should be undefined!");
// See if our window is still valid. If not then we're going to pretend that
// we never completed.

View File

@ -301,7 +301,7 @@ KeyPath::Parse(JSContext* aCx, const JS::Value& aValue_, KeyPath* aKeyPath)
}
}
// Otherwise convert it to a string.
else if (!aValue.isNull() && !JSVAL_IS_VOID(aValue)) {
else if (!aValue.isNull() && !aValue.isUndefined()) {
JSString* jsstr;
nsDependentJSString str;
if (!(jsstr = JS::ToString(aCx, aValue)) ||
@ -435,7 +435,7 @@ KeyPath::ExtractOrCreateKey(JSContext* aCx, const JS::Value& aValue,
if (NS_FAILED(aKey.AppendItem(aCx, false, value))) {
NS_ASSERTION(aKey.IsUnset(), "Should be unset");
return JSVAL_IS_VOID(value) ? NS_OK : NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
return value.isUndefined() ? NS_OK : NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
aKey.FinishArray();

View File

@ -1256,7 +1256,7 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
state->mResponseText = mResponseText;
if (NS_SUCCEEDED(mResponseTextResult)) {
MOZ_ASSERT(JSVAL_IS_VOID(mResponse) || mResponse.isNull());
MOZ_ASSERT(mResponse.isUndefined() || mResponse.isNull());
state->mResponseResult = mResponseTextResult;
state->mResponse = mResponse;
}
@ -1265,7 +1265,7 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
if (NS_SUCCEEDED(mResponseResult)) {
if (mResponseBuffer.data()) {
MOZ_ASSERT(JSVAL_IS_VOID(mResponse));
MOZ_ASSERT(mResponse.isUndefined());
JSAutoStructuredCloneBuffer responseBuffer(Move(mResponseBuffer));
@ -2258,7 +2258,7 @@ jsval
XMLHttpRequest::GetResponse(JSContext* /* unused */, ErrorResult& aRv)
{
if (NS_SUCCEEDED(mStateData.mResponseTextResult) &&
JSVAL_IS_VOID(mStateData.mResponse)) {
mStateData.mResponse.isUndefined()) {
MOZ_ASSERT(mStateData.mResponseText.Length());
MOZ_ASSERT(NS_SUCCEEDED(mStateData.mResponseResult));

View File

@ -102,7 +102,7 @@ jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval)
bool
jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval)
{
return JSVAL_IS_VOID(jsdval->val);
return jsdval->val.isUndefined();
}
bool

View File

@ -2168,7 +2168,7 @@ jsdValue::GetJsType (uint32_t *_rval)
*_rval = TYPE_INT;
else if (JSVAL_IS_STRING(val))
*_rval = TYPE_STRING;
else if (JSVAL_IS_VOID(val))
else if (val.isUndefined())
*_rval = TYPE_VOID;
else if (JSD_IsValueFunction (mCx, mValue))
*_rval = TYPE_FUNCTION;

View File

@ -1821,12 +1821,6 @@ static_assert(sizeof(jsval_layout) == sizeof(JS::Value),
/************************************************************************/
static inline bool
JSVAL_IS_VOID(jsval v)
{
return JSVAL_IS_UNDEFINED_IMPL(JSVAL_TO_IMPL(v));
}
static inline bool
JSVAL_IS_INT(jsval v)
{

View File

@ -1286,7 +1286,7 @@ GetCallbacks(JSObject* obj)
JS_ASSERT(IsCTypesGlobal(obj));
jsval result = JS_GetReservedSlot(obj, SLOT_CALLBACKS);
if (JSVAL_IS_VOID(result))
if (result.isUndefined())
return nullptr;
return static_cast<JSCTypesCallbacks*>(JSVAL_TO_PRIVATE(result));
@ -1384,10 +1384,10 @@ SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj)
size_t n = 0;
jsval slot = JS_GetReservedSlot(obj, ctypes::SLOT_OWNS);
if (!JSVAL_IS_VOID(slot)) {
if (!slot.isUndefined()) {
bool owns = JSVAL_TO_BOOLEAN(slot);
slot = JS_GetReservedSlot(obj, ctypes::SLOT_DATA);
if (!JSVAL_IS_VOID(slot)) {
if (!slot.isUndefined()) {
char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot));
n += mallocSizeOf(buffer);
if (owns)
@ -3292,7 +3292,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
{
// Make sure our TypeCode slot is legit. If it's not, bail.
jsval slot = JS_GetReservedSlot(obj, SLOT_TYPECODE);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
// The contents of our slots depends on what kind of type we are.
@ -3300,7 +3300,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
case TYPE_function: {
// Free the FunctionInfo.
slot = JS_GetReservedSlot(obj, SLOT_FNINFO);
if (!JSVAL_IS_VOID(slot))
if (!slot.isUndefined())
FreeOp::get(fop)->delete_(static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot)));
break;
}
@ -3308,7 +3308,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
case TYPE_struct: {
// Free the FieldInfoHash table.
slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO);
if (!JSVAL_IS_VOID(slot)) {
if (!slot.isUndefined()) {
void* info = JSVAL_TO_PRIVATE(slot);
FreeOp::get(fop)->delete_(static_cast<FieldInfoHash*>(info));
}
@ -3318,7 +3318,7 @@ CType::Finalize(JSFreeOp *fop, JSObject* obj)
case TYPE_array: {
// Free the ffi_type info.
slot = JS_GetReservedSlot(obj, SLOT_FFITYPE);
if (!JSVAL_IS_VOID(slot)) {
if (!slot.isUndefined()) {
ffi_type* ffiType = static_cast<ffi_type*>(JSVAL_TO_PRIVATE(slot));
FreeOp::get(fop)->free_(ffiType->elements);
FreeOp::get(fop)->delete_(ffiType);
@ -3337,14 +3337,14 @@ CType::Trace(JSTracer* trc, JSObject* obj)
{
// Make sure our TypeCode slot is legit. If it's not, bail.
jsval slot = obj->getSlot(SLOT_TYPECODE);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
// The contents of our slots depends on what kind of type we are.
switch (TypeCode(JSVAL_TO_INT(slot))) {
case TYPE_struct: {
slot = obj->getReservedSlot(SLOT_FIELDINFO);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
FieldInfoHash* fields =
@ -3362,7 +3362,7 @@ CType::Trace(JSTracer* trc, JSObject* obj)
case TYPE_function: {
// Check if we have a FunctionInfo.
slot = obj->getReservedSlot(SLOT_FNINFO);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
FunctionInfo* fninfo = static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot));
@ -3490,7 +3490,7 @@ CType::GetSafeSize(JSObject* obj, size_t* result)
return true;
}
JS_ASSERT(JSVAL_IS_VOID(size));
JS_ASSERT(size.isUndefined());
return false;
}
@ -3501,7 +3501,7 @@ CType::GetSize(JSObject* obj)
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
JS_ASSERT(!JSVAL_IS_VOID(size));
JS_ASSERT(!size.isUndefined());
// The "size" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
@ -3520,8 +3520,8 @@ CType::IsSizeDefined(JSObject* obj)
// The "size" property can be an int, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || JSVAL_IS_VOID(size));
return !JSVAL_IS_VOID(size);
JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || size.isUndefined());
return !size.isUndefined();
}
size_t
@ -3540,7 +3540,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj)
jsval slot = JS_GetReservedSlot(obj, SLOT_FFITYPE);
if (!JSVAL_IS_VOID(slot)) {
if (!slot.isUndefined()) {
return static_cast<ffi_type*>(JSVAL_TO_PRIVATE(slot));
}
@ -3570,7 +3570,7 @@ CType::GetName(JSContext* cx, HandleObject obj)
JS_ASSERT(CType::IsCType(obj));
jsval string = JS_GetReservedSlot(obj, SLOT_NAME);
if (!JSVAL_IS_VOID(string))
if (!string.isUndefined())
return JSVAL_TO_STRING(string);
// Build the type name lazily.
@ -5094,7 +5094,7 @@ StructType::GetFieldInfo(JSObject* obj)
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct);
jsval slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO);
JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot));
JS_ASSERT(!slot.isUndefined() && JSVAL_TO_PRIVATE(slot));
return static_cast<const FieldInfoHash*>(JSVAL_TO_PRIVATE(slot));
}
@ -5912,7 +5912,7 @@ FunctionType::GetFunctionInfo(JSObject* obj)
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_function);
jsval slot = JS_GetReservedSlot(obj, SLOT_FNINFO);
JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot));
JS_ASSERT(!slot.isUndefined() && JSVAL_TO_PRIVATE(slot));
return static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot));
}
@ -6030,7 +6030,7 @@ CClosure::Create(JSContext* cx,
// we might be unable to convert the value to the proper type. If so, we want
// the caller to know about it _now_, rather than some uncertain time in the
// future when the error sentinel is actually needed.
if (!JSVAL_IS_VOID(errVal)) {
if (!errVal.isUndefined()) {
// Make sure the callback returns something.
if (CType::GetTypeCode(fninfo->mReturnType) == TYPE_void_t) {
@ -6092,7 +6092,7 @@ CClosure::Trace(JSTracer* trc, JSObject* obj)
{
// Make sure our ClosureInfo slot is legit. If it's not, bail.
jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSUREINFO);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
ClosureInfo* cinfo = static_cast<ClosureInfo*>(JSVAL_TO_PRIVATE(slot));
@ -6110,7 +6110,7 @@ CClosure::Finalize(JSFreeOp *fop, JSObject* obj)
{
// Make sure our ClosureInfo slot is legit. If it's not, bail.
jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSUREINFO);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
ClosureInfo* cinfo = static_cast<ClosureInfo*>(JSVAL_TO_PRIVATE(slot));
@ -6354,13 +6354,13 @@ CData::Finalize(JSFreeOp *fop, JSObject* obj)
{
// Delete our buffer, and the data it contains if we own it.
jsval slot = JS_GetReservedSlot(obj, SLOT_OWNS);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
bool owns = JSVAL_TO_BOOLEAN(slot);
slot = JS_GetReservedSlot(obj, SLOT_DATA);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
char** buffer = static_cast<char**>(JSVAL_TO_PRIVATE(slot));
@ -6813,7 +6813,7 @@ CDataFinalizer::GetCType(JSContext *cx, JSObject *obj)
jsval valData = JS_GetReservedSlot(obj,
SLOT_DATAFINALIZER_VALTYPE);
if (JSVAL_IS_VOID(valData)) {
if (valData.isUndefined()) {
return nullptr;
}
@ -7306,7 +7306,7 @@ void
Int64Base::Finalize(JSFreeOp *fop, JSObject* obj)
{
jsval slot = JS_GetReservedSlot(obj, SLOT_INT64);
if (JSVAL_IS_VOID(slot))
if (slot.isUndefined())
return;
FreeOp::get(fop)->delete_(static_cast<uint64_t*>(JSVAL_TO_PRIVATE(slot)));

View File

@ -110,7 +110,7 @@ doResolve(JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp)
CHECK_EQUAL(resolveEntryCount, 2);
CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_NULL, nullptr, nullptr, 0));
EVAL("obj1.x", &v);
CHECK(JSVAL_IS_VOID(v));
CHECK(v.isUndefined());
EVAL("obj1.y", &v);
CHECK_SAME(v, JSVAL_ZERO);
objp.set(obj);
@ -119,13 +119,13 @@ doResolve(JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp)
if (obj == obj1) {
CHECK_EQUAL(resolveEntryCount, 3);
EVAL("obj1.x", &v);
CHECK(JSVAL_IS_VOID(v));
CHECK(v.isUndefined());
EVAL("obj1.y", &v);
CHECK(JSVAL_IS_VOID(v));
CHECK(v.isUndefined());
EVAL("obj2.y", &v);
CHECK(v.isNull());
EVAL("obj2.x", &v);
CHECK(JSVAL_IS_VOID(v));
CHECK(v.isUndefined());
EVAL("obj1.y = 0", &v);
CHECK_SAME(v, JSVAL_ZERO);
objp.set(obj);

View File

@ -544,7 +544,7 @@ js::ReportUsageError(JSContext *cx, HandleObject callee, const char *msg)
if (!JS_LookupProperty(cx, callee, "usage", &usage))
return;
if (JSVAL_IS_VOID(usage)) {
if (usage.isUndefined()) {
JS_ReportError(cx, "%s", msg);
} else {
JSString *str = JSVAL_TO_STRING(usage);

View File

@ -601,7 +601,7 @@ Version(JSContext *cx, unsigned argc, jsval *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
JSVersion origVersion = JS_GetVersion(cx);
if (args.length() == 0 || JSVAL_IS_VOID(args[0])) {
if (args.length() == 0 || args[0].isUndefined()) {
/* Get version. */
args.rval().setInt32(origVersion);
} else {
@ -4955,7 +4955,7 @@ PrintHelp(JSContext *cx, HandleObject obj)
if (!JS_LookupProperty(cx, obj, "help", &help))
return false;
if (JSVAL_IS_VOID(usage) || JSVAL_IS_VOID(help))
if (usage.isUndefined() || help.isUndefined())
return true;
return PrintHelpString(cx, usage) && PrintHelpString(cx, help);

View File

@ -432,7 +432,7 @@ ReferenceFinder::visit(void *cell, Path *path)
/* Is |cell| a representable cell, reached via a non-empty path? */
if (path != nullptr) {
jsval representation = representable(cell, node->kind);
if (!JSVAL_IS_VOID(representation))
if (!representation.isUndefined())
return addReferrer(representation, path);
}

View File

@ -5,7 +5,7 @@
//-----------------------------------------------------------------------------
var BUGNUMBER = 355829;
var summary = 'Do not assert: !argc || argv[0].isNull() || JSVAL_IS_VOID(argv[0])';
var summary = 'Do not assert: !argc || argv[0].isNull() || argv[0].isUndefined()';
var actual = '';
var expect = '';

View File

@ -5,7 +5,7 @@
//-----------------------------------------------------------------------------
var BUGNUMBER = 452573;
var summary = 'Do not assert with JIT: JSVAL_IS_VOID(boxed) || JSVAL_IS_BOOLEAN(boxed)';
var summary = 'Do not assert with JIT: boxed.isUndefined() || JSVAL_IS_BOOLEAN(boxed)';
var actual = 'No Crash';
var expect = 'No Crash';

View File

@ -5,7 +5,7 @@
//-----------------------------------------------------------------------------
var BUGNUMBER = 453747;
var summary = 'Do not assert with JIT: JSVAL_IS_VOID(boxed) || JSVAL_IS_BOOLEAN(boxed)';
var summary = 'Do not assert with JIT: boxed.isUndefined() || JSVAL_IS_BOOLEAN(boxed)';
var actual = 'No Crash';
var expect = 'No Crash';

View File

@ -5,7 +5,7 @@
//-----------------------------------------------------------------------------
var BUGNUMBER = 459628;
var summary = 'Do not assert: JSVAL_IS_VOID(STOBJ_GET_SLOT(obj, map->freeslot))';
var summary = 'Do not assert: STOBJ_GET_SLOT(obj, map->freeslot).isUndefined()';
var actual = '';
var expect = '';

View File

@ -719,7 +719,7 @@ JSStructuredCloneWriter::parseTransferable()
{
MOZ_ASSERT(transferableObjects.empty(), "parseTransferable called with stale data");
if (transferable.isNull() || JSVAL_IS_VOID(transferable))
if (transferable.isNull() || transferable.isUndefined())
return true;
if (!transferable.isObject())

View File

@ -471,7 +471,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile)
RootedValue NSGetFactory_val(cx);
if (!JS_GetProperty(cx, entryObj, "NSGetFactory", &NSGetFactory_val) ||
JSVAL_IS_VOID(NSGetFactory_val)) {
NSGetFactory_val.isUndefined()) {
return nullptr;
}

View File

@ -473,7 +473,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
case nsXPTType::T_ASTRING:
{
if (JSVAL_IS_VOID(s)) {
if (s.isUndefined()) {
if (useAllocator)
*((const nsAString**)d) = &NullString();
else
@ -494,7 +494,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
size_t length = 0;
const char16_t* chars = nullptr;
JSString* str = nullptr;
if (!JSVAL_IS_VOID(s)) {
if (!s.isUndefined()) {
str = ToString(cx, s);
if (!str)
return false;
@ -543,7 +543,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
case nsXPTType::T_CHAR_STR:
{
if (JSVAL_IS_VOID(s) || s.isNull()) {
if (s.isUndefined() || s.isNull()) {
*((char**)d) = nullptr;
return true;
}
@ -584,7 +584,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
const jschar* chars=nullptr;
JSString* str;
if (JSVAL_IS_VOID(s) || s.isNull()) {
if (s.isUndefined() || s.isNull()) {
*((jschar**)d) = nullptr;
return true;
}
@ -614,7 +614,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
size_t length;
JSString* str;
if (s.isNull() || JSVAL_IS_VOID(s)) {
if (s.isNull() || s.isUndefined()) {
if (useAllocator) {
*((const nsACString**)d) = &NullCString();
} else {
@ -658,7 +658,7 @@ XPCConvert::JSData2Native(void* d, HandleValue s,
case nsXPTType::T_CSTRING:
{
if (s.isNull() || JSVAL_IS_VOID(s)) {
if (s.isNull() || s.isUndefined()) {
if (useAllocator) {
nsACString *rs = new nsCString();
if (!rs)
@ -1211,7 +1211,7 @@ XPCConvert::JSValToXPCException(MutableHandleValue s,
}
}
if (JSVAL_IS_VOID(s) || s.isNull()) {
if (s.isUndefined() || s.isNull()) {
return ConstructException(NS_ERROR_XPC_JS_THREW_NULL,
nullptr, ifaceName, methodName, nullptr,
exceptn, cx, s.address());
@ -1771,7 +1771,7 @@ XPCConvert::JSStringWithSize2Native(void* d, HandleValue s,
switch (type.TagPart()) {
case nsXPTType::T_PSTRING_SIZE_IS:
{
if (JSVAL_IS_VOID(s) || s.isNull()) {
if (s.isUndefined() || s.isNull()) {
if (0 != count) {
if (pErr)
*pErr = NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING;
@ -1825,7 +1825,7 @@ XPCConvert::JSStringWithSize2Native(void* d, HandleValue s,
const jschar* chars=nullptr;
JSString* str;
if (JSVAL_IS_VOID(s) || s.isNull()) {
if (s.isUndefined() || s.isNull()) {
if (0 != count) {
if (pErr)
*pErr = NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING;

View File

@ -224,7 +224,7 @@ protected:
* without doing anything else. Otherwise, the JSString* created
* from |v| will be returned. It'll be rooted, as needed, in
* *pval. nullBehavior and undefinedBehavior control what happens
* when v.isNull() and JSVAL_IS_VOID are respectively true.
* when v.isNull() and v.isUndefined() are respectively true.
*/
template<class traits>
JSString* InitOrStringify(JSContext* cx, JS::HandleValue v,
@ -239,7 +239,7 @@ protected:
StringificationBehavior behavior = eStringify;
if (v.isNull()) {
behavior = nullBehavior;
} else if (JSVAL_IS_VOID(v)) {
} else if (v.isUndefined()) {
behavior = undefinedBehavior;
}

View File

@ -315,7 +315,7 @@ void
GetJSValueAsString(JSContext* aCtx,
const JS::Value& aValue,
nsString& _string) {
if (JSVAL_IS_VOID(aValue) ||
if (aValue.isUndefined() ||
!(aValue.isNull() || JSVAL_IS_STRING(aValue))) {
_string.SetIsVoid(true);
return;
@ -387,7 +387,7 @@ GetIntFromJSObject(JSContext* aCtx,
JS::Rooted<JS::Value> value(aCtx);
bool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
if (JSVAL_IS_VOID(value)) {
if (value.isUndefined()) {
return NS_ERROR_INVALID_ARG;
}
NS_ENSURE_ARG(JSVAL_IS_PRIMITIVE(value));