Bug 916949 - Change __noSuchMethod__ so that it only gets invoked on undefined bindings. r=jorendorff

This commit is contained in:
Kannan Vijayan 2013-10-21 12:03:39 -04:00
parent a9d5d30b02
commit faaab77a79
4 changed files with 5 additions and 5 deletions

View File

@ -6015,7 +6015,7 @@ DoGetPropFallback(JSContext *cx, BaselineFrame *frame, ICGetProp_Fallback *stub,
#if JS_HAS_NO_SUCH_METHOD
// Handle objects with __noSuchMethod__.
if (op == JSOP_CALLPROP && JS_UNLIKELY(res.isPrimitive()) && val.isObject()) {
if (op == JSOP_CALLPROP && JS_UNLIKELY(res.isUndefined()) && val.isObject()) {
if (!OnUnknownMethod(cx, obj, IdToValue(id), res))
return false;
}

View File

@ -1781,7 +1781,7 @@ GetPropertyIC::update(JSContext *cx, size_t cacheIndex,
#if JS_HAS_NO_SUCH_METHOD
// Handle objects with __noSuchMethod__.
if (JSOp(*pc) == JSOP_CALLPROP && JS_UNLIKELY(vp.isPrimitive())) {
if (JSOp(*pc) == JSOP_CALLPROP && JS_UNLIKELY(vp.isUndefined())) {
if (!OnUnknownMethod(cx, obj, IdToValue(id), vp))
return false;
}

View File

@ -391,7 +391,7 @@ GetObjectElementOperation(JSContext *cx, JSOp op, JSObject *objArg, bool wasObje
} while (0);
#if JS_HAS_NO_SUCH_METHOD
if (op == JSOP_CALLELEM && JS_UNLIKELY(res.isPrimitive()) && wasObject) {
if (op == JSOP_CALLELEM && JS_UNLIKELY(res.isUndefined()) && wasObject) {
RootedObject obj(cx, objArg);
if (!OnUnknownMethod(cx, obj, rref, res))
return false;

View File

@ -266,7 +266,7 @@ GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytec
#if JS_HAS_NO_SUCH_METHOD
if (op == JSOP_CALLPROP &&
JS_UNLIKELY(vp.isPrimitive()) &&
JS_UNLIKELY(vp.isUndefined()) &&
wasObject)
{
if (!OnUnknownMethod(cx, obj, IdToValue(id), vp))
@ -3453,7 +3453,7 @@ js::CallProperty(JSContext *cx, HandleValue v, HandlePropertyName name, MutableH
return false;
#if JS_HAS_NO_SUCH_METHOD
if (JS_UNLIKELY(vp.isPrimitive()) && v.isObject())
if (JS_UNLIKELY(vp.isUndefined()) && v.isObject())
{
RootedObject obj(cx, &v.toObject());
if (!OnUnknownMethod(cx, obj, StringValue(name), vp))