Bug 1501910 - Pass enumerableOnly into nsIXPCScriptable::NewEnumerate, r=bzbarsky
authorNika Layzell <nika@thelayzells.com>
Wed, 24 Oct 2018 23:40:37 -0400
changeset 491293 c8ca4a20631561e4a7a6cf68be07ec2eef2e7bd0
parent 491292 31b1aec1f478396b13afd5adb7bae220ca1b5d44
child 491294 01da72655339b6e9182e0cfb06e45ed7f0cb47ae
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersbzbarsky
bugs1501910
milestone65.0a1
Bug 1501910 - Pass enumerableOnly into nsIXPCScriptable::NewEnumerate, r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D9749
js/xpconnect/idl/nsIXPCScriptable.idl
js/xpconnect/public/xpc_map_end.h
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
--- a/js/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/xpconnect/idl/nsIXPCScriptable.idl
@@ -74,17 +74,18 @@ interface nsIXPCScriptable : nsISupports
     void   preCreate(in nsISupports nativeObj, in JSContextPtr cx,
                      in JSObjectPtr globalObj, out JSObjectPtr parentObj);
 
     boolean enumerate(in nsIXPConnectWrappedNative wrapper,
                      in JSContextPtr cx, in JSObjectPtr obj);
 
     boolean newEnumerate(in nsIXPConnectWrappedNative wrapper,
                         in JSContextPtr cx, in JSObjectPtr obj,
-                        in JSAutoIdVector properties);
+                        in JSAutoIdVector properties,
+                        in boolean enumerableOnly);
 
     boolean resolve(in nsIXPConnectWrappedNative wrapper,
                     in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                     out boolean resolvedp);
 
     void   finalize(in nsIXPConnectWrappedNative wrapper,
                     in JSFreeOpPtr fop, in JSObjectPtr obj);
 
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -60,17 +60,17 @@ XPC_MAP_CLASSNAME::GetJSClass()
 /**************************************************************/
 
 #if !((XPC_MAP_FLAGS) & XPC_SCRIPTABLE_WANT_PRECREATE)
 NS_IMETHODIMP XPC_MAP_CLASSNAME::PreCreate(nsISupports* nativeObj, JSContext * cx, JSObject * globalObj, JSObject * *parentObj)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #if !((XPC_MAP_FLAGS) & XPC_SCRIPTABLE_WANT_NEWENUMERATE)
-NS_IMETHODIMP XPC_MAP_CLASSNAME::NewEnumerate(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, JS::AutoIdVector& properties, bool* _retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::NewEnumerate(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, JS::AutoIdVector& properties, bool enumerableOnly, bool* _retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #if !((XPC_MAP_FLAGS) & XPC_SCRIPTABLE_WANT_ENUMERATE)
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Enumerate(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, bool* _retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -202,16 +202,17 @@ NS_IMPL_ISUPPORTS(nsXPCComponents_Interf
                        XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
 #include "xpc_map_end.h" /* This will #undef the above */
 
 
 NS_IMETHODIMP
 nsXPCComponents_Interfaces::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
                                          JSContext* cx, JSObject* obj,
                                          JS::AutoIdVector& properties,
+                                         bool enumerableOnly,
                                          bool* _retval)
 {
 
     if (!properties.reserve(nsXPTInterfaceInfo::InterfaceCount())) {
         *_retval = false;
         return NS_OK;
     }
 
@@ -389,16 +390,17 @@ NS_IMPL_ISUPPORTS(nsXPCComponents_Interf
                        XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
                        XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
                                              JSContext* cx, JSObject* obj,
                                              JS::AutoIdVector& properties,
+                                             bool enumerableOnly,
                                              bool* _retval)
 {
 
     if (!properties.reserve(nsXPTInterfaceInfo::InterfaceCount())) {
         *_retval = false;
         return NS_OK;
     }
 
@@ -584,16 +586,17 @@ NS_IMPL_ISUPPORTS(nsXPCComponents_Classe
                        XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
                        XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
                                       JSContext* cx, JSObject* obj,
                                       JS::AutoIdVector& properties,
+                                      bool enumerableOnly,
                                       bool* _retval)
 {
     nsCOMPtr<nsIComponentRegistrar> compMgr;
     if (NS_FAILED(NS_GetComponentRegistrar(getter_AddRefs(compMgr))) || !compMgr) {
         return NS_ERROR_UNEXPECTED;
     }
 
     nsCOMPtr<nsISimpleEnumerator> e;
@@ -779,16 +782,17 @@ NS_IMPL_ISUPPORTS(nsXPCComponents_Classe
                        XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
                        XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
                                           JSContext* cx, JSObject* obj,
                                           JS::AutoIdVector& properties,
+                                          bool enumerableOnly,
                                           bool* _retval)
 {
 
     nsCOMPtr<nsIComponentRegistrar> compMgr;
     if (NS_FAILED(NS_GetComponentRegistrar(getter_AddRefs(compMgr))) || !compMgr) {
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -988,16 +992,17 @@ NS_IMPL_ISUPPORTS(nsXPCComponents_Result
                        XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
                        XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 nsXPCComponents_Results::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
                                       JSContext* cx, JSObject* obj,
                                       JS::AutoIdVector& properties,
+                                      bool enumerableOnly,
                                       bool* _retval)
 {
     const char* name;
     const void* iter = nullptr;
     while (nsXPCException::IterateNSResults(nullptr, &name, nullptr, &iter)) {
         RootedString idstr(cx, JS_NewStringCopyZ(cx, name));
         if (!idstr) {
             *_retval = false;
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -936,17 +936,18 @@ XPC_WN_NewEnumerate(JSContext* cx, Handl
         return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
     }
 
     if (!XPC_WN_Shared_Enumerate(cx, obj)) {
         return false;
     }
 
     bool retval = true;
-    nsresult rv = scr->NewEnumerate(wrapper, cx, obj, properties, &retval);
+    nsresult rv = scr->NewEnumerate(wrapper, cx, obj, properties,
+                                    enumerableOnly, &retval);
     if (NS_FAILED(rv)) {
         return Throw(rv, cx);
     }
     return retval;
 }
 
 /***************************************************************************/
 /***************************************************************************/