Bug 547140, part 1 - Remove JSRESOLVE_ASSIGNING. r=Waldo.

This commit is contained in:
Jason Orendorff 2014-04-25 16:11:00 -05:00
Родитель 688b81de12
Коммит e51a8c4a20
6 изменённых файлов: 8 добавлений и 32 удалений

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

@ -127,9 +127,7 @@ typedef bool
typedef bool
(* JSResolveOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id);
// Like JSResolveOp, but flags provide contextual information as follows:
//
// JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment
// Like JSResolveOp, except with a useless flags argument, always 0. Also:
//
// 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,

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

@ -3441,7 +3441,6 @@ JS_SetPropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue v)
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
return JSObject::setGeneric(cx, obj, obj, id, &value, false);
}
@ -3452,7 +3451,6 @@ SetElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue v
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, vp);
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
return JSObject::setElement(cx, obj, obj, index, vp, false);
}

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

@ -2331,11 +2331,6 @@ JS_StringToId(JSContext *cx, JS::HandleString s, JS::MutableHandleId idp);
extern JS_PUBLIC_API(bool)
JS_IdToValue(JSContext *cx, jsid id, JS::MutableHandle<JS::Value> vp);
/*
* JSNewResolveOp flag bits.
*/
#define JSRESOLVE_ASSIGNING 0x01 /* resolve on the left of assignment */
/*
* Invoke the [[DefaultValue]] hook (see ES5 8.6.2) with the provided hint on
* the specified object, computing a primitive default value for the object.

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

@ -1663,20 +1663,7 @@ Detecting(JSContext *cx, JSScript *script, jsbytecode *pc)
unsigned
js_InferFlags(JSContext *cx, unsigned defaultFlags)
{
/*
* We intentionally want to look across compartment boundaries to correctly
* handle the case of cross-compartment property access.
*/
jsbytecode *pc;
JSScript *script = cx->currentScript(&pc, JSContext::ALLOW_CROSS_COMPARTMENT);
if (!script)
return defaultFlags;
uint32_t format = js_CodeSpec[*pc].format;
unsigned flags = 0;
if (format & JOF_SET)
flags |= JSRESOLVE_ASSIGNING;
return flags;
return 0;
}
/* static */ bool
@ -4904,7 +4891,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits<mode>::ContextType cxArg
JSContext *cx = cxArg->asJSContext();
Rooted<PropertyDescriptor> pd(cx);
if (!Proxy::getPropertyDescriptor(cx, pobj, id, &pd, JSRESOLVE_ASSIGNING))
if (!Proxy::getPropertyDescriptor(cx, pobj, id, &pd, 0))
return false;
if ((pd.attributes() & (JSPROP_SHARED | JSPROP_SHADOWABLE)) == JSPROP_SHARED) {

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

@ -159,7 +159,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
assertEnteredPolicy(cx, proxy, id, SET);
Rooted<PropertyDescriptor> desc(cx);
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, JSRESOLVE_ASSIGNING))
if (!getOwnPropertyDescriptor(cx, proxy, id, &desc, 0))
return false;
/* The control-flow here differs from ::get() because of the fall-through case below. */
if (desc.object()) {
@ -187,7 +187,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
desc.value().set(vp.get());
return defineProperty(cx, receiver, id, &desc);
}
if (!getPropertyDescriptor(cx, proxy, id, &desc, JSRESOLVE_ASSIGNING))
if (!getPropertyDescriptor(cx, proxy, id, &desc, 0))
return false;
if (desc.object()) {
// Check for read-only properties.
@ -2601,7 +2601,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
// If we have an existing (own or non-own) property with a setter, we want
// to invoke that.
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc, JSRESOLVE_ASSIGNING))
if (!Proxy::getPropertyDescriptor(cx, proxy, id, &desc, 0))
return false;
if (desc.object() && desc.setter() && desc.setter() != JS_StrictPropertyStub)
return CallSetter(cx, receiver, id, desc.setter(), desc.attributes(), strict, vp);
@ -2969,7 +2969,7 @@ js::proxy_SetGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, uns
{
/* Lookup the current property descriptor so we have setter/getter/value. */
Rooted<PropertyDescriptor> desc(cx);
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc, JSRESOLVE_ASSIGNING))
if (!Proxy::getOwnPropertyDescriptor(cx, obj, id, &desc, 0))
return false;
desc.setAttributes(*attrsp);
return Proxy::defineProperty(cx, obj, id, &desc);

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

@ -1995,10 +1995,8 @@ XrayWrapper<Base, Traits>::defineProperty(JSContext *cx, HandleObject wrapper,
{
assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET);
// NB: We still need JSRESOLVE_ASSIGNING here for the time being, because it
// tells things like nodelists whether they should create the property or not.
Rooted<JSPropertyDescriptor> existing_desc(cx);
if (!getOwnPropertyDescriptor(cx, wrapper, id, &existing_desc, JSRESOLVE_ASSIGNING))
if (!getOwnPropertyDescriptor(cx, wrapper, id, &existing_desc, 0))
return false;
if (existing_desc.object() && existing_desc.isPermanent())