diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index aed46c813763..f712ef91896d 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -831,7 +831,8 @@ js_ComputeGlobalThis(JSContext *cx, JSBool lazy, jsval *argv) thisp = parent; } - OBJ_TO_OUTER_OBJECT(cx, thisp); + /* Some objects (e.g., With) delegate 'this' to another object. */ + thisp = OBJ_THIS_OBJECT(cx, thisp); if (!thisp) return NULL; argv[-1] = OBJECT_TO_JSVAL(thisp); @@ -855,18 +856,11 @@ ComputeThis(JSContext *cx, JSBool lazy, jsval *argv) return js_ComputeGlobalThis(cx, lazy, argv); } - OBJ_TO_OUTER_OBJECT(cx, thisp); + /* Some objects (e.g., With) delegate 'this' to another object. */ + thisp = OBJ_THIS_OBJECT(cx, thisp); if (!thisp) return NULL; argv[-1] = OBJECT_TO_JSVAL(thisp); - - if (thisp->map->ops->thisObject) { - /* Some objects (e.g., With) delegate 'this' to another object. */ - thisp = thisp->map->ops->thisObject(cx, thisp); - if (!thisp) - return NULL; - argv[-1] = OBJECT_TO_JSVAL(thisp); - } } return thisp; } @@ -1551,7 +1545,7 @@ js_Execute(JSContext *cx, JSObject *chain, JSScript *script, cx->fp = &frame; if (!down) { - OBJ_TO_OUTER_OBJECT(cx, frame.thisp); + frame.thisp = OBJ_THIS_OBJECT(cx, frame.thisp); if (!frame.thisp) { ok = JS_FALSE; goto out2; diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 93855738147b..9e586328c7a6 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -169,7 +169,6 @@ obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp) uintN attrs; JSObject *pobj; JSClass *clasp; - JSExtendedClass *xclasp; slot = (uint32) JSVAL_TO_INT(id); if (id == INT_TO_JSVAL(JSSLOT_PROTO)) { @@ -190,14 +189,11 @@ obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp) if (clasp == &js_CallClass || clasp == &js_BlockClass) { /* Censor activations and lexical scopes per ECMA-262. */ *vp = JSVAL_NULL; - } else if (clasp->flags & JSCLASS_IS_EXTENDED) { - xclasp = (JSExtendedClass *) clasp; - if (xclasp->outerObject) { - pobj = xclasp->outerObject(cx, pobj); - if (!pobj) - return JS_FALSE; - *vp = OBJECT_TO_JSVAL(pobj); - } + } else if (pobj->map->ops->thisObject) { + pobj = pobj->map->ops->thisObject(cx, pobj); + if (!pobj) + return JS_FALSE; + *vp = OBJECT_TO_JSVAL(pobj); } } return JS_TRUE; diff --git a/js/src/xpconnect/src/xpcwrappednativejsops.cpp b/js/src/xpconnect/src/xpcwrappednativejsops.cpp index 8ff110098713..4d3619f1853b 100644 --- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp +++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp @@ -1320,6 +1320,10 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JSObject *obj) if(!XPCPerThreadData::IsMainThread(cx)) return obj; + OBJ_TO_OUTER_OBJECT(cx, obj); + if(!obj) + return nsnull; + JSObject *scope = JS_GetScopeChain(cx); if(!scope) {