Commit c1a3f2be authored by Iain Ireland's avatar Iain Ireland
Browse files

Bug 1912715: Simplify with-env handling in FetchName r=jandem a=RyanVM

parent 54fac0dc
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -125,7 +125,8 @@ inline bool FetchName(JSContext* cx, HandleObject receiver, HandleObject holder,
  }

  /* Take the slow path if shape was not found in a native object. */
  if (!receiver->is<NativeObject>() || !holder->is<NativeObject>()) {
  if (!receiver->is<NativeObject>() || !holder->is<NativeObject>() ||
      receiver->is<WithEnvironmentObject>()) {
    Rooted<jsid> id(cx, NameToId(name));
    if (!GetProperty(cx, receiver, receiver, id, vp)) {
      return false;
@@ -136,11 +137,8 @@ inline bool FetchName(JSContext* cx, HandleObject receiver, HandleObject holder,
      /* Fast path for Object instance properties. */
      vp.set(holder->as<NativeObject>().getSlot(propInfo.slot()));
    } else {
      // Unwrap 'with' environments for reasons given in
      // GetNameBoundInEnvironment.
      RootedObject normalized(cx, MaybeUnwrapWithEnvironment(receiver));
      RootedId id(cx, NameToId(name));
      if (!NativeGetExistingProperty(cx, normalized, holder.as<NativeObject>(),
      if (!NativeGetExistingProperty(cx, receiver, holder.as<NativeObject>(),
                                     id, propInfo, vp)) {
        return false;
      }