Bug 1510682 - Add field comments for uses of js::ObjectOps. r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Thu, 02 Jan 2020 08:26:37 +0000
changeset 508594 8b5ffa9c5266ffee43f0d8cd20aee41b2fd8bfca
parent 508593 9a1bd82aed934b42ee8e73b41e71ecb73f208ca0
child 508595 78fc896288d5f01ee7acf5b6a91a44054545eca7
push id36973
push userncsoregi@mozilla.com
push dateThu, 02 Jan 2020 21:50:15 +0000
treeherdermozilla-central@7d0cec2c6c40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1510682
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510682 - Add field comments for uses of js::ObjectOps. r=jandem Depends on D58495 Differential Revision: https://phabricator.services.mozilla.com/D58496
js/src/builtin/TypedObject.cpp
js/src/jsapi-tests/testWindowNonConfigurable.cpp
js/src/proxy/Proxy.cpp
js/src/vm/ArgumentsObject.cpp
js/src/vm/EnvironmentObject.cpp
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -2222,25 +2222,25 @@ size_t InlineTypedObject::obj_moved(JSOb
   return 0;
 }
 
 /******************************************************************************
  * Typed object classes
  */
 
 const ObjectOps TypedObject::objectOps_ = {
-    TypedObject::obj_lookupProperty,
-    TypedObject::obj_defineProperty,
-    TypedObject::obj_hasProperty,
-    TypedObject::obj_getProperty,
-    TypedObject::obj_setProperty,
-    TypedObject::obj_getOwnPropertyDescriptor,
-    TypedObject::obj_deleteProperty,
-    nullptr, /* getElements */
-    nullptr, /* thisValue */
+    TypedObject::obj_lookupProperty,            // lookupProperty
+    TypedObject::obj_defineProperty,            // defineProperty
+    TypedObject::obj_hasProperty,               // hasProperty
+    TypedObject::obj_getProperty,               // getProperty
+    TypedObject::obj_setProperty,               // setProperty
+    TypedObject::obj_getOwnPropertyDescriptor,  // getOwnPropertyDescriptor
+    TypedObject::obj_deleteProperty,            // deleteProperty
+    nullptr,                                    // getElements
+    nullptr,                                    // funToString
 };
 
 #define DEFINE_TYPEDOBJ_CLASS(Name, Trace, Moved)                            \
   static const JSClassOps Name##ClassOps = {                                 \
       nullptr, /* addProperty */                                             \
       nullptr, /* delProperty */                                             \
       nullptr, /* enumerate   */                                             \
       TypedObject::obj_newEnumerate,                                         \
--- a/js/src/jsapi-tests/testWindowNonConfigurable.cpp
+++ b/js/src/jsapi-tests/testWindowNonConfigurable.cpp
@@ -14,18 +14,27 @@ static bool windowProxy_defineProperty(J
   if (desc.hasConfigurable() && !desc.configurable()) {
     result.failCantDefineWindowNonConfigurable();
     return true;
   }
 
   return NativeDefineProperty(cx, obj.as<js::NativeObject>(), id, desc, result);
 }
 
