mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 10:45:42 +00:00
Bug 479288 - Move wrapping back into the outerObject hook. r+sr=bent/jst
This commit is contained in:
parent
b5e168d82d
commit
35f1f17ffc
@ -831,7 +831,8 @@ js_ComputeGlobalThis(JSContext *cx, JSBool lazy, jsval *argv)
|
|||||||
thisp = parent;
|
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)
|
if (!thisp)
|
||||||
return NULL;
|
return NULL;
|
||||||
argv[-1] = OBJECT_TO_JSVAL(thisp);
|
argv[-1] = OBJECT_TO_JSVAL(thisp);
|
||||||
@ -855,18 +856,11 @@ ComputeThis(JSContext *cx, JSBool lazy, jsval *argv)
|
|||||||
return js_ComputeGlobalThis(cx, lazy, 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)
|
if (!thisp)
|
||||||
return NULL;
|
return NULL;
|
||||||
argv[-1] = OBJECT_TO_JSVAL(thisp);
|
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;
|
return thisp;
|
||||||
}
|
}
|
||||||
@ -1551,7 +1545,7 @@ js_Execute(JSContext *cx, JSObject *chain, JSScript *script,
|
|||||||
|
|
||||||
cx->fp = &frame;
|
cx->fp = &frame;
|
||||||
if (!down) {
|
if (!down) {
|
||||||
OBJ_TO_OUTER_OBJECT(cx, frame.thisp);
|
frame.thisp = OBJ_THIS_OBJECT(cx, frame.thisp);
|
||||||
if (!frame.thisp) {
|
if (!frame.thisp) {
|
||||||
ok = JS_FALSE;
|
ok = JS_FALSE;
|
||||||
goto out2;
|
goto out2;
|
||||||
|
@ -169,7 +169,6 @@ obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
uintN attrs;
|
uintN attrs;
|
||||||
JSObject *pobj;
|
JSObject *pobj;
|
||||||
JSClass *clasp;
|
JSClass *clasp;
|
||||||
JSExtendedClass *xclasp;
|
|
||||||
|
|
||||||
slot = (uint32) JSVAL_TO_INT(id);
|
slot = (uint32) JSVAL_TO_INT(id);
|
||||||
if (id == INT_TO_JSVAL(JSSLOT_PROTO)) {
|
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) {
|
if (clasp == &js_CallClass || clasp == &js_BlockClass) {
|
||||||
/* Censor activations and lexical scopes per ECMA-262. */
|
/* Censor activations and lexical scopes per ECMA-262. */
|
||||||
*vp = JSVAL_NULL;
|
*vp = JSVAL_NULL;
|
||||||
} else if (clasp->flags & JSCLASS_IS_EXTENDED) {
|
} else if (pobj->map->ops->thisObject) {
|
||||||
xclasp = (JSExtendedClass *) clasp;
|
pobj = pobj->map->ops->thisObject(cx, pobj);
|
||||||
if (xclasp->outerObject) {
|
if (!pobj)
|
||||||
pobj = xclasp->outerObject(cx, pobj);
|
return JS_FALSE;
|
||||||
if (!pobj)
|
*vp = OBJECT_TO_JSVAL(pobj);
|
||||||
return JS_FALSE;
|
|
||||||
*vp = OBJECT_TO_JSVAL(pobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
@ -1320,6 +1320,10 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JSObject *obj)
|
|||||||
if(!XPCPerThreadData::IsMainThread(cx))
|
if(!XPCPerThreadData::IsMainThread(cx))
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
|
OBJ_TO_OUTER_OBJECT(cx, obj);
|
||||||
|
if(!obj)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
JSObject *scope = JS_GetScopeChain(cx);
|
JSObject *scope = JS_GetScopeChain(cx);
|
||||||
if(!scope)
|
if(!scope)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user