mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout b97cdd8008a0, bc305a9ac000, and 03549c72043d due to Android browser-chrome orange.
This commit is contained in:
parent
6909634954
commit
a0705f936c
@ -4919,7 +4919,11 @@ nsDOMClassInfo::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
{
|
||||
PRUint32 mode_type = mode & JSACC_TYPEMASK;
|
||||
|
||||
if ((mode_type == JSACC_WATCH || mode_type == JSACC_PROTO) && sSecMan) {
|
||||
if ((mode_type == JSACC_WATCH ||
|
||||
mode_type == JSACC_PROTO ||
|
||||
mode_type == JSACC_PARENT) &&
|
||||
sSecMan) {
|
||||
|
||||
nsresult rv;
|
||||
JSObject *real_obj;
|
||||
if (wrapper) {
|
||||
@ -5374,10 +5378,11 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, unsigned flags,
|
||||
JSObject **objp)
|
||||
{
|
||||
if (flags & (JSRESOLVE_ASSIGNING | JSRESOLVE_QUALIFIED) ||
|
||||
if (flags & (JSRESOLVE_ASSIGNING | JSRESOLVE_DECLARING |
|
||||
JSRESOLVE_QUALIFIED) ||
|
||||
!JSID_IS_STRING(id)) {
|
||||
// Nothing to do here if we're assigning, doing a qualified resolve, or
|
||||
// resolving a non-string property.
|
||||
// Nothing to do here if we're either assigning or declaring,
|
||||
// doing a qualified resolve, or resolving a number.
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, unsign
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
// Don't care about assignments, bail now.
|
||||
if (aFlags & JSRESOLVE_ASSIGNING) {
|
||||
// Don't care about assignments or declarations, bail now.
|
||||
if (aFlags & (JSRESOLVE_ASSIGNING | JSRESOLVE_DECLARING)) {
|
||||
*aObjp = nsnull;
|
||||
return true;
|
||||
}
|
||||
|
@ -3710,7 +3710,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
|
||||
? JS_FUNC_TO_DATA_PTR(JSObject *, setter)
|
||||
: NULL);
|
||||
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_DECLARING);
|
||||
if (flags != 0 && obj->isNative()) {
|
||||
return !!DefineNativeProperty(cx, obj, id, value, getter, setter,
|
||||
attrs, flags, tinyid);
|
||||
@ -4161,28 +4161,25 @@ JS_GetMethod(JSContext *cx, JSObject *obj, const char *name, JSObject **objp, js
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid id_, jsval *vp)
|
||||
JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id_, jsval *vp)
|
||||
{
|
||||
RootedId id(cx, id_);
|
||||
Rooted<JSObject*> obj(cx, objArg);
|
||||
|
||||
AssertNoGC(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
|
||||
return obj->setGeneric(cx, obj, id, vp, false);
|
||||
return obj->setGeneric(cx, id, vp, false);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj_, uint32_t index, jsval *vp)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, uint32_t index, jsval *vp)
|
||||
{
|
||||
RootedObject obj(cx, obj_);
|
||||
|
||||
AssertNoGC(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, *vp);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
|
||||
return obj->setElement(cx, obj, index, vp, false);
|
||||
return obj->setElement(cx, index, vp, false);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -1404,6 +1404,7 @@ typedef JSBool
|
||||
* JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id
|
||||
* JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment
|
||||
* JSRESOLVE_DETECTING 'if (o.p)...' or similar detection opcode sequence
|
||||
* JSRESOLVE_DECLARING var, const, or function prolog declaration opcode
|
||||
*
|
||||
* The *objp out parameter, on success, should be null to indicate that id
|
||||
* was not resolved; and non-null, referring to obj or one of its prototypes,
|
||||
@ -3798,6 +3799,7 @@ JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
|
||||
#define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */
|
||||
#define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */
|
||||
#define JSRESOLVE_DETECTING 0x04 /* 'if (o.p)...' or '(o.p) ?...:...' */
|
||||
#define JSRESOLVE_DECLARING 0x08 /* var, const, or function prolog op */
|
||||
|
||||
/*
|
||||
* Invoke the [[DefaultValue]] hook (see ES5 8.6.2) with the provided hint on
|
||||
|
@ -486,7 +486,7 @@ SetArrayElement(JSContext *cx, HandleObject obj, double index, const Value &v)
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
|
||||
RootedValue tmp(cx, v);
|
||||
return obj->setGeneric(cx, obj, id, tmp.address(), true);
|
||||
return obj->setGeneric(cx, id, tmp.address(), true);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -549,13 +549,12 @@ SetOrDeleteArrayElement(JSContext *cx, HandleObject obj, double index,
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_SetLengthProperty(JSContext *cx, JSObject *objArg, double length)
|
||||
js_SetLengthProperty(JSContext *cx, JSObject *obj, double length)
|
||||
{
|
||||
Value v = NumberValue(length);
|
||||
|
||||
/* We don't support read-only array length yet. */
|
||||
Rooted<JSObject*> obj(cx, objArg);
|
||||
return obj->setProperty(cx, obj, cx->runtime->atomState.lengthAtom, &v, false);
|
||||
return obj->setProperty(cx, cx->runtime->atomState.lengthAtom, &v, false);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -875,7 +874,7 @@ array_setGeneric(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool
|
||||
return array_length_setter(cx, obj, id, strict, vp);
|
||||
|
||||
if (!obj->isDenseArray())
|
||||
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, obj, id, 0, vp, strict);
|
||||
|
||||
do {
|
||||
uint32_t i;
|
||||
@ -900,7 +899,7 @@ array_setGeneric(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool
|
||||
|
||||
if (!JSObject::makeDenseArraySlow(cx, obj))
|
||||
return false;
|
||||
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, obj, id, 0, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -918,7 +917,7 @@ array_setElement(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSB
|
||||
return false;
|
||||
|
||||
if (!obj->isDenseArray())
|
||||
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, obj, id, 0, vp, strict);
|
||||
|
||||
do {
|
||||
/*
|
||||
@ -946,7 +945,7 @@ array_setElement(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSB
|
||||
|
||||
if (!JSObject::makeDenseArraySlow(cx, obj))
|
||||
return false;
|
||||
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, obj, id, 0, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -1799,7 +1798,7 @@ InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t coun
|
||||
do {
|
||||
value = *vector++;
|
||||
if (!ValueToId(cx, idval, id.address()) ||
|
||||
!obj->setGeneric(cx, obj, id, value.address(), true)) {
|
||||
!obj->setGeneric(cx, id, value.address(), true)) {
|
||||
return false;
|
||||
}
|
||||
idval.getDoubleRef() += 1;
|
||||
|
@ -2415,7 +2415,7 @@ BEGIN_CASE(JSOP_ENUMELEM)
|
||||
RootedId &id = rootId0;
|
||||
FETCH_ELEMENT_ID(obj, -1, id);
|
||||
rval = regs.sp[-3];
|
||||
if (!obj->setGeneric(cx, obj, id, rval.address(), script->strictModeCode))
|
||||
if (!obj->setGeneric(cx, id, rval.address(), script->strictModeCode))
|
||||
goto error;
|
||||
regs.sp -= 3;
|
||||
}
|
||||
@ -2965,7 +2965,7 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
*/
|
||||
|
||||
/* Step 5f. */
|
||||
if (!parent->setProperty(cx, parent, name, rval.address(), script->strictModeCode))
|
||||
if (!parent->setProperty(cx, name, rval.address(), script->strictModeCode))
|
||||
goto error;
|
||||
} while (false);
|
||||
}
|
||||
@ -3172,7 +3172,7 @@ BEGIN_CASE(JSOP_INITPROP)
|
||||
id = NameToId(name);
|
||||
|
||||
if (JS_UNLIKELY(name == cx->runtime->atomState.protoAtom)
|
||||
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strictModeCode)
|
||||
? !baseops::SetPropertyHelper(cx, obj, id, 0, &rval, script->strictModeCode)
|
||||
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
||||
JSPROP_ENUMERATE, 0, 0, 0)) {
|
||||
goto error;
|
||||
@ -3491,11 +3491,11 @@ BEGIN_CASE(JSOP_SETXMLNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strictModeCode);
|
||||
|
||||
Rooted<JSObject*> obj(cx, ®s.sp[-3].toObject());
|
||||
JSObject *obj = ®s.sp[-3].toObject();
|
||||
Value rval = regs.sp[-1];
|
||||
RootedId &id = rootId0;
|
||||
FETCH_ELEMENT_ID(obj, -2, id);
|
||||
if (!obj->setGeneric(cx, obj, id, &rval, script->strictModeCode))
|
||||
if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
|
||||
goto error;
|
||||
rval = regs.sp[-1];
|
||||
regs.sp -= 2;
|
||||
|
@ -328,7 +328,7 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, const Val
|
||||
} else {
|
||||
RootedValue rref(cx, rval);
|
||||
bool strict = cx->stack.currentScript()->strictModeCode;
|
||||
if (!js_NativeSet(cx, obj, obj, shape, false, strict, rref.address()))
|
||||
if (!js_NativeSet(cx, obj, shape, false, strict, rref.address()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -347,10 +347,10 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, const Val
|
||||
unsigned defineHow = (op == JSOP_SETNAME)
|
||||
? DNP_CACHE_RESULT | DNP_UNQUALIFIED
|
||||
: DNP_CACHE_RESULT;
|
||||
if (!baseops::SetPropertyHelper(cx, obj, obj, id, defineHow, rref.address(), strict))
|
||||
if (!baseops::SetPropertyHelper(cx, obj, id, defineHow, rref.address(), strict))
|
||||
return false;
|
||||
} else {
|
||||
if (!obj->setGeneric(cx, obj, id, rref.address(), strict))
|
||||
if (!obj->setGeneric(cx, id, rref.address(), strict))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -743,7 +743,7 @@ GetElementOperation(JSContext *cx, JSOp op, Value &lref, const Value &rref, Valu
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, const Value &value, bool strict)
|
||||
SetObjectElementOperation(JSContext *cx, JSObject *obj, HandleId id, const Value &value, bool strict)
|
||||
{
|
||||
types::TypeScript::MonitorAssign(cx, obj, id);
|
||||
|
||||
@ -772,7 +772,7 @@ SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, con
|
||||
} while (0);
|
||||
|
||||
RootedValue tmp(cx, value);
|
||||
return obj->setGeneric(cx, obj, id, tmp.address(), strict);
|
||||
return obj->setGeneric(cx, id, tmp.address(), strict);
|
||||
}
|
||||
|
||||
#define RELATIONAL_OP(OP) \
|
||||
|
@ -3146,6 +3146,8 @@ js_InferFlags(JSContext *cx, unsigned defaultFlags)
|
||||
if (pc < script->code + script->length && Detecting(cx, pc))
|
||||
flags |= JSRESOLVE_DETECTING;
|
||||
}
|
||||
if (format & JOF_DECLARING)
|
||||
flags |= JSRESOLVE_DECLARING;
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -5025,8 +5027,8 @@ js_NativeGet(JSContext *cx, Handle<JSObject*> obj, Handle<JSObject*> pobj, const
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_NativeSet(JSContext *cx, Handle<JSObject*> obj, Handle<JSObject*> receiver,
|
||||
const Shape *shape, bool added, bool strict, Value *vp)
|
||||
js_NativeSet(JSContext *cx, Handle<JSObject*> obj, const Shape *shape, bool added, bool strict,
|
||||
Value *vp)
|
||||
{
|
||||
AddTypePropertyId(cx, obj, shape->propid(), *vp);
|
||||
|
||||
@ -5054,7 +5056,7 @@ js_NativeSet(JSContext *cx, Handle<JSObject*> obj, Handle<JSObject*> receiver,
|
||||
Rooted<const Shape *> shapeRoot(cx, shape);
|
||||
|
||||
int32_t sample = cx->runtime->propertyRemovals;
|
||||
if (!shapeRoot->set(cx, obj, receiver, strict, vp))
|
||||
if (!shapeRoot->set(cx, obj, strict, vp))
|
||||
return false;
|
||||
|
||||
/*
|
||||
@ -5278,8 +5280,8 @@ JSObject::callMethod(JSContext *cx, HandleId id, unsigned argc, Value *argv, Val
|
||||
}
|
||||
|
||||
JSBool
|
||||
baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
|
||||
unsigned defineHow, Value *vp, JSBool strict)
|
||||
baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleId id, unsigned defineHow,
|
||||
Value *vp, JSBool strict)
|
||||
{
|
||||
JSObject *pobj;
|
||||
JSProperty *prop;
|
||||
@ -5310,8 +5312,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
|
||||
if ((pd.attrs & (JSPROP_SHARED | JSPROP_SHADOWABLE)) == JSPROP_SHARED) {
|
||||
return !pd.setter ||
|
||||
CallSetter(cx, receiver, id, pd.setter, pd.attrs, pd.shortid, strict,
|
||||
vp);
|
||||
CallSetter(cx, obj, id, pd.setter, pd.attrs, pd.shortid, strict, vp);
|
||||
}
|
||||
|
||||
if (pd.attrs & JSPROP_READONLY) {
|
||||
@ -5379,7 +5380,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
if (shape->hasDefaultSetter() && !shape->hasGetterValue())
|
||||
return JS_TRUE;
|
||||
|
||||
return shape->set(cx, obj, receiver, strict, vp);
|
||||
return shape->set(cx, obj, strict, vp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5460,17 +5461,17 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
if ((defineHow & DNP_CACHE_RESULT) && !added)
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, obj, 0, obj, shape);
|
||||
|
||||
return js_NativeSet(cx, obj, receiver, shape, added, strict, vp);
|
||||
return js_NativeSet(cx, obj, shape, added, strict, vp);
|
||||
}
|
||||
|
||||
JSBool
|
||||
baseops::SetElementHelper(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
|
||||
unsigned defineHow, Value *vp, JSBool strict)
|
||||
baseops::SetElementHelper(JSContext *cx, HandleObject obj, uint32_t index, unsigned defineHow,
|
||||
Value *vp, JSBool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
return false;
|
||||
return baseops::SetPropertyHelper(cx, obj, receiver, id, defineHow, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, obj, id, defineHow, vp, strict);
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -5767,6 +5768,13 @@ CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
|
||||
*attrsp = JSPROP_PERMANENT;
|
||||
break;
|
||||
|
||||
case JSACC_PARENT:
|
||||
JS_ASSERT(!writing);
|
||||
pobj = obj;
|
||||
vp->setObject(*obj->getParent());
|
||||
*attrsp = JSPROP_READONLY | JSPROP_PERMANENT;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!obj->lookupGeneric(cx, id, pobj.address(), &prop))
|
||||
return JS_FALSE;
|
||||
|
@ -151,20 +151,20 @@ extern JSBool
|
||||
GetPropertyDefault(JSContext *cx, HandleObject obj, HandleId id, const Value &def, Value *vp);
|
||||
|
||||
extern JSBool
|
||||
SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
|
||||
unsigned defineHow, Value *vp, JSBool strict);
|
||||
SetPropertyHelper(JSContext *cx, HandleObject obj, HandleId id, unsigned defineHow,
|
||||
Value *vp, JSBool strict);
|
||||
|
||||
inline bool
|
||||
SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receiver, PropertyName *name,
|
||||
unsigned defineHow, Value *vp, JSBool strict)
|
||||
SetPropertyHelper(JSContext *cx, HandleObject obj, PropertyName *name, unsigned defineHow,
|
||||
Value *vp, JSBool strict)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return SetPropertyHelper(cx, obj, receiver, id, defineHow, vp, strict);
|
||||
return SetPropertyHelper(cx, obj, id, defineHow, vp, strict);
|
||||
}
|
||||
|
||||
extern JSBool
|
||||
SetElementHelper(JSContext *cx, HandleObject obj, HandleObject Receiver, uint32_t index,
|
||||
unsigned defineHow, Value *vp, JSBool strict);
|
||||
SetElementHelper(JSContext *cx, HandleObject obj, uint32_t index, unsigned defineHow,
|
||||
Value *vp, JSBool strict);
|
||||
|
||||
extern JSType
|
||||
TypeOf(JSContext *cx, HandleObject obj);
|
||||
@ -825,14 +825,10 @@ struct JSObject : public js::ObjectImpl
|
||||
inline JSBool getElement(JSContext *cx, uint32_t index, js::Value *vp);
|
||||
inline JSBool getSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp);
|
||||
|
||||
inline JSBool setGeneric(JSContext *cx, js::Handle<JSObject*> receiver, js::HandleId id,
|
||||
js::Value *vp, JSBool strict);
|
||||
inline JSBool setProperty(JSContext *cx, js::Handle<JSObject*> receiver,
|
||||
js::PropertyName *name, js::Value *vp, JSBool strict);
|
||||
inline JSBool setElement(JSContext *cx, js::Handle<JSObject*> receiver, uint32_t index,
|
||||
js::Value *vp, JSBool strict);
|
||||
inline JSBool setSpecial(JSContext *cx, js::Handle<JSObject*> receiver, js::SpecialId sid,
|
||||
js::Value *vp, JSBool strict);
|
||||
inline JSBool setGeneric(JSContext *cx, js::HandleId id, js::Value *vp, JSBool strict);
|
||||
inline JSBool setProperty(JSContext *cx, js::PropertyName *name, js::Value *vp, JSBool strict);
|
||||
inline JSBool setElement(JSContext *cx, uint32_t index, js::Value *vp, JSBool strict);
|
||||
inline JSBool setSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp, JSBool strict);
|
||||
|
||||
JSBool nonNativeSetProperty(JSContext *cx, js::HandleId id, js::Value *vp, JSBool strict);
|
||||
JSBool nonNativeSetElement(JSContext *cx, uint32_t index, js::Value *vp, JSBool strict);
|
||||
@ -1240,8 +1236,8 @@ js_NativeGet(JSContext *cx, js::Handle<JSObject*> obj, js::Handle<JSObject*> pob
|
||||
const js::Shape *shape, unsigned getHow, js::Value *vp);
|
||||
|
||||
extern JSBool
|
||||
js_NativeSet(JSContext *cx, js::Handle<JSObject*> obj, js::Handle<JSObject*> receiver,
|
||||
const js::Shape *shape, bool added, bool strict, js::Value *vp);
|
||||
js_NativeSet(JSContext *cx, js::Handle<JSObject*> obj, const js::Shape *shape, bool added,
|
||||
bool strict, js::Value *vp);
|
||||
|
||||
namespace js {
|
||||
|
||||
|
@ -91,39 +91,35 @@ JSObject::thisObject(JSContext *cx)
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::setGeneric(JSContext *cx, js::Handle<JSObject*> receiver, js::HandleId id, js::Value *vp,
|
||||
JSBool strict)
|
||||
JSObject::setGeneric(JSContext *cx, js::HandleId id, js::Value *vp, JSBool strict)
|
||||
{
|
||||
if (getOps()->setGeneric)
|
||||
return nonNativeSetProperty(cx, id, vp, strict);
|
||||
js::Rooted<JSObject*> obj(cx, this);
|
||||
return js::baseops::SetPropertyHelper(cx, obj, receiver, id, 0, vp, strict);
|
||||
return js::baseops::SetPropertyHelper(cx, obj, id, 0, vp, strict);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::setProperty(JSContext *cx, js::Handle<JSObject*> receiver, js::PropertyName *name,
|
||||
js::Value *vp, JSBool strict)
|
||||
JSObject::setProperty(JSContext *cx, js::PropertyName *name, js::Value *vp, JSBool strict)
|
||||
{
|
||||
js::Rooted<jsid> id(cx, js::NameToId(name));
|
||||
return setGeneric(cx, receiver, id, vp, strict);
|
||||
return setGeneric(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::setElement(JSContext *cx, js::Handle<JSObject*> receiver, uint32_t index, js::Value *vp,
|
||||
JSBool strict)
|
||||
JSObject::setElement(JSContext *cx, uint32_t index, js::Value *vp, JSBool strict)
|
||||
{
|
||||
if (getOps()->setElement)
|
||||
return nonNativeSetElement(cx, index, vp, strict);
|
||||
js::Rooted<JSObject*> obj(cx, this);
|
||||
return js::baseops::SetElementHelper(cx, obj, receiver, index, 0, vp, strict);
|
||||
return js::baseops::SetElementHelper(cx, obj, index, 0, vp, strict);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::setSpecial(JSContext *cx, js::HandleObject receiver, js::SpecialId sid, js::Value *vp,
|
||||
JSBool strict)
|
||||
JSObject::setSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp, JSBool strict)
|
||||
{
|
||||
js::Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return setGeneric(cx, receiver, id, vp, strict);
|
||||
return setGeneric(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
|
@ -79,7 +79,7 @@ typedef enum JSOp {
|
||||
#define JOF_DETECTING (1U<<14) /* object detection for JSNewResolveOp */
|
||||
#define JOF_BACKPATCH (1U<<15) /* backpatch placeholder during codegen */
|
||||
#define JOF_LEFTASSOC (1U<<16) /* left-associative operator */
|
||||
/* (1U<<17) is unused */
|
||||
#define JOF_DECLARING (1U<<17) /* var, const, or function declaration op */
|
||||
/* (1U<<18) is unused */
|
||||
#define JOF_PARENHEAD (1U<<20) /* opcode consumes value of expression in
|
||||
parenthesized statement head */
|
||||
|
@ -305,9 +305,9 @@ OPDEF(JSOP_SETTER, 126,js_setter_str,NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
/*
|
||||
* Prolog bytecodes for defining function, var, and const names.
|
||||
*/
|
||||
OPDEF(JSOP_DEFFUN, 127,"deffun", NULL, 5, 0, 0, 0, JOF_OBJECT)
|
||||
OPDEF(JSOP_DEFCONST, 128,"defconst", NULL, 5, 0, 0, 0, JOF_ATOM)
|
||||
OPDEF(JSOP_DEFVAR, 129,"defvar", NULL, 5, 0, 0, 0, JOF_ATOM)
|
||||
OPDEF(JSOP_DEFFUN, 127,"deffun", NULL, 5, 0, 0, 0, JOF_OBJECT|JOF_DECLARING)
|
||||
OPDEF(JSOP_DEFCONST, 128,"defconst", NULL, 5, 0, 0, 0, JOF_ATOM|JOF_DECLARING)
|
||||
OPDEF(JSOP_DEFVAR, 129,"defvar", NULL, 5, 0, 0, 0, JOF_ATOM|JOF_DECLARING)
|
||||
|
||||
/* Push a closure for a named or anonymous function expression. */
|
||||
OPDEF(JSOP_LAMBDA, 130, "lambda", NULL, 5, 0, 1, 19, JOF_OBJECT)
|
||||
|
@ -569,12 +569,11 @@ DirectProxyHandler::get(JSContext *cx, JSObject *proxy, JSObject *receiver_,
|
||||
}
|
||||
|
||||
bool
|
||||
DirectProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiverArg,
|
||||
DirectProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver,
|
||||
jsid id_, bool strict, Value *vp)
|
||||
{
|
||||
RootedId id(cx, id_);
|
||||
Rooted<JSObject*> receiver(cx, receiverArg);
|
||||
return GetProxyTargetObject(proxy)->setGeneric(cx, receiver, id, vp, strict);
|
||||
return GetProxyTargetObject(proxy)->setGeneric(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -115,11 +115,7 @@ typedef enum JSProtoKey {
|
||||
/* js_CheckAccess mode enumeration. */
|
||||
typedef enum JSAccessMode {
|
||||
JSACC_PROTO = 0, /* XXXbe redundant w.r.t. id */
|
||||
|
||||
/*
|
||||
* enum value #1 formerly called JSACC_PARENT,
|
||||
* gap preserved for ABI compatibility.
|
||||
*/
|
||||
JSACC_PARENT = 1, /* XXXbe redundant w.r.t. id */
|
||||
|
||||
/*
|
||||
* enum value #2 formerly called JSACC_IMPORT,
|
||||
|
@ -641,7 +641,7 @@ NodeBuilder::newArray(NodeVector &elts, Value *dst)
|
||||
js_ReportAllocationOverflow(cx);
|
||||
return false;
|
||||
}
|
||||
Rooted<JSObject*> array(cx, NewDenseAllocatedArray(cx, uint32_t(len)));
|
||||
JSObject *array = NewDenseAllocatedArray(cx, uint32_t(len));
|
||||
if (!array)
|
||||
return false;
|
||||
|
||||
@ -654,7 +654,7 @@ NodeBuilder::newArray(NodeVector &elts, Value *dst)
|
||||
if (val.isMagic(JS_SERIALIZE_NO_NODE))
|
||||
continue;
|
||||
|
||||
if (!array->setElement(cx, array, i, &val, false))
|
||||
if (!array->setElement(cx, i, &val, false))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ struct Shape : public js::gc::Cell
|
||||
int ashortid) const;
|
||||
|
||||
bool get(JSContext* cx, HandleObject receiver, JSObject *obj, JSObject *pobj, js::Value* vp) const;
|
||||
bool set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, js::Value* vp) const;
|
||||
bool set(JSContext* cx, HandleObject obj, bool strict, js::Value* vp) const;
|
||||
|
||||
BaseShape *base() const { return base_; }
|
||||
|
||||
|
@ -283,13 +283,13 @@ Shape::get(JSContext* cx, HandleObject receiver, JSObject* obj, JSObject *pobj,
|
||||
}
|
||||
|
||||
inline bool
|
||||
Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, Value* vp) const
|
||||
Shape::set(JSContext* cx, HandleObject obj, bool strict, Value* vp) const
|
||||
{
|
||||
JS_ASSERT_IF(hasDefaultSetter(), hasGetterValue());
|
||||
|
||||
if (attrs & JSPROP_SETTER) {
|
||||
Value fval = setterValue();
|
||||
return InvokeGetterOrSetter(cx, receiver, fval, 1, vp, vp);
|
||||
return InvokeGetterOrSetter(cx, obj, fval, 1, vp, vp);
|
||||
}
|
||||
|
||||
if (attrs & JSPROP_GETTER)
|
||||
|
@ -546,7 +546,7 @@ ArrayBufferObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
|
||||
RootedObject oldDelegateProto(cx, delegate->getProto());
|
||||
|
||||
if (!baseops::SetPropertyHelper(cx, delegate, delegate, id, 0, vp, strict))
|
||||
if (!baseops::SetPropertyHelper(cx, delegate, id, 0, vp, strict))
|
||||
return false;
|
||||
|
||||
if (delegate->getProto() != oldDelegateProto) {
|
||||
@ -567,7 +567,7 @@ ArrayBufferObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
return true;
|
||||
}
|
||||
|
||||
return baseops::SetPropertyHelper(cx, delegate, obj, id, 0, vp, strict);
|
||||
return baseops::SetPropertyHelper(cx, delegate, id, 0, vp, strict);
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -586,7 +586,7 @@ ArrayBufferObject::obj_setElement(JSContext *cx, HandleObject obj,
|
||||
if (!delegate)
|
||||
return false;
|
||||
|
||||
return baseops::SetElementHelper(cx, delegate, obj, index, 0, vp, strict);
|
||||
return baseops::SetElementHelper(cx, delegate, index, 0, vp, strict);
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -4217,7 +4217,7 @@ PutProperty(JSContext *cx, HandleObject obj_, HandleId id_, JSBool strict, jsval
|
||||
if (!nameqn)
|
||||
goto bad;
|
||||
if (!JSID_IS_VOID(funid)) {
|
||||
ok = baseops::SetPropertyHelper(cx, obj, obj, funid, 0, vp, false);
|
||||
ok = baseops::SetPropertyHelper(cx, obj, funid, 0, vp, false);
|
||||
goto out;
|
||||
}
|
||||
nameobj = nameqn;
|
||||
@ -6068,7 +6068,7 @@ FindInScopeNamespaces(JSContext *cx, JSXML *xml, JSXMLArray<JSObject> *nsarray)
|
||||
static bool
|
||||
NamespacesToJSArray(JSContext *cx, JSXMLArray<JSObject> *array, jsval *rval)
|
||||
{
|
||||
Rooted<JSObject*> arrayobj(cx, NewDenseEmptyArray(cx));
|
||||
JSObject *arrayobj = NewDenseEmptyArray(cx);
|
||||
if (!arrayobj)
|
||||
return false;
|
||||
*rval = OBJECT_TO_JSVAL(arrayobj);
|
||||
@ -6079,7 +6079,7 @@ NamespacesToJSArray(JSContext *cx, JSXMLArray<JSObject> *array, jsval *rval)
|
||||
if (!ns)
|
||||
continue;
|
||||
tvr.set(ObjectValue(*ns));
|
||||
if (!arrayobj->setElement(cx, arrayobj, i, tvr.addr(), false))
|
||||
if (!arrayobj->setElement(cx, i, tvr.addr(), false))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -29,6 +29,19 @@ ReportAtomNotDefined(JSContext *cx, JSAtom *atom)
|
||||
js_ReportIsNotDefined(cx, printable.ptr());
|
||||
}
|
||||
|
||||
#define NATIVE_SET(cx,obj,shape,entry,strict,vp) \
|
||||
JS_BEGIN_MACRO \
|
||||
if (shape->hasDefaultSetter() && \
|
||||
(shape)->hasSlot() && \
|
||||
!(shape)->isMethod()) { \
|
||||
/* Fast path for, e.g., plain Object instance properties. */ \
|
||||
(obj)->nativeSetSlotWithType(cx, shape, *vp); \
|
||||
} else { \
|
||||
if (!js_NativeSet(cx, obj, shape, false, strict, vp)) \
|
||||
THROW(); \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
#define NATIVE_GET(cx,obj,pobj,shape,getHow,vp,onerr) \
|
||||
JS_BEGIN_MACRO \
|
||||
if (shape->isDataDescriptor() && shape->hasDefaultGetter()) { \
|
||||
|
@ -125,9 +125,10 @@ stubs::SetElem(VMFrame &f)
|
||||
Value &idval = regs.sp[-2];
|
||||
Value rval = regs.sp[-1];
|
||||
|
||||
JSObject *obj;
|
||||
RootedId id(cx);
|
||||
|
||||
Rooted<JSObject*> obj(cx, ValueToObject(cx, objval));
|
||||
obj = ValueToObject(cx, objval);
|
||||
if (!obj)
|
||||
THROW();
|
||||
|
||||
@ -155,7 +156,7 @@ stubs::SetElem(VMFrame &f)
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
if (!obj->setGeneric(cx, obj, id, &rval, strict))
|
||||
if (!obj->setGeneric(cx, id, &rval, strict))
|
||||
THROW();
|
||||
end_setelem:
|
||||
/* :FIXME: Moving the assigned object into the lowest stack slot
|
||||
@ -334,7 +335,7 @@ stubs::DefFun(VMFrame &f, JSFunction *fun_)
|
||||
* current scope chain even for the case of function expression statements
|
||||
* and functions defined by eval inside let or with blocks.
|
||||
*/
|
||||
Rooted<JSObject*> parent(cx, &fp->varObj());
|
||||
JSObject *parent = &fp->varObj();
|
||||
|
||||
/* ES5 10.5 (NB: with subsequent errata). */
|
||||
PropertyName *name = fun->atom->asPropertyName();
|
||||
@ -387,7 +388,7 @@ stubs::DefFun(VMFrame &f, JSFunction *fun_)
|
||||
*/
|
||||
|
||||
/* Step 5f. */
|
||||
if (!parent->setProperty(cx, parent, name, &rval, strict))
|
||||
if (!parent->setProperty(cx, name, &rval, strict))
|
||||
THROW();
|
||||
} while (false);
|
||||
}
|
||||
@ -1034,7 +1035,7 @@ InitPropOrMethod(VMFrame &f, PropertyName *name, JSOp op)
|
||||
RootedId id(cx, NameToId(name));
|
||||
|
||||
if (JS_UNLIKELY(name == cx->runtime->atomState.protoAtom)
|
||||
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false)
|
||||
? !baseops::SetPropertyHelper(cx, obj, id, 0, &rval, false)
|
||||
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
|
||||
JSPROP_ENUMERATE, 0, 0, 0)) {
|
||||
THROW();
|
||||
|
@ -316,7 +316,7 @@ StrictArgSetter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, Val
|
||||
*/
|
||||
RootedValue value(cx);
|
||||
return baseops::DeleteGeneric(cx, argsobj, id, value.address(), strict) &&
|
||||
baseops::SetPropertyHelper(cx, argsobj, argsobj, id, 0, vp, strict);
|
||||
baseops::SetPropertyHelper(cx, argsobj, id, 0, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -4490,7 +4490,7 @@ DebuggerEnv_setVariable(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
/* Just set the property. */
|
||||
if (!env->setGeneric(cx, env, id, v.address(), true))
|
||||
if (!env->setGeneric(cx, id, v.address(), true))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -411,29 +411,25 @@ with_GetSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSp
|
||||
static JSBool
|
||||
with_SetGeneric(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool strict)
|
||||
{
|
||||
Rooted<JSObject*> actual(cx, &obj->asWith().object());
|
||||
return actual->setGeneric(cx, actual, id, vp, strict);
|
||||
return obj->asWith().object().setGeneric(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
with_SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict)
|
||||
{
|
||||
Rooted<JSObject*> actual(cx, &obj->asWith().object());
|
||||
return actual->setProperty(cx, actual, name, vp, strict);
|
||||
return obj->asWith().object().setProperty(cx, name, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
with_SetElement(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict)
|
||||
{
|
||||
Rooted<JSObject*> actual(cx, &obj->asWith().object());
|
||||
return actual->setElement(cx, actual, index, vp, strict);
|
||||
return obj->asWith().object().setElement(cx, index, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
with_SetSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict)
|
||||
{
|
||||
Rooted<JSObject*> actual(cx, &obj->asWith().object());
|
||||
return actual->setSpecial(cx, actual, sid, vp, strict);
|
||||
return obj->asWith().object().setSpecial(cx, sid, vp, strict);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -1346,13 +1342,13 @@ class DebugScopeProxy : public BaseProxyHandler
|
||||
bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id_, bool strict,
|
||||
Value *vp) MOZ_OVERRIDE
|
||||
{
|
||||
Rooted<ScopeObject*> scope(cx, &proxy->asDebugScope().scope());
|
||||
ScopeObject &scope = proxy->asDebugScope().scope();
|
||||
|
||||
if (handleUnaliasedAccess(cx, *scope, id_, SET, vp))
|
||||
if (handleUnaliasedAccess(cx, scope, id_, SET, vp))
|
||||
return true;
|
||||
|
||||
Rooted<jsid> id(cx, id_);
|
||||
return scope->setGeneric(cx, scope, id, vp, strict);
|
||||
return scope.setGeneric(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
bool defineProperty(JSContext *cx, JSObject *proxy, jsid id, PropertyDescriptor *desc) MOZ_OVERRIDE
|
||||
|
Loading…
Reference in New Issue
Block a user