Bug 1090537, part 12 - Change SetNonexistentProperty to use only receiver, not obj. No change in behavior. r=efaust.
authorJason Orendorff <jorendorff@mozilla.com>
Sat, 25 Oct 2014 11:24:55 -0500
changeset 226130 aca93ae7eeede8e712b0cf39fc0a47c4e79bcaa0
parent 226129 1d518eed470edbac5d5a1b79ad350e0849084df0
child 226131 dac60d6bef5642cff46a24d339bfe4237175b1fb
push id36
push userdburns@mozilla.com
push dateMon, 10 Nov 2014 15:14:02 +0000
reviewersefaust
bugs1090537
milestone36.0a1
Bug 1090537, part 12 - Change SetNonexistentProperty to use only receiver, not obj. No change in behavior. r=efaust. (The behavior doesn't change because Unqualified is only passed from two call sites, and in both places, the same object is passed for both receiver and obj.)
js/src/vm/NativeObject.cpp
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -2002,31 +2002,30 @@ SetPropertyByDefining(typename Execution
                                          JSPROP_ENUMERATE, v, true, strict);
 }
 
 /*
  * Implement "the rest of" assignment to a property when no property receiver[id]
  * was found anywhere on the prototype chain.
  *
  * FIXME: This should be updated to follow ES6 draft rev 28, section 9.1.9,
- * steps 4.d.i and 5. Right now it doesn't exactly follow any standard, and in
- * particular receiver should be used instead of obj throughout.
+ * steps 4.d.i and 5.
  *
  * Note that receiver is not necessarily native.
  */
 template <ExecutionMode mode>
 static bool
 SetNonexistentProperty(typename ExecutionModeTraits<mode>::ContextType cxArg,
-                       HandleObject obj, HandleObject receiver, HandleId id,
-                       baseops::QualifiedBool qualified, HandleValue v, bool strict)
+                       HandleObject receiver, HandleId id, baseops::QualifiedBool qualified,
+                       HandleValue v, bool strict)
 {
     // We should never add properties to lexical blocks.
-    MOZ_ASSERT(!obj->is<BlockObject>());
+    MOZ_ASSERT(!receiver->is<BlockObject>());
 
-    if (obj->isUnqualifiedVarObj() && !qualified) {
+    if (receiver->isUnqualifiedVarObj() && !qualified) {
         if (mode == ParallelExecution)
             return false;
 
         if (!MaybeReportUndeclaredVarAssignment(cxArg->asJSContext(), JSID_TO_STRING(id)))
             return false;
     }
 
     return SetPropertyByDefining<mode>(cxArg, receiver, id, v, strict);
@@ -2060,17 +2059,17 @@ baseops::SetPropertyHelper(typename Exec
         pobj = npobj;
     } else {
         JSContext *cx = cxArg->asJSContext();
         if (!LookupNativeProperty(cx, obj, id, &pobj, &shape))
             return false;
     }
 
     if (!shape)
-        return SetNonexistentProperty<mode>(cxArg, obj, receiver, id, qualified, vp, strict);
+        return SetNonexistentProperty<mode>(cxArg, receiver, id, qualified, vp, strict);
 
     if (!pobj->isNative()) {
         if (pobj->is<ProxyObject>()) {
             if (mode == ParallelExecution)
                 return false;
 
             JSContext *cx = cxArg->asJSContext();
             Rooted<PropertyDescriptor> pd(cx);