From e51a8c4a205957f4694ccf8bae085821d7f5ffee Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Fri, 25 Apr 2014 16:11:00 -0500 Subject: [PATCH] Bug 547140, part 1 - Remove JSRESOLVE_ASSIGNING. r=Waldo. --- js/public/Class.h | 4 +--- js/src/jsapi.cpp | 2 -- js/src/jsapi.h | 5 ----- js/src/jsobj.cpp | 17 ++--------------- js/src/jsproxy.cpp | 8 ++++---- js/xpconnect/wrappers/XrayWrapper.cpp | 4 +--- 6 files changed, 8 insertions(+), 32 deletions(-) diff --git a/js/public/Class.h b/js/public/Class.h index 321dc816febf..9adcd35fbdef 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -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, diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 4207763d43a4..c863ae0eed01 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -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); } diff --git a/js/src/jsapi.h b/js/src/jsapi.h index f92f88d8f6c2..9793d7b04ff7 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -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 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. diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 99f5494e79b8..396cd8acb329 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -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::ContextType cxArg JSContext *cx = cxArg->asJSContext(); Rooted 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) { diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index bc5be91aaba7..fd6a035bf171 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -159,7 +159,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, assertEnteredPolicy(cx, proxy, id, SET); Rooted 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 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 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); diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 57653f548224..b9a28f0800a1 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1995,10 +1995,8 @@ XrayWrapper::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 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())