code: @Deprecated
      public static Scriptable toObjectOrNull(Context cx, Object obj)
      {
          if (obj instanceof Scriptable) {
              return (Scriptable)obj;
          } else if (obj != null && obj != Undefined.instance) {
              return toObject(cx, getTopCallScope(cx), obj);
          }
          return null;
      }
docs: <strong>Warning</strong>: This doesn't allow to resolve primitive
  prototype properly when many top scopes are involved
  
  @deprecated Use {@link #toObjectOrNull(Context, Object, Scriptable)} instead