зеркало из https://github.com/mozilla/gecko-dev.git
Bug 887563 - Convert CallArgs::operator[] to return a Handle; r=Waldo,bz
--HG-- extra : rebase_source : a06130820b34f6e1f5bc317e89c087cf0db9eeb8
This commit is contained in:
Родитель
eeb7f6da47
Коммит
28afcc4d1d
|
@ -3782,7 +3782,7 @@ class CGArgumentConverter(CGThing):
|
|||
"obj" : "obj"
|
||||
}
|
||||
self.replacementVariables["val"] = string.Template(
|
||||
"args.handleAt(${index})"
|
||||
"args[${index}]"
|
||||
).substitute(replacer)
|
||||
self.replacementVariables["mutableVal"] = self.replacementVariables["val"]
|
||||
if argument.treatUndefinedAs == "Missing":
|
||||
|
@ -3851,7 +3851,7 @@ class CGArgumentConverter(CGThing):
|
|||
${elemType}& slot = *${declName}.AppendElement();
|
||||
""").substitute(replacer)
|
||||
|
||||
val = string.Template("args.handleAt(variadicArg)").substitute(replacer)
|
||||
val = string.Template("args[variadicArg]").substitute(replacer)
|
||||
variadicConversion += CGIndenter(CGGeneric(
|
||||
string.Template(typeConversion.template).substitute(
|
||||
{
|
||||
|
@ -4920,7 +4920,7 @@ class CGMethodCall(CGThing):
|
|||
range(0, distinguishingIndex) ]
|
||||
|
||||
# Select the right overload from our set.
|
||||
distinguishingArg = "args.handleAt(%d)" % distinguishingIndex
|
||||
distinguishingArg = "args[%d]" % distinguishingIndex
|
||||
|
||||
def pickFirstSignature(condition, filterLambda):
|
||||
sigs = filter(filterLambda, possibleSignatures)
|
||||
|
@ -5539,7 +5539,7 @@ if (!v.isObject()) {
|
|||
return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "%s.%s");
|
||||
}
|
||||
|
||||
return JS_SetProperty(cx, &v.toObject(), "%s", args.handleAt(0));""" % (attrName, self.descriptor.interface.identifier.name, attrName, forwardToAttrName))).define()
|
||||
return JS_SetProperty(cx, &v.toObject(), "%s", args[0]);""" % (attrName, self.descriptor.interface.identifier.name, attrName, forwardToAttrName))).define()
|
||||
|
||||
def memberIsCreator(member):
|
||||
return member.getExtendedAttribute("Creator") is not None
|
||||
|
|
|
@ -317,13 +317,7 @@ class MOZ_STACK_CLASS CallArgsBase :
|
|||
unsigned length() const { return argc_; }
|
||||
|
||||
/* Returns the i-th zero-indexed argument. */
|
||||
Value &operator[](unsigned i) const {
|
||||
MOZ_ASSERT(i < argc_);
|
||||
return this->argv_[i];
|
||||
}
|
||||
|
||||
/* Returns a mutable handle for the i-th zero-indexed argument. */
|
||||
MutableHandleValue handleAt(unsigned i) const {
|
||||
MutableHandleValue operator[](unsigned i) const {
|
||||
MOZ_ASSERT(i < argc_);
|
||||
return MutableHandleValue::fromMarkedLocation(&this->argv_[i]);
|
||||
}
|
||||
|
@ -332,15 +326,7 @@ class MOZ_STACK_CLASS CallArgsBase :
|
|||
* Returns the i-th zero-indexed argument, or |undefined| if there's no
|
||||
* such argument.
|
||||
*/
|
||||
Value get(unsigned i) const {
|
||||
return i < length() ? this->argv_[i] : UndefinedValue();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the i-th zero-indexed argument as a handle, or |undefined| if
|
||||
* there's no such argument.
|
||||
*/
|
||||
HandleValue handleOrUndefinedAt(unsigned i) const {
|
||||
HandleValue get(unsigned i) const {
|
||||
return i < length()
|
||||
? HandleValue::fromMarkedLocation(&this->argv_[i])
|
||||
: UndefinedHandleValue;
|
||||
|
|
|
@ -518,8 +518,8 @@ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T>
|
|||
|
||||
T *ptr;
|
||||
|
||||
template <typename S>
|
||||
void operator=(S v) MOZ_DELETE;
|
||||
template <typename S> void operator=(S v) MOZ_DELETE;
|
||||
void operator=(MutableHandle other) MOZ_DELETE;
|
||||
};
|
||||
|
||||
typedef MutableHandle<JSObject*> MutableHandleObject;
|
||||
|
|
|
@ -1467,6 +1467,7 @@ class ValueOperations
|
|||
void *toGCThing() const { return value()->toGCThing(); }
|
||||
|
||||
JSValueType extractNonDoubleType() const { return value()->extractNonDoubleType(); }
|
||||
uint32_t toPrivateUint32() const { return value()->toPrivateUint32(); }
|
||||
|
||||
JSWhyMagic whyMagic() const { return value()->whyMagic(); }
|
||||
};
|
||||
|
|
|
@ -407,9 +407,9 @@ IntlInitialize(JSContext *cx, HandleObject obj, Handle<PropertyName*> initialize
|
|||
|
||||
args.setCallee(initializerValue);
|
||||
args.setThis(NullValue());
|
||||
args[0] = ObjectValue(*obj);
|
||||
args[1] = locales;
|
||||
args[2] = options;
|
||||
args[0].setObject(*obj);
|
||||
args[1].set(locales);
|
||||
args[2].set(options);
|
||||
|
||||
return Invoke(cx, args);
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ GetInternals(JSContext *cx, HandleObject obj, MutableHandleObject internals)
|
|||
|
||||
args.setCallee(getInternalsValue);
|
||||
args.setThis(NullValue());
|
||||
args[0] = ObjectValue(*obj);
|
||||
args[0].setObject(*obj);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return false;
|
||||
|
|
|
@ -53,7 +53,7 @@ obj_propertyIsEnumerable(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* Step 1. */
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(0), &id))
|
||||
return false;
|
||||
|
||||
/* Step 2. */
|
||||
|
@ -362,7 +362,7 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args[0], &id))
|
||||
return false;
|
||||
|
||||
RootedObject descObj(cx, NewBuiltinClassInstance(cx, &JSObject::class_));
|
||||
|
@ -415,7 +415,7 @@ obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(0), &id))
|
||||
return JS_FALSE;
|
||||
RootedObject obj(cx, ToObject(cx, args.thisv()));
|
||||
if (!obj)
|
||||
|
@ -451,7 +451,7 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(0), &id))
|
||||
return JS_FALSE;
|
||||
RootedObject obj(cx, ToObject(cx, args.thisv()));
|
||||
if (!obj)
|
||||
|
@ -561,7 +561,7 @@ obj_watch(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
RootedId propid(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleAt(0), &propid))
|
||||
if (!ValueToId<CanGC>(cx, args[0], &propid))
|
||||
return false;
|
||||
|
||||
RootedObject obj(cx, ToObject(cx, args.thisv()));
|
||||
|
@ -589,7 +589,7 @@ obj_unwatch(JSContext *cx, unsigned argc, Value *vp)
|
|||
args.rval().setUndefined();
|
||||
RootedId id(cx);
|
||||
if (argc != 0) {
|
||||
if (!ValueToId<CanGC>(cx, args.handleAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args[0], &id))
|
||||
return false;
|
||||
} else {
|
||||
id = JSID_VOID;
|
||||
|
@ -605,7 +605,7 @@ obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
HandleValue idValue = args.handleOrUndefinedAt(0);
|
||||
HandleValue idValue = args.get(0);
|
||||
|
||||
/* Step 1, 2. */
|
||||
jsid id;
|
||||
|
@ -731,7 +731,7 @@ obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (!GetFirstArgumentAsObject(cx, args, "Object.getOwnPropertyDescriptor", &obj))
|
||||
return JS_FALSE;
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(1), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(1), &id))
|
||||
return JS_FALSE;
|
||||
return GetOwnPropertyDescriptor(cx, obj, id, args.rval());
|
||||
}
|
||||
|
@ -836,11 +836,11 @@ obj_defineProperty(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(1), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(1), &id))
|
||||
return JS_FALSE;
|
||||
|
||||
JSBool junk;
|
||||
if (!DefineOwnProperty(cx, obj, id, args.handleOrUndefinedAt(2), &junk))
|
||||
if (!DefineOwnProperty(cx, obj, id, args.get(2), &junk))
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*obj);
|
||||
|
|
|
@ -170,7 +170,7 @@ ParallelArrayObject::constructHelper(JSContext *cx, MutableHandleFunction ctor,
|
|||
args.setThis(ObjectValue(*result));
|
||||
|
||||
for (uint32_t i = 0; i < args0.length(); i++)
|
||||
args[i] = args0[i];
|
||||
args[i].set(args0[i]);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return false;
|
||||
|
|
|
@ -280,7 +280,7 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args)
|
|||
|
||||
RegExpFlag flags = RegExpFlag(0);
|
||||
if (args.hasDefined(1)) {
|
||||
RootedString flagStr(cx, ToString<CanGC>(cx, args.handleAt(1)));
|
||||
RootedString flagStr(cx, ToString<CanGC>(cx, args[1]));
|
||||
if (!flagStr)
|
||||
return false;
|
||||
args[1].setString(flagStr);
|
||||
|
@ -604,7 +604,7 @@ ExecuteRegExp(JSContext *cx, CallArgs args, MatchConduit &matches)
|
|||
RootedObject regexp(cx, &args.thisv().toObject());
|
||||
|
||||
/* Step 2. */
|
||||
RootedString string(cx, ToString<CanGC>(cx, args.handleOrUndefinedAt(0)));
|
||||
RootedString string(cx, ToString<CanGC>(cx, args.get(0)));
|
||||
if (!string)
|
||||
return RegExpRunStatus_Error;
|
||||
|
||||
|
@ -637,7 +637,7 @@ static bool
|
|||
regexp_exec_impl(JSContext *cx, CallArgs args)
|
||||
{
|
||||
RootedObject regexp(cx, &args.thisv().toObject());
|
||||
RootedString string(cx, ToString<CanGC>(cx, args.handleOrUndefinedAt(0)));
|
||||
RootedString string(cx, ToString<CanGC>(cx, args.get(0)));
|
||||
if (!string)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -3132,7 +3132,7 @@ CType::ConstructBasic(JSContext* cx,
|
|||
return JS_FALSE;
|
||||
|
||||
if (args.length() == 1) {
|
||||
if (!ExplicitConvert(cx, args.handleAt(0), obj, CData::GetData(result)))
|
||||
if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result)))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -3955,7 +3955,7 @@ PointerType::ConstructData(JSContext* cx,
|
|||
JS_ReportError(cx, "first argument must be a function");
|
||||
return JS_FALSE;
|
||||
}
|
||||
return ExplicitConvert(cx, args.handleAt(0), obj, CData::GetData(result));
|
||||
return ExplicitConvert(cx, args[0], obj, CData::GetData(result));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -4344,7 +4344,7 @@ ArrayType::ConstructData(JSContext* cx,
|
|||
args.rval().setObject(*result);
|
||||
|
||||
if (convertObject) {
|
||||
if (!ExplicitConvert(cx, args.handleAt(0), obj, CData::GetData(result)))
|
||||
if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result)))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -5023,7 +5023,7 @@ StructType::ConstructData(JSContext* cx,
|
|||
// are mutually exclusive, so we can pick the right one.
|
||||
|
||||
// Try option 1) first.
|
||||
if (ExplicitConvert(cx, args.handleAt(0), obj, buffer))
|
||||
if (ExplicitConvert(cx, args[0], obj, buffer))
|
||||
return JS_TRUE;
|
||||
|
||||
if (fields->count() != 1)
|
||||
|
@ -5047,7 +5047,7 @@ StructType::ConstructData(JSContext* cx,
|
|||
for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) {
|
||||
const FieldInfo& field = r.front().value;
|
||||
STATIC_ASSUME(field.mIndex < fields->count()); /* Quantified invariant */
|
||||
if (!ImplicitConvert(cx, args.handleAt(field.mIndex), field.mType,
|
||||
if (!ImplicitConvert(cx, args[field.mIndex], field.mType,
|
||||
buffer + field.mOffset,
|
||||
false, NULL))
|
||||
return JS_FALSE;
|
||||
|
@ -5764,7 +5764,7 @@ FunctionType::Call(JSContext* cx,
|
|||
}
|
||||
|
||||
for (unsigned i = 0; i < argcFixed; ++i)
|
||||
if (!ConvertArgument(cx, args.handleAt(i), fninfo->mArgTypes[i], &values[i], &strings))
|
||||
if (!ConvertArgument(cx, args[i], fninfo->mArgTypes[i], &values[i], &strings))
|
||||
return false;
|
||||
|
||||
if (fninfo->mIsVariadic) {
|
||||
|
@ -5789,7 +5789,7 @@ FunctionType::Call(JSContext* cx,
|
|||
!(type = PrepareType(cx, OBJECT_TO_JSVAL(type))) ||
|
||||
// Relying on ImplicitConvert only for the limited purpose of
|
||||
// converting one CType to another (e.g., T[] to T*).
|
||||
!ConvertArgument(cx, args.handleAt(i), type, &values[i], &strings) ||
|
||||
!ConvertArgument(cx, args[i], type, &values[i], &strings) ||
|
||||
!(fninfo->mFFITypes[i] = CType::GetFFIType(cx, type))) {
|
||||
// These functions report their own errors.
|
||||
return false;
|
||||
|
|
|
@ -448,7 +448,7 @@ HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, Hand
|
|||
args2.setCallee(ObjectValue(*fun));
|
||||
args2.setThis(args.thisv());
|
||||
for (unsigned i = 0; i < argc; i++)
|
||||
args2[i] = args[i];
|
||||
args2[i].set(args[i]);
|
||||
|
||||
if (!Invoke(cx, args2))
|
||||
return false;
|
||||
|
|
|
@ -910,7 +910,7 @@ array_join_sub(JSContext *cx, CallArgs &args, bool locale)
|
|||
// Steps 4 and 5
|
||||
RootedString sepstr(cx, NULL);
|
||||
if (!locale && args.hasDefined(0)) {
|
||||
sepstr = ToString<CanGC>(cx, args.handleAt(0));
|
||||
sepstr = ToString<CanGC>(cx, args[0]);
|
||||
if (!sepstr)
|
||||
return false;
|
||||
}
|
||||
|
@ -1445,8 +1445,8 @@ SortComparatorFunction::operator()(const Value &a, const Value &b, bool *lessOrE
|
|||
|
||||
args.setCallee(fval);
|
||||
args.setThis(UndefinedValue());
|
||||
args[0] = a;
|
||||
args[1] = b;
|
||||
args[0].set(a);
|
||||
args[1].set(b);
|
||||
|
||||
if (!fig.invoke(cx))
|
||||
return false;
|
||||
|
@ -2232,7 +2232,7 @@ array_splice(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* Step 5. */
|
||||
double relativeStart;
|
||||
if (!ToInteger(cx, args.handleOrUndefinedAt(0), &relativeStart))
|
||||
if (!ToInteger(cx, args.get(0), &relativeStart))
|
||||
return false;
|
||||
|
||||
/* Step 6. */
|
||||
|
@ -2552,7 +2552,7 @@ array_slice(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
if (args.length() > 0) {
|
||||
double d;
|
||||
if (!ToInteger(cx, args.handleAt(0), &d))
|
||||
if (!ToInteger(cx, args[0], &d))
|
||||
return false;
|
||||
if (d < 0) {
|
||||
d += length;
|
||||
|
@ -2564,7 +2564,7 @@ array_slice(JSContext *cx, unsigned argc, Value *vp)
|
|||
begin = (uint32_t)d;
|
||||
|
||||
if (args.hasDefined(1)) {
|
||||
if (!ToInteger(cx, args.handleAt(1), &d))
|
||||
if (!ToInteger(cx, args[1], &d))
|
||||
return false;
|
||||
if (d < 0) {
|
||||
d += length;
|
||||
|
@ -2675,9 +2675,9 @@ array_filter(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
args2.setCallee(ObjectValue(*callable));
|
||||
args2.setThis(thisv);
|
||||
args2[0] = kValue;
|
||||
args2[1] = NumberValue(k);
|
||||
args2[2] = ObjectValue(*obj);
|
||||
args2[0].set(kValue);
|
||||
args2[1].setNumber(k);
|
||||
args2[2].setObject(*obj);
|
||||
if (!fig.invoke(cx))
|
||||
return false;
|
||||
|
||||
|
@ -2761,7 +2761,7 @@ array_of(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
// Step 8.
|
||||
for (unsigned k = 0; k < argc; k++) {
|
||||
if (!JSObject::defineElement(cx, obj, k, args.handleAt(k)))
|
||||
if (!JSObject::defineElement(cx, obj, k, args[k]))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -614,7 +614,7 @@ date_msecFromArgs(JSContext *cx, CallArgs args, double *rval)
|
|||
for (loop = 0; loop < MAXARGS; loop++) {
|
||||
if (loop < args.length()) {
|
||||
double d;
|
||||
if (!ToNumber(cx, args.handleAt(loop), &d))
|
||||
if (!ToNumber(cx, args[loop], &d))
|
||||
return JS_FALSE;
|
||||
/* return NaN if any arg is not finite */
|
||||
if (!IsFinite(d)) {
|
||||
|
@ -1206,7 +1206,7 @@ date_parse(JSContext *cx, unsigned argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
JSString *str = ToString<CanGC>(cx, args.handleAt(0));
|
||||
JSString *str = ToString<CanGC>(cx, args[0]);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ date_setTime_impl(JSContext *cx, CallArgs args)
|
|||
}
|
||||
|
||||
double result;
|
||||
if (!ToNumber(cx, args.handleAt(0), &result))
|
||||
if (!ToNumber(cx, args[0], &result))
|
||||
return false;
|
||||
|
||||
dateObj->setUTCTime(TimeClip(result), args.rval().address());
|
||||
|
@ -1735,7 +1735,7 @@ GetMsecsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, dou
|
|||
*millis = msFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args.handleAt(i), millis);
|
||||
return ToNumber(cx, args[i], millis);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1745,7 +1745,7 @@ GetSecsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*sec = SecFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args.handleAt(i), sec);
|
||||
return ToNumber(cx, args[i], sec);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -1755,7 +1755,7 @@ GetMinsOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*mins = MinFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args.handleAt(i), mins);
|
||||
return ToNumber(cx, args[i], mins);
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.28. */
|
||||
|
@ -1769,7 +1769,7 @@ date_setMilliseconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double milli;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &milli))
|
||||
if (!ToNumber(cx, args.get(0), &milli))
|
||||
return false;
|
||||
double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ date_setUTCMilliseconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double milli;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &milli))
|
||||
if (!ToNumber(cx, args.get(0), &milli))
|
||||
return false;
|
||||
double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ date_setSeconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double s;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &s))
|
||||
if (!ToNumber(cx, args.get(0), &s))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1866,7 +1866,7 @@ date_setUTCSeconds_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double s;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &s))
|
||||
if (!ToNumber(cx, args.get(0), &s))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1903,7 +1903,7 @@ date_setMinutes_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
if (!ToNumber(cx, args.get(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1945,7 +1945,7 @@ date_setUTCMinutes_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
if (!ToNumber(cx, args.get(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -1987,7 +1987,7 @@ date_setHours_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double h;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &h))
|
||||
if (!ToNumber(cx, args.get(0), &h))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2034,7 +2034,7 @@ date_setUTCHours_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double h;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &h))
|
||||
if (!ToNumber(cx, args.get(0), &h))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2081,7 +2081,7 @@ date_setDate_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double date;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &date))
|
||||
if (!ToNumber(cx, args.get(0), &date))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2113,7 +2113,7 @@ date_setUTCDate_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double date;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &date))
|
||||
if (!ToNumber(cx, args.get(0), &date))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2141,7 +2141,7 @@ GetDateOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, doub
|
|||
*date = DateFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args.handleAt(i), date);
|
||||
return ToNumber(cx, args[i], date);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -2151,7 +2151,7 @@ GetMonthOrDefault(JSContext *cx, const CallArgs &args, unsigned i, double t, dou
|
|||
*month = MonthFromTime(t);
|
||||
return true;
|
||||
}
|
||||
return ToNumber(cx, args.handleAt(i), month);
|
||||
return ToNumber(cx, args[i], month);
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.38. */
|
||||
|
@ -2165,7 +2165,7 @@ date_setMonth_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
if (!ToNumber(cx, args.get(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2202,7 +2202,7 @@ date_setUTCMonth_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double m;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &m))
|
||||
if (!ToNumber(cx, args.get(0), &m))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2255,7 +2255,7 @@ date_setFullYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
if (!ToNumber(cx, args.get(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2297,7 +2297,7 @@ date_setUTCFullYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
if (!ToNumber(cx, args.get(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2339,7 +2339,7 @@ date_setYear_impl(JSContext *cx, CallArgs args)
|
|||
|
||||
/* Step 2. */
|
||||
double y;
|
||||
if (!ToNumber(cx, args.handleOrUndefinedAt(0), &y))
|
||||
if (!ToNumber(cx, args.get(0), &y))
|
||||
return false;
|
||||
|
||||
/* Step 3. */
|
||||
|
@ -2796,7 +2796,7 @@ date_toLocaleFormat_impl(JSContext *cx, CallArgs args)
|
|||
, args.rval());
|
||||
}
|
||||
|
||||
RootedString fmt(cx, ToString<CanGC>(cx, args.handleAt(0)));
|
||||
RootedString fmt(cx, ToString<CanGC>(cx, args[0]));
|
||||
if (!fmt)
|
||||
return false;
|
||||
|
||||
|
@ -2984,7 +2984,7 @@ js_Date(JSContext *cx, unsigned argc, Value *vp)
|
|||
/* ES5 15.9.3.2. */
|
||||
|
||||
/* Step 1. */
|
||||
if (!ToPrimitive(cx, args.handleAt(0)))
|
||||
if (!ToPrimitive(cx, args[0]))
|
||||
return false;
|
||||
|
||||
if (args[0].isString()) {
|
||||
|
@ -3003,7 +3003,7 @@ js_Date(JSContext *cx, unsigned argc, Value *vp)
|
|||
d = TimeClip(d);
|
||||
} else {
|
||||
/* Step 3. */
|
||||
if (!ToNumber(cx, args.handleAt(0), &d))
|
||||
if (!ToNumber(cx, args[0], &d))
|
||||
return false;
|
||||
d = TimeClip(d);
|
||||
}
|
||||
|
|
|
@ -554,7 +554,7 @@ Exception(JSContext *cx, unsigned argc, Value *vp)
|
|||
/* Set the 'message' property. */
|
||||
RootedString message(cx);
|
||||
if (args.hasDefined(0)) {
|
||||
message = ToString<CanGC>(cx, args.handleAt(0));
|
||||
message = ToString<CanGC>(cx, args[0]);
|
||||
if (!message)
|
||||
return false;
|
||||
args[0].setString(message);
|
||||
|
@ -569,7 +569,7 @@ Exception(JSContext *cx, unsigned argc, Value *vp)
|
|||
RootedScript script(cx, iter.done() ? NULL : iter.script());
|
||||
RootedString filename(cx);
|
||||
if (args.length() > 1) {
|
||||
filename = ToString<CanGC>(cx, args.handleAt(1));
|
||||
filename = ToString<CanGC>(cx, args[1]);
|
||||
if (!filename)
|
||||
return false;
|
||||
args[1].setString(filename);
|
||||
|
|
|
@ -1488,10 +1488,10 @@ class JSJitSetterCallArgs : protected JS::MutableHandleValue
|
|||
{
|
||||
public:
|
||||
explicit JSJitSetterCallArgs(const JS::CallArgs& args)
|
||||
: JS::MutableHandleValue(args.handleAt(0))
|
||||
: JS::MutableHandleValue(args[0])
|
||||
{}
|
||||
|
||||
JS::MutableHandleValue handleAt(unsigned i) {
|
||||
JS::MutableHandleValue operator[](unsigned i) {
|
||||
MOZ_ASSERT(i == 0);
|
||||
return *this;
|
||||
}
|
||||
|
@ -1525,8 +1525,8 @@ class JSJitMethodCallArgs : protected JS::detail::CallArgsBase<JS::detail::NoUse
|
|||
|
||||
unsigned length() const { return Base::length(); }
|
||||
|
||||
JS::MutableHandleValue handleAt(unsigned i) const {
|
||||
return Base::handleAt(i);
|
||||
JS::MutableHandleValue operator[](unsigned i) const {
|
||||
return Base::operator[](i);
|
||||
}
|
||||
|
||||
bool hasDefined(unsigned i) const {
|
||||
|
|
|
@ -1206,7 +1206,7 @@ js::CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* 15.3.4.5.1, 15.3.4.5.2 step 4. */
|
||||
for (unsigned i = 0; i < argslen; i++)
|
||||
invokeArgs[i] = fun->getBoundFunctionArgument(i);
|
||||
invokeArgs[i].set(fun->getBoundFunctionArgument(i));
|
||||
PodCopy(invokeArgs.array() + argslen, vp + 2, argc);
|
||||
|
||||
/* 15.3.4.5.1, 15.3.4.5.2 step 5. */
|
||||
|
@ -1381,7 +1381,7 @@ js::Function(JSContext *cx, unsigned argc, Value *vp)
|
|||
size_t args_length = 0;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
/* Collect the lengths for all the function-argument arguments. */
|
||||
arg = ToString<CanGC>(cx, args.handleAt(i));
|
||||
arg = ToString<CanGC>(cx, args[i]);
|
||||
if (!arg)
|
||||
return false;
|
||||
args[i].setString(arg);
|
||||
|
@ -1501,7 +1501,7 @@ js::Function(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (!args.length())
|
||||
str = cx->runtime()->emptyString;
|
||||
else
|
||||
str = ToString<CanGC>(cx, args.handleAt(args.length() - 1));
|
||||
str = ToString<CanGC>(cx, args[args.length() - 1]);
|
||||
if (!str)
|
||||
return false;
|
||||
JSLinearString *linear = str->ensureLinear(cx);
|
||||
|
|
|
@ -756,7 +756,7 @@ js::IteratorConstructor(JSContext *cx, unsigned argc, Value *vp)
|
|||
keyonly = ToBoolean(args[1]);
|
||||
unsigned flags = JSITER_OWNONLY | (keyonly ? 0 : (JSITER_FOREACH | JSITER_KEYVALUE));
|
||||
|
||||
if (!ValueToIterator(cx, flags, MutableHandleValue::fromMarkedLocation(&args[0])))
|
||||
if (!ValueToIterator(cx, flags, args[0]))
|
||||
return false;
|
||||
args.rval().set(args[0]);
|
||||
return true;
|
||||
|
|
|
@ -124,7 +124,7 @@ js_math_abs(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
double z = Abs(x);
|
||||
|
@ -153,7 +153,7 @@ js::math_acos(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -186,7 +186,7 @@ js::math_asin(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -215,7 +215,7 @@ js::math_atan(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -268,7 +268,7 @@ js::math_atan2(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x) || !ToNumber(cx, args.handleAt(1), &y))
|
||||
if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
|
||||
return false;
|
||||
|
||||
double z = ecmaAtan2(x, y);
|
||||
|
@ -297,7 +297,7 @@ js_math_ceil(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
double z = js_math_ceil_impl(x);
|
||||
|
@ -322,7 +322,7 @@ js::math_cos(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -359,7 +359,7 @@ js::math_exp(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -388,7 +388,7 @@ js_math_floor(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
double z = js_math_floor_impl(x);
|
||||
|
@ -435,7 +435,7 @@ js::math_log(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -455,7 +455,7 @@ js_math_max(JSContext *cx, unsigned argc, Value *vp)
|
|||
double maxval = NegativeInfinity();
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(i), &x))
|
||||
if (!ToNumber(cx, args[i], &x))
|
||||
return false;
|
||||
// Math.max(num, NaN) => NaN, Math.max(-0, +0) => +0
|
||||
if (x > maxval || IsNaN(x) || (x == maxval && IsNegative(maxval)))
|
||||
|
@ -473,7 +473,7 @@ js_math_min(JSContext *cx, unsigned argc, Value *vp)
|
|||
double minval = PositiveInfinity();
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(i), &x))
|
||||
if (!ToNumber(cx, args[i], &x))
|
||||
return false;
|
||||
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
|
||||
if (x < minval || IsNaN(x) || (x == minval && IsNegativeZero(x)))
|
||||
|
@ -562,7 +562,7 @@ js_math_pow(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x) || !ToNumber(cx, args.handleAt(1), &y))
|
||||
if (!ToNumber(cx, args[0], &x) || !ToNumber(cx, args[1], &y))
|
||||
return false;
|
||||
|
||||
/*
|
||||
|
@ -699,7 +699,7 @@ js_math_round(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
int32_t i;
|
||||
|
@ -735,7 +735,7 @@ js::math_sin(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -758,7 +758,7 @@ js_math_sqrt(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -787,7 +787,7 @@ js::math_tan(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -812,7 +812,7 @@ JSBool math_function(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
MathCache *mathCache = cx->runtime()->getMathCache(cx);
|
||||
|
@ -1146,10 +1146,10 @@ js::math_hypot(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
if (!ToNumber(cx, args.handleAt(1), &y))
|
||||
if (!ToNumber(cx, args[1], &y))
|
||||
return false;
|
||||
|
||||
if (args.length() == 2) {
|
||||
|
@ -1159,7 +1159,7 @@ js::math_hypot(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* args.length() > 2 */
|
||||
double z;
|
||||
if (!ToNumber(cx, args.handleAt(2), &z)) {
|
||||
if (!ToNumber(cx, args[2], &z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ num_isNaN(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
args.rval().setBoolean(mozilla::IsNaN(x));
|
||||
|
@ -261,7 +261,7 @@ num_isFinite(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
double x;
|
||||
if (!ToNumber(cx, args.handleAt(0), &x))
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
|
||||
args.rval().setBoolean(mozilla::IsFinite(x));
|
||||
|
@ -277,7 +277,7 @@ num_parseFloat(JSContext *cx, unsigned argc, Value *vp)
|
|||
args.rval().setDouble(js_NaN);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSString *str = ToString<CanGC>(cx, args.handleAt(0));
|
||||
JSString *str = ToString<CanGC>(cx, args[0]);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
const jschar *bp = str->getChars(cx);
|
||||
|
@ -344,7 +344,7 @@ js::num_parseInt(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
/* Step 1. */
|
||||
RootedString inputString(cx, ToString<CanGC>(cx, args.handleAt(0)));
|
||||
RootedString inputString(cx, ToString<CanGC>(cx, args[0]));
|
||||
if (!inputString)
|
||||
return false;
|
||||
args[0].setString(inputString);
|
||||
|
@ -439,7 +439,7 @@ Number(JSContext *cx, unsigned argc, Value *vp)
|
|||
bool isConstructing = args.isConstructing();
|
||||
|
||||
if (args.length() > 0) {
|
||||
if (!ToNumber(cx, args.handleAt(0)))
|
||||
if (!ToNumber(cx, args[0]))
|
||||
return false;
|
||||
args.rval().set(args[0]);
|
||||
} else {
|
||||
|
@ -605,7 +605,7 @@ num_toString_impl(JSContext *cx, CallArgs args)
|
|||
int32_t base = 10;
|
||||
if (args.hasDefined(0)) {
|
||||
double d2;
|
||||
if (!ToInteger(cx, args.handleAt(0), &d2))
|
||||
if (!ToInteger(cx, args[0], &d2))
|
||||
return false;
|
||||
|
||||
if (d2 < 2 || d2 > 36) {
|
||||
|
@ -830,7 +830,7 @@ num_toFixed_impl(JSContext *cx, CallArgs args)
|
|||
if (args.length() == 0) {
|
||||
precision = 0;
|
||||
} else {
|
||||
if (!ComputePrecisionInRange(cx, -20, MAX_PRECISION, args.handleAt(0), &precision))
|
||||
if (!ComputePrecisionInRange(cx, -20, MAX_PRECISION, args[0], &precision))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ num_toExponential_impl(JSContext *cx, CallArgs args)
|
|||
precision = 0;
|
||||
} else {
|
||||
mode = DTOSTR_EXPONENTIAL;
|
||||
if (!ComputePrecisionInRange(cx, 0, MAX_PRECISION, args.handleAt(0), &precision))
|
||||
if (!ComputePrecisionInRange(cx, 0, MAX_PRECISION, args[0], &precision))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -894,7 +894,7 @@ num_toPrecision_impl(JSContext *cx, CallArgs args)
|
|||
precision = 0;
|
||||
} else {
|
||||
mode = DTOSTR_PRECISION;
|
||||
if (!ComputePrecisionInRange(cx, 1, MAX_PRECISION, args.handleAt(0), &precision))
|
||||
if (!ComputePrecisionInRange(cx, 1, MAX_PRECISION, args[0], &precision))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -979,7 +979,7 @@ Number_toInteger(JSContext *cx, unsigned argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
double asint;
|
||||
if (!ToInteger(cx, args.handleAt(0), &asint))
|
||||
if (!ToInteger(cx, args[0], &asint))
|
||||
return false;
|
||||
args.rval().setNumber(asint);
|
||||
return true;
|
||||
|
|
|
@ -327,7 +327,7 @@ js::GetFirstArgumentAsObject(JSContext *cx, const CallArgs &args, const char *me
|
|||
return false;
|
||||
}
|
||||
|
||||
HandleValue v = args.handleAt(0);
|
||||
HandleValue v = args[0];
|
||||
if (!v.isObject()) {
|
||||
char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
|
||||
if (!bytes)
|
||||
|
|
|
@ -200,7 +200,7 @@ PreprocessValue(JSContext *cx, HandleObject holder, KeyType key, MutableHandleVa
|
|||
|
||||
args.setCallee(toJSON);
|
||||
args.setThis(vp);
|
||||
args[0] = StringValue(keyStr);
|
||||
args[0].setString(keyStr);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return false;
|
||||
|
@ -222,8 +222,8 @@ PreprocessValue(JSContext *cx, HandleObject holder, KeyType key, MutableHandleVa
|
|||
|
||||
args.setCallee(ObjectValue(*scx->replacer));
|
||||
args.setThis(ObjectValue(*holder));
|
||||
args[0] = StringValue(keyStr);
|
||||
args[1] = vp;
|
||||
args[0].setString(keyStr);
|
||||
args[1].set(vp);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return false;
|
||||
|
@ -747,8 +747,8 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
|||
|
||||
args.setCallee(reviver);
|
||||
args.setThis(ObjectValue(*holder));
|
||||
args[0] = StringValue(key);
|
||||
args[1] = val;
|
||||
args[0].setString(key);
|
||||
args[1].set(val);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return false;
|
||||
|
@ -802,7 +802,7 @@ js_json_parse(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* Step 1. */
|
||||
JSString *str = (args.length() >= 1)
|
||||
? ToString<CanGC>(cx, args.handleAt(0))
|
||||
? ToString<CanGC>(cx, args[0])
|
||||
: cx->names().undefined;
|
||||
if (!str)
|
||||
return false;
|
||||
|
|
|
@ -2960,7 +2960,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
RootedString src(cx, ToString<CanGC>(cx, args.handleAt(0)));
|
||||
RootedString src(cx, ToString<CanGC>(cx, args[0]));
|
||||
if (!src)
|
||||
return JS_FALSE;
|
||||
|
||||
|
|
|
@ -75,11 +75,11 @@ ArgToRootedString(JSContext *cx, CallArgs &args, unsigned argno)
|
|||
if (argno >= args.length())
|
||||
return cx->names().undefined;
|
||||
|
||||
JSString *str = ToString<CanGC>(cx, args.handleAt(argno));
|
||||
JSString *str = ToString<CanGC>(cx, args[argno]);
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
args[argno] = StringValue(str);
|
||||
args[argno].setString(str);
|
||||
return str->ensureLinear(cx);
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ static JSBool
|
|||
str_uneval(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JSString *str = ValueToSource(cx, args.handleOrUndefinedAt(0));
|
||||
JSString *str = ValueToSource(cx, args.get(0));
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
|
@ -633,7 +633,7 @@ str_substring(JSContext *cx, unsigned argc, Value *vp)
|
|||
begin = args[0].toInt32();
|
||||
} else {
|
||||
RootedString strRoot(cx, str);
|
||||
if (!ValueToIntegerRange(cx, args.handleAt(0), &begin))
|
||||
if (!ValueToIntegerRange(cx, args[0], &begin))
|
||||
return false;
|
||||
str = strRoot;
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ str_substring(JSContext *cx, unsigned argc, Value *vp)
|
|||
end = args[1].toInt32();
|
||||
} else {
|
||||
RootedString strRoot(cx, str);
|
||||
if (!ValueToIntegerRange(cx, args.handleAt(1), &end))
|
||||
if (!ValueToIntegerRange(cx, args[1], &end))
|
||||
return false;
|
||||
str = strRoot;
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ str_localeCompare(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (!str)
|
||||
return false;
|
||||
|
||||
RootedString thatStr(cx, ToString<CanGC>(cx, args.handleOrUndefinedAt(0)));
|
||||
RootedString thatStr(cx, ToString<CanGC>(cx, args.get(0)));
|
||||
if (!thatStr)
|
||||
return false;
|
||||
|
||||
|
@ -859,7 +859,7 @@ js_str_charAt(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
double d = 0.0;
|
||||
if (args.length() > 0 && !ToInteger(cx, args.handleAt(0), &d))
|
||||
if (args.length() > 0 && !ToInteger(cx, args[0], &d))
|
||||
return false;
|
||||
|
||||
if (d < 0 || str->length() <= d)
|
||||
|
@ -896,7 +896,7 @@ js_str_charCodeAt(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
double d = 0.0;
|
||||
if (args.length() > 0 && !ToInteger(cx, args.handleAt(0), &d))
|
||||
if (args.length() > 0 && !ToInteger(cx, args[0], &d))
|
||||
return false;
|
||||
|
||||
if (d < 0 || str->length() <= d)
|
||||
|
@ -1220,7 +1220,7 @@ str_contains(JSContext *cx, unsigned argc, Value *vp)
|
|||
pos = (i < 0) ? 0U : uint32_t(i);
|
||||
} else {
|
||||
double d;
|
||||
if (!ToInteger(cx, args.handleAt(1), &d))
|
||||
if (!ToInteger(cx, args[1], &d))
|
||||
return false;
|
||||
pos = uint32_t(Min(Max(d, 0.0), double(UINT32_MAX)));
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ str_indexOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
pos = (i < 0) ? 0U : uint32_t(i);
|
||||
} else {
|
||||
double d;
|
||||
if (!ToInteger(cx, args.handleAt(1), &d))
|
||||
if (!ToInteger(cx, args[1], &d))
|
||||
return false;
|
||||
pos = uint32_t(Min(Max(d, 0.0), double(UINT32_MAX)));
|
||||
}
|
||||
|
@ -1329,7 +1329,7 @@ str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp)
|
|||
i = j;
|
||||
} else {
|
||||
double d;
|
||||
if (!ToNumber(cx, args.handleAt(1), &d))
|
||||
if (!ToNumber(cx, args[1], &d))
|
||||
return false;
|
||||
if (!IsNaN(d)) {
|
||||
d = ToInteger(d);
|
||||
|
@ -1399,7 +1399,7 @@ str_startsWith(JSContext *cx, unsigned argc, Value *vp)
|
|||
pos = (i < 0) ? 0U : uint32_t(i);
|
||||
} else {
|
||||
double d;
|
||||
if (!ToInteger(cx, args.handleAt(1), &d))
|
||||
if (!ToInteger(cx, args[1], &d))
|
||||
return false;
|
||||
pos = uint32_t(Min(Max(d, 0.0), double(UINT32_MAX)));
|
||||
}
|
||||
|
@ -1456,7 +1456,7 @@ str_endsWith(JSContext *cx, unsigned argc, Value *vp)
|
|||
pos = (i < 0) ? 0U : uint32_t(i);
|
||||
} else {
|
||||
double d;
|
||||
if (!ToInteger(cx, args.handleAt(1), &d))
|
||||
if (!ToInteger(cx, args[1], &d))
|
||||
return false;
|
||||
pos = uint32_t(Min(Max(d, 0.0), double(UINT32_MAX)));
|
||||
}
|
||||
|
@ -1712,7 +1712,7 @@ class StringRegExpGuard
|
|||
/* Build RegExp from pattern string. */
|
||||
RootedString opt(cx);
|
||||
if (optarg < args.length()) {
|
||||
opt = ToString<CanGC>(cx, args.handleAt(optarg));
|
||||
opt = ToString<CanGC>(cx, args[optarg]);
|
||||
if (!opt)
|
||||
return false;
|
||||
} else {
|
||||
|
@ -2133,11 +2133,11 @@ FindReplaceLength(JSContext *cx, RegExpStatics *res, ReplaceData &rdata, size_t
|
|||
|
||||
/* Push $&, $1, $2, ... */
|
||||
unsigned argi = 0;
|
||||
if (!res->createLastMatch(cx, args.handleAt(argi++)))
|
||||
if (!res->createLastMatch(cx, args[argi++]))
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < res->getMatches().parenCount(); ++i) {
|
||||
if (!res->createParen(cx, i + 1, args.handleAt(argi++)))
|
||||
if (!res->createParen(cx, i + 1, args[argi++]))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3052,7 +3052,7 @@ js::str_split(JSContext *cx, unsigned argc, Value *vp)
|
|||
uint32_t limit;
|
||||
if (args.hasDefined(1)) {
|
||||
double d;
|
||||
if (!ToNumber(cx, args.handleAt(1), &d))
|
||||
if (!ToNumber(cx, args[1], &d))
|
||||
return false;
|
||||
limit = ToUint32(d);
|
||||
} else {
|
||||
|
@ -3128,7 +3128,7 @@ str_substr(JSContext *cx, unsigned argc, Value *vp)
|
|||
int32_t length, len, begin;
|
||||
if (args.length() > 0) {
|
||||
length = int32_t(str->length());
|
||||
if (!ValueToIntegerRange(cx, args.handleAt(0), &begin))
|
||||
if (!ValueToIntegerRange(cx, args[0], &begin))
|
||||
return false;
|
||||
|
||||
if (begin >= length) {
|
||||
|
@ -3142,7 +3142,7 @@ str_substr(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
if (args.hasDefined(1)) {
|
||||
if (!ValueToIntegerRange(cx, args.handleAt(1), &len))
|
||||
if (!ValueToIntegerRange(cx, args[1], &len))
|
||||
return false;
|
||||
|
||||
if (len <= 0) {
|
||||
|
@ -3177,10 +3177,10 @@ str_concat(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
for (unsigned i = 0; i < args.length(); i++) {
|
||||
JSString *argStr = ToString<NoGC>(cx, args.handleAt(i));
|
||||
JSString *argStr = ToString<NoGC>(cx, args[i]);
|
||||
if (!argStr) {
|
||||
RootedString strRoot(cx, str);
|
||||
argStr = ToString<CanGC>(cx, args.handleAt(i));
|
||||
argStr = ToString<CanGC>(cx, args[i]);
|
||||
if (!argStr)
|
||||
return false;
|
||||
str = strRoot;
|
||||
|
@ -3233,7 +3233,7 @@ str_slice(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (args.length() != 0) {
|
||||
double begin, end, length;
|
||||
|
||||
if (!ToInteger(cx, args.handleAt(0), &begin))
|
||||
if (!ToInteger(cx, args[0], &begin))
|
||||
return false;
|
||||
length = str->length();
|
||||
if (begin < 0) {
|
||||
|
@ -3245,7 +3245,7 @@ str_slice(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
if (args.hasDefined(1)) {
|
||||
if (!ToInteger(cx, args.handleAt(1), &end))
|
||||
if (!ToInteger(cx, args[1], &end))
|
||||
return false;
|
||||
if (end < 0) {
|
||||
end += length;
|
||||
|
@ -3504,7 +3504,7 @@ js_String(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
RootedString str(cx);
|
||||
if (args.length() > 0) {
|
||||
str = ToString<CanGC>(cx, args.handleAt(0));
|
||||
str = ToString<CanGC>(cx, args[0]);
|
||||
if (!str)
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -118,12 +118,11 @@ WeakMapBase::removeWeakMapFromList(WeakMapBase *weakmap)
|
|||
static JSObject *
|
||||
GetKeyArg(JSContext *cx, CallArgs &args)
|
||||
{
|
||||
Value *vp = &args[0];
|
||||
if (vp->isPrimitive()) {
|
||||
if (args[0].isPrimitive()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT);
|
||||
return NULL;
|
||||
}
|
||||
return &vp->toObject();
|
||||
return &args[0].toObject();
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE bool
|
||||
|
|
|
@ -431,7 +431,7 @@ CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArg
|
|||
return false;
|
||||
|
||||
for (size_t n = 0; n < args.length(); ++n) {
|
||||
if (!cx->compartment()->wrap(cx, args.handleAt(n)))
|
||||
if (!cx->compartment()->wrap(cx, args[n]))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const Ca
|
|||
AutoCompartment call(cx, wrapped);
|
||||
|
||||
for (size_t n = 0; n < args.length(); ++n) {
|
||||
if (!cx->compartment()->wrap(cx, args.handleAt(n)))
|
||||
if (!cx->compartment()->wrap(cx, args[n]))
|
||||
return false;
|
||||
}
|
||||
if (!Wrapper::construct(cx, wrapper, args))
|
||||
|
|
|
@ -744,7 +744,7 @@ Options(JSContext *cx, unsigned argc, jsval *vp)
|
|||
str = JS_ValueToString(cx, args[i]);
|
||||
if (!str)
|
||||
return false;
|
||||
args[i] = STRING_TO_JSVAL(str);
|
||||
args[i].setString(str);
|
||||
JSAutoByteString opt(cx, str);
|
||||
if (!opt)
|
||||
return false;
|
||||
|
@ -1192,7 +1192,7 @@ Run(JSContext *cx, unsigned argc, jsval *vp)
|
|||
JSString *str = JS_ValueToString(cx, args[0]);
|
||||
if (!str)
|
||||
return false;
|
||||
args[0] = STRING_TO_JSVAL(str);
|
||||
args[0].setString(str);
|
||||
JSAutoByteString filename(cx, str);
|
||||
if (!filename)
|
||||
return false;
|
||||
|
@ -1380,11 +1380,11 @@ Quit(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
static const char *
|
||||
ToSource(JSContext *cx, jsval *vp, JSAutoByteString *bytes)
|
||||
ToSource(JSContext *cx, MutableHandleValue vp, JSAutoByteString *bytes)
|
||||
{
|
||||
JSString *str = JS_ValueToSource(cx, *vp);
|
||||
JSString *str = JS_ValueToSource(cx, vp);
|
||||
if (str) {
|
||||
*vp = STRING_TO_JSVAL(str);
|
||||
vp.setString(str);
|
||||
if (bytes->encodeLatin1(cx, str))
|
||||
return bytes->ptr();
|
||||
}
|
||||
|
@ -1412,8 +1412,8 @@ AssertEq(JSContext *cx, unsigned argc, jsval *vp)
|
|||
return false;
|
||||
if (!same) {
|
||||
JSAutoByteString bytes0, bytes1;
|
||||
const char *actual = ToSource(cx, &args[0], &bytes0);
|
||||
const char *expected = ToSource(cx, &args[1], &bytes1);
|
||||
const char *actual = ToSource(cx, args[0], &bytes0);
|
||||
const char *expected = ToSource(cx, args[1], &bytes1);
|
||||
if (args.length() == 2) {
|
||||
JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_ASSERT_EQ_FAILED,
|
||||
actual, expected);
|
||||
|
@ -1563,7 +1563,7 @@ Trap(JSContext *cx, unsigned argc, jsval *vp)
|
|||
RootedString str(cx, JS_ValueToString(cx, args[argc]));
|
||||
if (!str)
|
||||
return false;
|
||||
args[argc] = STRING_TO_JSVAL(str);
|
||||
args[argc].setString(str);
|
||||
if (!GetScriptAndPCArgs(cx, argc, args.array(), &script, &i))
|
||||
return false;
|
||||
if (uint32_t(i) >= script->length) {
|
||||
|
@ -2178,7 +2178,7 @@ DumpHeap(JSContext *cx, unsigned argc, jsval *vp)
|
|||
str = JS_ValueToString(cx, v);
|
||||
if (!str)
|
||||
return false;
|
||||
args[0] = STRING_TO_JSVAL(str);
|
||||
args[0].setString(str);
|
||||
if (!fileNameBytes.encodeLatin1(cx, str))
|
||||
return false;
|
||||
fileName = fileNameBytes.ptr();
|
||||
|
@ -2325,7 +2325,7 @@ Clone(JSContext *cx, unsigned argc, jsval *vp)
|
|||
if (obj && obj->is<CrossCompartmentWrapperObject>()) {
|
||||
obj = UncheckedUnwrap(obj);
|
||||
ac.construct(cx, obj);
|
||||
args[0] = ObjectValue(*obj);
|
||||
args[0].setObject(*obj);
|
||||
}
|
||||
if (obj && obj->is<JSFunction>()) {
|
||||
funobj = obj;
|
||||
|
@ -3620,7 +3620,7 @@ GetSelfHostedValue(JSContext *cx, unsigned argc, jsval *vp)
|
|||
"getSelfHostedValue");
|
||||
return false;
|
||||
}
|
||||
RootedAtom srcAtom(cx, ToAtom<CanGC>(cx, args.handleAt(0)));
|
||||
RootedAtom srcAtom(cx, ToAtom<CanGC>(cx, args[0]));
|
||||
if (!srcAtom)
|
||||
return false;
|
||||
RootedPropertyName srcName(cx, srcAtom->asPropertyName());
|
||||
|
|
|
@ -4139,10 +4139,13 @@ js::EvaluateInEnv(JSContext *cx, Handle<Env*> env, HandleValue thisv, AbstractFr
|
|||
return ExecuteKernel(cx, script, *env, thisv, type, frame, rval.address());
|
||||
}
|
||||
|
||||
enum EvalBindings { EvalHasExtraBindings = true, EvalWithDefaultBindings = false };
|
||||
|
||||
static JSBool
|
||||
DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code,
|
||||
Value *bindings, HandleValue options, MutableHandleValue vp,
|
||||
Debugger *dbg, HandleObject scope, ScriptFrameIter *iter)
|
||||
EvalBindings evalWithBindings, HandleValue bindings, HandleValue options,
|
||||
MutableHandleValue vp, Debugger *dbg, HandleObject scope,
|
||||
ScriptFrameIter *iter)
|
||||
{
|
||||
/* Either we're specifying the frame, or a global. */
|
||||
JS_ASSERT_IF(iter, !scope);
|
||||
|
@ -4165,8 +4168,8 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code
|
|||
*/
|
||||
AutoIdVector keys(cx);
|
||||
AutoValueVector values(cx);
|
||||
if (bindings) {
|
||||
RootedObject bindingsobj(cx, NonNullObject(cx, *bindings));
|
||||
if (evalWithBindings) {
|
||||
RootedObject bindingsobj(cx, NonNullObject(cx, bindings));
|
||||
if (!bindingsobj ||
|
||||
!GetPropertyNames(cx, bindingsobj, JSITER_OWNONLY, &keys) ||
|
||||
!values.growBy(keys.length()))
|
||||
|
@ -4232,7 +4235,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code
|
|||
}
|
||||
|
||||
/* If evalWithBindings, create the inner environment. */
|
||||
if (bindings) {
|
||||
if (evalWithBindings) {
|
||||
/* TODO - This should probably be a Call object, like ES5 strict eval. */
|
||||
env = NewObjectWithGivenProto(cx, &JSObject::class_, NULL, env);
|
||||
if (!env)
|
||||
|
@ -4267,8 +4270,8 @@ DebuggerFrame_eval(JSContext *cx, unsigned argc, Value *vp)
|
|||
REQUIRE_ARGC("Debugger.Frame.prototype.eval", 1);
|
||||
Debugger *dbg = Debugger::fromChildJSObject(thisobj);
|
||||
return DebuggerGenericEval(cx, "Debugger.Frame.prototype.eval",
|
||||
args[0], NULL, args.handleOrUndefinedAt(1),
|
||||
args.rval(), dbg, NullPtr(), &iter);
|
||||
args[0], EvalWithDefaultBindings, JS::UndefinedHandleValue,
|
||||
args.get(1), args.rval(), dbg, NullPtr(), &iter);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -4278,7 +4281,7 @@ DebuggerFrame_evalWithBindings(JSContext *cx, unsigned argc, Value *vp)
|
|||
REQUIRE_ARGC("Debugger.Frame.prototype.evalWithBindings", 2);
|
||||
Debugger *dbg = Debugger::fromChildJSObject(thisobj);
|
||||
return DebuggerGenericEval(cx, "Debugger.Frame.prototype.evalWithBindings",
|
||||
args[0], &args[1], args.handleOrUndefinedAt(2),
|
||||
args[0], EvalHasExtraBindings, args[1], args.get(2),
|
||||
args.rval(), dbg, NullPtr(), &iter);
|
||||
}
|
||||
|
||||
|
@ -4584,7 +4587,7 @@ DebuggerObject_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp)
|
|||
THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "getOwnPropertyDescriptor", args, dbg, obj);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args.get(0), &id))
|
||||
return false;
|
||||
|
||||
/* Bug: This can cause the debuggee to run! */
|
||||
|
@ -4674,7 +4677,7 @@ DebuggerObject_defineProperty(JSContext *cx, unsigned argc, Value *vp)
|
|||
REQUIRE_ARGC("Debugger.Object.defineProperty", 2);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, args.handleAt(0), &id))
|
||||
if (!ValueToId<CanGC>(cx, args[0], &id))
|
||||
return false;
|
||||
|
||||
const Value &descval = args[1];
|
||||
|
@ -5038,8 +5041,8 @@ DebuggerObject_evalInGlobal(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
return DebuggerGenericEval(cx, "Debugger.Object.prototype.evalInGlobal",
|
||||
args[0], NULL, args.handleOrUndefinedAt(1),
|
||||
args.rval(), dbg, referent, NULL);
|
||||
args[0], EvalWithDefaultBindings, JS::UndefinedHandleValue,
|
||||
args.get(1), args.rval(), dbg, referent, NULL);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -5051,7 +5054,7 @@ DebuggerObject_evalInGlobalWithBindings(JSContext *cx, unsigned argc, Value *vp)
|
|||
return false;
|
||||
|
||||
return DebuggerGenericEval(cx, "Debugger.Object.prototype.evalInGlobalWithBindings",
|
||||
args[0], &args[1], args.handleOrUndefinedAt(2),
|
||||
args[0], EvalHasExtraBindings, args[1], args.get(2),
|
||||
args.rval(), dbg, referent, NULL);
|
||||
}
|
||||
|
||||
|
@ -5323,7 +5326,7 @@ DebuggerEnv_find(JSContext *cx, unsigned argc, Value *vp)
|
|||
THIS_DEBUGENV_OWNER(cx, argc, vp, "find", args, envobj, env, dbg);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToIdentifier(cx, args.handleAt(0), &id))
|
||||
if (!ValueToIdentifier(cx, args[0], &id))
|
||||
return false;
|
||||
|
||||
{
|
||||
|
@ -5354,7 +5357,7 @@ DebuggerEnv_getVariable(JSContext *cx, unsigned argc, Value *vp)
|
|||
THIS_DEBUGENV_OWNER(cx, argc, vp, "getVariable", args, envobj, env, dbg);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToIdentifier(cx, args.handleAt(0), &id))
|
||||
if (!ValueToIdentifier(cx, args[0], &id))
|
||||
return false;
|
||||
|
||||
RootedValue v(cx);
|
||||
|
@ -5383,7 +5386,7 @@ DebuggerEnv_setVariable(JSContext *cx, unsigned argc, Value *vp)
|
|||
THIS_DEBUGENV_OWNER(cx, argc, vp, "setVariable", args, envobj, env, dbg);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToIdentifier(cx, args.handleAt(0), &id))
|
||||
if (!ValueToIdentifier(cx, args[0], &id))
|
||||
return false;
|
||||
|
||||
RootedValue v(cx, args[1]);
|
||||
|
|
|
@ -232,9 +232,9 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp)
|
|||
JSObject *obj = &vp[0].toObject();
|
||||
JS_ASSERT(obj->getClass() == &js_NoSuchMethodClass);
|
||||
|
||||
args.setCallee(obj->getSlot(JSSLOT_FOUND_FUNCTION));
|
||||
args.setCallee(obj->getReservedSlot(JSSLOT_FOUND_FUNCTION));
|
||||
args.setThis(vp[1]);
|
||||
args[0] = obj->getSlot(JSSLOT_SAVED_ID);
|
||||
args[0].set(obj->getReservedSlot(JSSLOT_SAVED_ID));
|
||||
JSObject *argsobj = NewDenseCopiedArray(cx, argc, vp + 2);
|
||||
if (!argsobj)
|
||||
return JS_FALSE;
|
||||
|
|
|
@ -985,7 +985,7 @@ js::SetElement(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> recei
|
|||
/* Push set, receiver, and v as the sole argument. */
|
||||
args.setCallee(setter);
|
||||
args.setThis(ObjectValue(*current));
|
||||
args[0] = v;
|
||||
args[0].set(v);
|
||||
|
||||
*succeeded = true;
|
||||
return Invoke(cx, args);
|
||||
|
|
|
@ -134,7 +134,7 @@ intrinsic_ToInteger(JSContext *cx, unsigned argc, Value *vp)
|
|||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
double result;
|
||||
if (!ToInteger(cx, args.handleAt(0), &result))
|
||||
if (!ToInteger(cx, args[0], &result))
|
||||
return false;
|
||||
args.rval().setDouble(result);
|
||||
return true;
|
||||
|
@ -192,7 +192,7 @@ intrinsic_AssertionFailed(JSContext *cx, unsigned argc, Value *vp)
|
|||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() > 0) {
|
||||
// try to dump the informative string
|
||||
JSString *str = ToString<CanGC>(cx, args.handleAt(0));
|
||||
JSString *str = ToString<CanGC>(cx, args[0]);
|
||||
if (str) {
|
||||
const jschar *chars = str->getChars(cx);
|
||||
if (chars) {
|
||||
|
@ -219,7 +219,7 @@ intrinsic_MakeConstructible(JSContext *cx, unsigned argc, Value *vp)
|
|||
// Normal .prototype properties aren't enumerable. But for this to clone
|
||||
// correctly, it must be enumerable.
|
||||
RootedObject ctor(cx, &args[0].toObject());
|
||||
if (!JSObject::defineProperty(cx, ctor, cx->names().classPrototype, args.handleAt(1),
|
||||
if (!JSObject::defineProperty(cx, ctor, cx->names().classPrototype, args[1],
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT))
|
||||
{
|
||||
|
|
|
@ -2177,9 +2177,9 @@ class TypedArrayObjectTemplate : public TypedArrayObject
|
|||
|
||||
args.setCallee(cx->compartment()->maybeGlobal()->createArrayFromBuffer<NativeType>());
|
||||
args.setThis(ObjectValue(*bufobj));
|
||||
args[0] = NumberValue(byteOffset);
|
||||
args[1] = Int32Value(lengthInt);
|
||||
args[2] = ObjectValue(*proto);
|
||||
args[0].setNumber(byteOffset);
|
||||
args[1].setInt32(lengthInt);
|
||||
args[2].setObject(*proto);
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
return NULL;
|
||||
|
@ -2869,7 +2869,7 @@ DataViewObject::class_constructor(JSContext *cx, unsigned argc, Value *vp)
|
|||
args2.setCallee(global->createDataViewForThis());
|
||||
args2.setThis(ObjectValue(*bufobj));
|
||||
PodCopy(args2.array(), args.array(), args.length());
|
||||
args2[argc] = ObjectValue(*proto);
|
||||
args2[argc].setObject(*proto);
|
||||
if (!Invoke(cx, args2))
|
||||
return false;
|
||||
args.rval().set(args2.rval());
|
||||
|
@ -3039,7 +3039,7 @@ DataViewObject::write(JSContext *cx, Handle<DataViewObject*> obj,
|
|||
return false;
|
||||
|
||||
NativeType value;
|
||||
if (!WebIDLCast(cx, args.handleAt(1), &value))
|
||||
if (!WebIDLCast(cx, args[1], &value))
|
||||
return false;
|
||||
|
||||
bool toLittleEndian = args.length() >= 3 && ToBoolean(args[2]);
|
||||
|
|
|
@ -1822,22 +1822,22 @@ struct MOZ_STACK_CLASS ExceptionArgParser
|
|||
* stack: Call stack (see argument 2).
|
||||
* data: User data (see argument 3).
|
||||
*/
|
||||
if (args.length() > 0 && !parseMessage(args.handleAt(0)))
|
||||
if (args.length() > 0 && !parseMessage(args[0]))
|
||||
return false;
|
||||
if (args.length() > 1) {
|
||||
if (args[1].isObject()) {
|
||||
RootedObject obj(cx, &args[1].toObject());
|
||||
return parseOptionsObject(obj);
|
||||
}
|
||||
if (!parseResult(args.handleAt(1)))
|
||||
if (!parseResult(args[1]))
|
||||
return false;
|
||||
}
|
||||
if (args.length() > 2) {
|
||||
if (!parseStack(args.handleAt(2)))
|
||||
if (!parseStack(args[2]))
|
||||
return false;
|
||||
}
|
||||
if (args.length() > 3) {
|
||||
if (!parseData(args.handleAt(3)))
|
||||
if (!parseData(args[3]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -2898,7 +2898,7 @@ SandboxImport(JSContext *cx, unsigned argc, Value *vp)
|
|||
XPCThrower::Throw(NS_ERROR_UNEXPECTED, cx);
|
||||
return false;
|
||||
}
|
||||
if (!JS_SetPropertyById(cx, thisObject, id, args.handleAt(0)))
|
||||
if (!JS_SetPropertyById(cx, thisObject, id, args[0]))
|
||||
return false;
|
||||
|
||||
args.rval().setUndefined();
|
||||
|
@ -3702,7 +3702,7 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative *wrappe
|
|||
SandboxOptions options(cx);
|
||||
|
||||
if (args.length() > 1 && args[1].isObject()) {
|
||||
if (NS_FAILED(ParseOptionsObject(cx, args.handleAt(1), options)))
|
||||
if (NS_FAILED(ParseOptionsObject(cx, args[1], options)))
|
||||
return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче