--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -231,17 +231,17 @@ JavaScriptShared::convertGeckoStringToId
return JS_StringToId(cx, str, to);
}
bool
JavaScriptShared::toVariant(JSContext* cx, JS::HandleValue from, JSVariant* to)
{
switch (JS_TypeOfValue(cx, from)) {
- case JSTYPE_VOID:
+ case JSTYPE_UNDEFINED:
*to = UndefinedVariant();
return true;
case JSTYPE_OBJECT:
case JSTYPE_FUNCTION:
{
RootedObject obj(cx, from.toObjectOrNull());
if (!obj) {
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -4926,17 +4926,17 @@ ICTypeOf_Typed::Compiler::generateStubCo
{
MOZ_ASSERT(engine_ == Engine::Baseline);
MOZ_ASSERT(type_ != JSTYPE_NULL);
MOZ_ASSERT(type_ != JSTYPE_FUNCTION);
MOZ_ASSERT(type_ != JSTYPE_OBJECT);
Label failure;
switch(type_) {
- case JSTYPE_VOID:
+ case JSTYPE_UNDEFINED:
masm.branchTestUndefined(Assembler::NotEqual, R0, &failure);
break;
case JSTYPE_STRING:
masm.branchTestString(Assembler::NotEqual, R0, &failure);
break;
case JSTYPE_NUMBER:
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -2513,17 +2513,17 @@ IonBuilder::improveTypesAtTypeOfCompare(
if (inputTypes->unknown())
return Ok();
// Note: we cannot remove the AnyObject type in the false branch,
// since there are multiple ways to get an object. That is the reason
// for the 'trueBranch' test.
TemporaryTypeSet filter;
const JSAtomState& names = GetJitContext()->runtime->names();
- if (constant->toString() == TypeName(JSTYPE_VOID, names)) {
+ if (constant->toString() == TypeName(JSTYPE_UNDEFINED, names)) {
filter.addType(TypeSet::UndefinedType(), alloc_->lifoAlloc());
if (typeOf->inputMaybeCallableOrEmulatesUndefined() && trueBranch)
filter.addType(TypeSet::AnyObjectType(), alloc_->lifoAlloc());
} else if (constant->toString() == TypeName(JSTYPE_BOOLEAN, names)) {
filter.addType(TypeSet::BooleanType(), alloc_->lifoAlloc());
} else if (constant->toString() == TypeName(JSTYPE_NUMBER, names)) {
filter.addType(TypeSet::Int32Type(), alloc_->lifoAlloc());
filter.addType(TypeSet::DoubleType(), alloc_->lifoAlloc());
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -3900,17 +3900,17 @@ MTypeOf::foldsTo(TempAllocator& alloc)
break;
case MIRType::Symbol:
type = JSTYPE_SYMBOL;
break;
case MIRType::Null:
type = JSTYPE_OBJECT;
break;
case MIRType::Undefined:
- type = JSTYPE_VOID;
+ type = JSTYPE_UNDEFINED;
break;
case MIRType::Boolean:
type = JSTYPE_BOOLEAN;
break;
case MIRType::Object:
if (!inputMaybeCallableOrEmulatesUndefined()) {
// Object is not callable and does not emulate undefined, so it's
// safe to fold to "object".
@@ -4444,17 +4444,17 @@ MCompare::tryFoldTypeOf(bool* result)
if (jsop() != JSOP_STRICTEQ && jsop() != JSOP_STRICTNE &&
jsop() != JSOP_EQ && jsop() != JSOP_NE)
{
return false;
}
const JSAtomState& names = GetJitContext()->runtime->names();
- if (constant->toString() == TypeName(JSTYPE_VOID, names)) {
+ if (constant->toString() == TypeName(JSTYPE_UNDEFINED, names)) {
if (!typeOf->input()->mightBeType(MIRType::Undefined) &&
!typeOf->inputMaybeCallableOrEmulatesUndefined())
{
*result = (jsop() == JSOP_STRICTNE || jsop() == JSOP_NE);
return true;
}
} else if (constant->toString() == TypeName(JSTYPE_BOOLEAN, names)) {
if (!typeOf->input()->mightBeType(MIRType::Boolean)) {
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1569,17 +1569,17 @@ JS_IdToValue(JSContext* cx, jsid id, Mut
JS_PUBLIC_API(bool)
JS::ToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp)
{
AssertHeapIsIdle();
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj);
MOZ_ASSERT(obj != nullptr);
- MOZ_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER);
+ MOZ_ASSERT(hint == JSTYPE_UNDEFINED || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER);
vp.setObject(*obj);
return ToPrimitiveSlow(cx, hint, vp);
}
JS_PUBLIC_API(bool)
JS::GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args, JSType *result)
{
if (!args.get(0).isString()) {
@@ -1591,17 +1591,17 @@ JS::GetFirstArgumentAsTypeHint(JSContext
}
RootedString str(cx, args.get(0).toString());
bool match;
if (!EqualStrings(cx, str, cx->names().default_, &match))
return false;
if (match) {
- *result = JSTYPE_VOID;
+ *result = JSTYPE_UNDEFINED;
return true;
}
if (!EqualStrings(cx, str, cx->names().string, &match))
return false;
if (match) {
*result = JSTYPE_STRING;
return true;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1848,27 +1848,27 @@ extern JS_PUBLIC_API(bool)
JS_IdToValue(JSContext* cx, jsid id, JS::MutableHandle<JS::Value> vp);
namespace JS {
/**
* Convert obj to a primitive value. On success, store the result in vp and
* return true.
*
- * The hint argument must be JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_VOID (no
- * hint).
+ * The hint argument must be JSTYPE_STRING, JSTYPE_NUMBER, or
+ * JSTYPE_UNDEFINED (no hint).
*
* Implements: ES6 7.1.1 ToPrimitive(input, [PreferredType]).
*/
extern JS_PUBLIC_API(bool)
ToPrimitive(JSContext* cx, JS::HandleObject obj, JSType hint, JS::MutableHandleValue vp);
/**
* If args.get(0) is one of the strings "string", "number", or "default", set
- * *result to JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_VOID accordingly and
+ * result to JSTYPE_STRING, JSTYPE_NUMBER, or JSTYPE_UNDEFINED accordingly and
* return true. Otherwise, return false with a TypeError pending.
*
* This can be useful in implementing a @@toPrimitive method.
*/
extern JS_PUBLIC_API(bool)
GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args, JSType *result);
} /* namespace JS */
--- a/js/src/jsatominlines.h
+++ b/js/src/jsatominlines.h
@@ -190,17 +190,17 @@ AtomHasher::match(const AtomStateEntry&
inline Handle<PropertyName*>
TypeName(JSType type, const JSAtomState& names)
{
MOZ_ASSERT(type < JSTYPE_LIMIT);
JS_STATIC_ASSERT(offsetof(JSAtomState, undefined) +
JSTYPE_LIMIT * sizeof(ImmutablePropertyNamePtr) <=
sizeof(JSAtomState));
- JS_STATIC_ASSERT(JSTYPE_VOID == 0);
+ JS_STATIC_ASSERT(JSTYPE_UNDEFINED == 0);
return (&names.undefined)[type];
}
inline Handle<PropertyName*>
ClassName(JSProtoKey key, JSAtomState& atomState)
{
MOZ_ASSERT(key < JSProto_LIMIT);
JS_STATIC_ASSERT(offsetof(JSAtomState, Null) +
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -2976,17 +2976,17 @@ date_toPrimitive(JSContext* cx, unsigned
ReportIncompatible(cx, args);
return false;
}
// Steps 3-5.
JSType hint;
if (!GetFirstArgumentAsTypeHint(cx, args, &hint))
return false;
- if (hint == JSTYPE_VOID)
+ if (hint == JSTYPE_UNDEFINED)
hint = JSTYPE_STRING;
args.rval().set(args.thisv());
RootedObject obj(cx, &args.thisv().toObject());
return OrdinaryToPrimitive(cx, obj, hint, args.rval());
}
static const JSFunctionSpec date_static_methods[] = {
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2987,26 +2987,26 @@ ReportCantConvert(JSContext* cx, unsigne
if (!str)
return false;
} else {
str = nullptr;
}
RootedValue val(cx, ObjectValue(*obj));
ReportValueError2(cx, errorNumber, JSDVG_SEARCH_STACK, val, str,
- hint == JSTYPE_VOID
+ hint == JSTYPE_UNDEFINED
? "primitive type"
: hint == JSTYPE_STRING ? "string" : "number");
return false;
}
bool
JS::OrdinaryToPrimitive(JSContext* cx, HandleObject obj, JSType hint, MutableHandleValue vp)
{
- MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
+ MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_UNDEFINED);
Rooted<jsid> id(cx);
const Class* clasp = obj->getClass();
if (hint == JSTYPE_STRING) {
id = NameToId(cx->names().toString);
/* Optimize (new String(...)).toString(). */
@@ -3064,17 +3064,17 @@ JS::OrdinaryToPrimitive(JSContext* cx, H
return ReportCantConvert(cx, JSMSG_CANT_CONVERT_TO, obj, hint);
}
bool
js::ToPrimitiveSlow(JSContext* cx, JSType preferredType, MutableHandleValue vp)
{
// Step numbers refer to the first algorithm listed in ES6 draft rev 36
// (2015 Mar 17) 7.1.1 ToPrimitive.
- MOZ_ASSERT(preferredType == JSTYPE_VOID ||
+ MOZ_ASSERT(preferredType == JSTYPE_UNDEFINED ||
preferredType == JSTYPE_STRING ||
preferredType == JSTYPE_NUMBER);
RootedObject obj(cx, &vp.toObject());
// Steps 4-5.
RootedId id(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().toPrimitive));
RootedValue method(cx);
if (!GetProperty(cx, obj, obj, id, &method))
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1046,17 +1046,17 @@ UnwatchProperty(JSContext* cx, HandleObj
extern bool
ToPrimitiveSlow(JSContext* cx, JSType hint, MutableHandleValue vp);
inline bool
ToPrimitive(JSContext* cx, MutableHandleValue vp)
{
if (vp.isPrimitive())
return true;
- return ToPrimitiveSlow(cx, JSTYPE_VOID, vp);
+ return ToPrimitiveSlow(cx, JSTYPE_UNDEFINED, vp);
}
inline bool
ToPrimitive(JSContext* cx, JSType preferredType, MutableHandleValue vp)
{
if (vp.isPrimitive())
return true;
return ToPrimitiveSlow(cx, preferredType, vp);
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -59,17 +59,17 @@ enum JSVersion {
JSVERSION_ECMA_5 = 185,
JSVERSION_DEFAULT = 0,
JSVERSION_UNKNOWN = -1,
JSVERSION_LATEST = JSVERSION_ECMA_5
};
/* Result of typeof operator enumeration. */
enum JSType {
- JSTYPE_VOID, /* undefined */
+ JSTYPE_UNDEFINED, /* undefined */
JSTYPE_OBJECT, /* object */
JSTYPE_FUNCTION, /* function */
JSTYPE_STRING, /* string */
JSTYPE_NUMBER, /* number */
JSTYPE_BOOLEAN, /* boolean */
JSTYPE_NULL, /* null */
JSTYPE_SYMBOL, /* symbol */
JSTYPE_LIMIT
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -929,33 +929,33 @@ js::SameValue(JSContext* cx, HandleValue
}
return StrictlyEqual(cx, v1, v2, same);
}
JSType
js::TypeOfObject(JSObject* obj)
{
if (EmulatesUndefined(obj))
- return JSTYPE_VOID;
+ return JSTYPE_UNDEFINED;
if (obj->isCallable())
return JSTYPE_FUNCTION;
return JSTYPE_OBJECT;
}
JSType
js::TypeOfValue(const Value& v)
{
if (v.isNumber())
return JSTYPE_NUMBER;
if (v.isString())
return JSTYPE_STRING;
if (v.isNull())
return JSTYPE_OBJECT;
if (v.isUndefined())
- return JSTYPE_VOID;
+ return JSTYPE_UNDEFINED;
if (v.isObject())
return TypeOfObject(&v.toObject());
if (v.isBoolean())
return JSTYPE_BOOLEAN;
MOZ_ASSERT(v.isSymbol());
return JSTYPE_SYMBOL;
}
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -113,17 +113,17 @@ XPC_WN_Shared_toPrimitive(JSContext* cx,
if (!GetFirstArgumentAsTypeHint(cx, args, &hint))
return false;
if (hint == JSTYPE_NUMBER) {
args.rval().set(JS_GetNaNValue(cx));
return true;
}
- MOZ_ASSERT(hint == JSTYPE_STRING || hint == JSTYPE_VOID);
+ MOZ_ASSERT(hint == JSTYPE_STRING || hint == JSTYPE_UNDEFINED);
ccx.SetName(ccx.GetContext()->GetStringID(XPCJSContext::IDX_TO_STRING));
ccx.SetArgsAndResultPtr(0, nullptr, args.rval().address());
XPCNativeMember* member = ccx.GetMember();
if (member && member->IsMethod()) {
if (!XPCWrappedNative::CallMethod(ccx))
return false;