-static const js::ObjectOps windowProxy_objectOps = {nullptr,
-                                                    windowProxy_defineProperty};
+static const js::ObjectOps windowProxy_objectOps = {
+    nullptr,                     // lookupProperty
+    windowProxy_defineProperty,  // defineProperty
+    nullptr,                     // hasProperty
+    nullptr,                     // getProperty
+    nullptr,                     // setProperty
+    nullptr,                     // getOwnPropertyDescriptor
+    nullptr,                     // deleteProperty
+    nullptr,                     // getElements
+    nullptr,                     // funToString
+};
 
 static const JSClass windowProxy_class = {
     "WindowProxy", 0, nullptr, nullptr, nullptr, &windowProxy_objectOps};
 
 BEGIN_TEST(testWindowNonConfigurable) {
   JS::RootedObject obj(cx, JS_NewObject(cx, &windowProxy_class));
   CHECK(obj);
   CHECK(JS_DefineProperty(cx, global, "windowProxy", obj, 0));
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -744,21 +744,26 @@ const JSClassOps js::ProxyClassOps = {
     ProxyObject::trace,  // trace
 };
 
 const ClassExtension js::ProxyClassExtension = {
     proxy_ObjectMoved,  // objectMovedOp
 };
 
 const ObjectOps js::ProxyObjectOps = {
-    proxy_LookupProperty, Proxy::defineProperty,
-    Proxy::has,           Proxy::get,
-    Proxy::set,           Proxy::getOwnPropertyDescriptor,
-    proxy_DeleteProperty, Proxy::getElements,
-    Proxy::fun_toString};
+    proxy_LookupProperty,             // lookupProperty
+    Proxy::defineProperty,            // defineProperty
+    Proxy::has,                       // hasProperty
+    Proxy::get,                       // getProperty
+    Proxy::set,                       // setProperty
+    Proxy::getOwnPropertyDescriptor,  // getOwnPropertyDescriptor
+    proxy_DeleteProperty,             // deleteProperty
+    Proxy::getElements,               // getElements
+    Proxy::fun_toString,              // funToString
+};
 
 static const JSFunctionSpec proxy_static_methods[] = {
     JS_FN("revocable", proxy_revocable, 2, 0), JS_FS_END};
 
 static const ClassSpec ProxyClassSpec = {
     GenericCreateConstructor<js::proxy, 2, gc::AllocKind::FUNCTION>, nullptr,
     proxy_static_methods, nullptr};
 
