Bug 1259877 - Rename Invoke[GS]etter to Call[GS]etter, more in line with the spec's calling nomenclature. r=jorendorff

--HG--
extra : rebase_source : 4a810f7b6b6fc6a9849b827b8a593251e02cc915
This commit is contained in:
Jeff Walden 2016-03-10 21:46:10 -08:00
Родитель 7e3a50ba41
Коммит 3ef9bb2477
4 изменённых файлов: 17 добавлений и 16 удалений

Просмотреть файл

@ -139,7 +139,8 @@ BaseProxyHandler::get(JSContext* cx, HandleObject proxy, HandleValue receiver,
} }
// Step 7. // Step 7.
return InvokeGetter(cx, receiver, ObjectValue(*getter), vp); RootedValue getterFunc(cx, ObjectValue(*getter));
return CallGetter(cx, receiver, getterFunc, vp);
} }
bool bool
@ -241,7 +242,7 @@ js::SetPropertyIgnoringNamedGetter(JSContext* cx, HandleObject obj, HandleId id,
if (!setter) if (!setter)
return result.fail(JSMSG_GETTER_ONLY); return result.fail(JSMSG_GETTER_ONLY);
RootedValue setterValue(cx, ObjectValue(*setter)); RootedValue setterValue(cx, ObjectValue(*setter));
if (!InvokeSetter(cx, receiver, setterValue, v)) if (!CallSetter(cx, receiver, setterValue, v))
return false; return false;
return result.succeed(); return result.succeed();
} }

Просмотреть файл

@ -629,24 +629,22 @@ js::InternalConstructWithProvidedThis(JSContext* cx, HandleValue fval, HandleVal
} }
bool bool
js::InvokeGetter(JSContext* cx, const Value& thisv, Value fval, MutableHandleValue rval) js::CallGetter(JSContext* cx, HandleValue thisv, HandleValue getter, MutableHandleValue rval)
{ {
/* // Invoke could result in another try to get or set the same id again, see
* Invoke could result in another try to get or set the same id again, see // bug 355497.
* bug 355497.
*/
JS_CHECK_RECURSION(cx, return false); JS_CHECK_RECURSION(cx, return false);
return Invoke(cx, thisv, fval, 0, nullptr, rval); return Invoke(cx, thisv, getter, 0, nullptr, rval);
} }
bool bool
js::InvokeSetter(JSContext* cx, const Value& thisv, Value fval, HandleValue v) js::CallSetter(JSContext* cx, HandleValue thisv, HandleValue setter, HandleValue v)
{ {
JS_CHECK_RECURSION(cx, return false); JS_CHECK_RECURSION(cx, return false);
RootedValue ignored(cx); RootedValue ignored(cx);
return Invoke(cx, thisv, fval, 1, v.address(), &ignored); return Invoke(cx, thisv, setter, 1, v.address(), &ignored);
} }
bool bool

Просмотреть файл

@ -74,10 +74,10 @@ Invoke(JSContext* cx, const Value& thisv, const Value& fval, unsigned argc, cons
* getter/setter calls. * getter/setter calls.
*/ */
extern bool extern bool
InvokeGetter(JSContext* cx, const Value& thisv, Value fval, MutableHandleValue rval); CallGetter(JSContext* cx, HandleValue thisv, HandleValue getter, MutableHandleValue rval);
extern bool extern bool
InvokeSetter(JSContext* cx, const Value& thisv, Value fval, HandleValue v); CallSetter(JSContext* cx, HandleValue thisv, HandleValue setter, HandleValue rval);
// ES6 7.3.13 Construct(F, argumentsList, newTarget). All parameters are // ES6 7.3.13 Construct(F, argumentsList, newTarget). All parameters are
// required, hopefully forcing callers to be careful not to (say) blindly pass // required, hopefully forcing callers to be careful not to (say) blindly pass

Просмотреть файл

@ -1731,8 +1731,8 @@ CallGetter(JSContext* cx, HandleObject obj, HandleValue receiver, HandleShape sh
MOZ_ASSERT(!shape->hasDefaultGetter()); MOZ_ASSERT(!shape->hasDefaultGetter());
if (shape->hasGetterValue()) { if (shape->hasGetterValue()) {
Value fval = shape->getterValue(); RootedValue getter(cx, shape->getterValue());
return InvokeGetter(cx, receiver, fval, vp); return js::CallGetter(cx, receiver, getter, vp);
} }
// In contrast to normal getters JSGetterOps always want the holder. // In contrast to normal getters JSGetterOps always want the holder.
@ -2348,9 +2348,11 @@ SetExistingProperty(JSContext* cx, HandleNativeObject obj, HandleId id, HandleVa
MOZ_ASSERT_IF(!shape->hasSetterObject(), shape->hasDefaultSetter()); MOZ_ASSERT_IF(!shape->hasSetterObject(), shape->hasDefaultSetter());
if (shape->hasDefaultSetter()) if (shape->hasDefaultSetter())
return result.fail(JSMSG_GETTER_ONLY); return result.fail(JSMSG_GETTER_ONLY);
Value setter = ObjectValue(*shape->setterObject());
if (!InvokeSetter(cx, receiver, setter, v)) RootedValue setter(cx, ObjectValue(*shape->setterObject()));
if (!js::CallSetter(cx, receiver, setter, v))
return false; return false;
return result.succeed(); return result.succeed();
} }