--- a/js/src/vm/ArgumentsObject.cpp
+++ b/js/src/vm/ArgumentsObject.cpp
@@ -1003,18 +1003,26 @@ const JSClassOps MappedArgumentsObject::
     ArgumentsObject::trace,                // trace
 };
 
 const js::ClassExtension MappedArgumentsObject::classExt_ = {
     ArgumentsObject::objectMoved,  // objectMovedOp
 };
 
 const ObjectOps MappedArgumentsObject::objectOps_ = {
-    nullptr, /* lookupProperty */
-    MappedArgumentsObject::obj_defineProperty};
+    nullptr,                                    // lookupProperty
+    MappedArgumentsObject::obj_defineProperty,  // defineProperty
+    nullptr,                                    // hasProperty
+    nullptr,                                    // getProperty
+    nullptr,                                    // setProperty
+    nullptr,                                    // getOwnPropertyDescriptor
+    nullptr,                                    // deleteProperty
+    nullptr,                                    // getElements
+    nullptr,                                    // funToString
+};
 
 const JSClass MappedArgumentsObject::class_ = {
     "Arguments",
     JSCLASS_DELAY_METADATA_BUILDER |
         JSCLASS_HAS_RESERVED_SLOTS(MappedArgumentsObject::RESERVED_SLOTS) |
         JSCLASS_HAS_CACHED_PROTO(JSProto_Object) |
         JSCLASS_SKIP_NURSERY_FINALIZE | JSCLASS_BACKGROUND_FINALIZE,
     &MappedArgumentsObject::classOps_,
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -369,25 +369,27 @@ VarEnvironmentObject* VarEnvironmentObje
 }
 
 const JSClass VarEnvironmentObject::class_ = {
     "Var", JSCLASS_HAS_RESERVED_SLOTS(VarEnvironmentObject::RESERVED_SLOTS)};
 
 /*****************************************************************************/
 
 const ObjectOps ModuleEnvironmentObject::objectOps_ = {
-    ModuleEnvironmentObject::lookupProperty,
-    nullptr, /* defineProperty */
-    ModuleEnvironmentObject::hasProperty,
-    ModuleEnvironmentObject::getProperty,
-    ModuleEnvironmentObject::setProperty,
-    ModuleEnvironmentObject::getOwnPropertyDescriptor,
-    ModuleEnvironmentObject::deleteProperty,
-    nullptr, /* getElements */
-    nullptr};
+    ModuleEnvironmentObject::lookupProperty,  // lookupProperty
+    nullptr,                                  // defineProperty
+    ModuleEnvironmentObject::hasProperty,     // hasProperty
+    ModuleEnvironmentObject::getProperty,     // getProperty
+    ModuleEnvironmentObject::setProperty,     // setProperty
+    ModuleEnvironmentObject::
+        getOwnPropertyDescriptor,             // getOwnPropertyDescriptor
+    ModuleEnvironmentObject::deleteProperty,  // deleteProperty
+    nullptr,                                  // getElements
+    nullptr,                                  // funToString
+};
 
 const JSClassOps ModuleEnvironmentObject::classOps_ = {
     nullptr,                                // addProperty
     nullptr,                                // delProperty
     nullptr,                                // enumerate
     ModuleEnvironmentObject::newEnumerate,  // newEnumerate
     nullptr,                                // resolve
     nullptr,                                // mayResolve
@@ -807,25 +809,25 @@ static bool with_GetOwnPropertyDescripto
 static bool with_DeleteProperty(JSContext* cx, HandleObject obj, HandleId id,
                                 ObjectOpResult& result) {
   MOZ_ASSERT(!IsUnscopableDotName(cx, id));
   RootedObject actual(cx, &obj->as<WithEnvironmentObject>().object());
   return DeleteProperty(cx, actual, id, result);
 }
 
 static const ObjectOps WithEnvironmentObjectOps = {
-    with_LookupProperty,
-    with_DefineProperty,
-    with_HasProperty,
-    with_GetProperty,
-    with_SetProperty,
-    with_GetOwnPropertyDescriptor,
-    with_DeleteProperty,
-    nullptr, /* getElements */
-    nullptr,
+    with_LookupProperty,            // lookupProperty
+    with_DefineProperty,            // defineProperty
+    with_HasProperty,               // hasProperty
+    with_GetProperty,               // getProperty
+    with_SetProperty,               // setProperty
+    with_GetOwnPropertyDescriptor,  // getOwnPropertyDescriptor
+    with_DeleteProperty,            // deleteProperty
+    nullptr,                        // getElements
+    nullptr,                        // funToString
 };
 
 const JSClass WithEnvironmentObject::class_ = {
     "With",
     JSCLASS_HAS_RESERVED_SLOTS(WithEnvironmentObject::RESERVED_SLOTS),
     JS_NULL_CLASS_OPS,
     JS_NULL_CLASS_SPEC,
     JS_NULL_CLASS_EXT,
@@ -1229,25 +1231,25 @@ static bool lexicalError_GetOwnPropertyD
 static bool lexicalError_DeleteProperty(JSContext* cx, HandleObject obj,
                                         HandleId id, ObjectOpResult& result) {
   ReportRuntimeLexicalErrorId(
       cx, obj->as<RuntimeLexicalErrorObject>().errorNumber(), id);
   return false;
 }
 
 static const ObjectOps RuntimeLexicalErrorObjectObjectOps = {
-    lexicalError_LookupProperty,
-    nullptr, /* defineProperty */
-    lexicalError_HasProperty,
-    lexicalError_GetProperty,
-    lexicalError_SetProperty,
-    lexicalError_GetOwnPropertyDescriptor,
-    lexicalError_DeleteProperty,
-    nullptr, /* getElements */
-    nullptr, /* this */
+    lexicalError_LookupProperty,            // lookupProperty
+    nullptr,                                // defineProperty
+    lexicalError_HasProperty,               // hasProperty
+    lexicalError_GetProperty,               // getProperty
+    lexicalError_SetProperty,               // setProperty
+    lexicalError_GetOwnPropertyDescriptor,  // getOwnPropertyDescriptor
+    lexicalError_DeleteProperty,            // deleteProperty
+    nullptr,                                // getElements
+    nullptr,                                // funToString
 };
 
 const JSClass RuntimeLexicalErrorObject::class_ = {
     "RuntimeLexicalError",
     JSCLASS_HAS_RESERVED_SLOTS(RuntimeLexicalErrorObject::RESERVED_SLOTS),
     JS_NULL_CLASS_OPS,
     JS_NULL_CLASS_SPEC,
     JS_NULL_CLASS_EXT,