Bug 1389510 part 1 - Remove getProperty/setProperty hooks from XPConnect. r=mrbkap
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 25 Aug 2017 10:10:56 +0200
changeset 376737 ff7f36a9dd90f6aaa0901e0c642565fcfcec91a5
parent 376736 bb7ce98c2f4ad9630c90be4ba96f80a58bbe2718
child 376738 6880dc2a3c29e9d3dc3a8912f2a425c1d8958bf8
push id94153
push userjandemooij@gmail.com
push dateFri, 25 Aug 2017 08:13:00 +0000
treeherdermozilla-inbound@2c56761b02a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1389510
milestone57.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 1389510 part 1 - Remove getProperty/setProperty hooks from XPConnect. r=mrbkap
dom/base/nsDOMClassInfo.cpp
js/xpconnect/idl/nsIXPCScriptable.idl
js/xpconnect/public/xpc_make_class.h
js/xpconnect/public/xpc_map_end.h
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -649,36 +649,16 @@ NS_IMETHODIMP
 nsDOMClassInfo::PreCreate(nsISupports *nativeObj, JSContext *cx,
                           JSObject *globalObj, JSObject **parentObj)
 {
   *parentObj = globalObj;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMClassInfo::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsid id, JS::Value *vp,
-                            bool *_retval)
-{
-  NS_WARNING("nsDOMClassInfo::GetProperty Don't call me!");
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMClassInfo::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsid id, JS::Value *vp,
-                            bool *_retval)
-{
-  NS_WARNING("nsDOMClassInfo::SetProperty Don't call me!");
-
-  return NS_ERROR_UNEXPECTED;
-}
-
-NS_IMETHODIMP
 nsDOMClassInfo::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                           JSObject *obj, bool *_retval)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
--- a/js/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/xpconnect/idl/nsIXPCScriptable.idl
@@ -31,18 +31,18 @@ interface nsIXPConnectWrappedNative;
 [ptr] native jsClassPtr(const js::Class);
 [ptr] native JSClassPtr(const JSClass);
 
 %{ C++
     // nsIXPCScriptable flags (only 32 bits available!). They are defined via
     // #defines so they can be used in #ifndef guards in xpc_map_end.h.
 
     #define XPC_SCRIPTABLE_WANT_PRECREATE                   (1 <<  0)
-    #define XPC_SCRIPTABLE_WANT_GETPROPERTY                 (1 <<  1)
-    #define XPC_SCRIPTABLE_WANT_SETPROPERTY                 (1 <<  2)
+    // (1 << 1) is unused
+    // (1 << 2) is unused
     #define XPC_SCRIPTABLE_WANT_ENUMERATE                   (1 <<  3)
     #define XPC_SCRIPTABLE_WANT_NEWENUMERATE                (1 <<  4)
     #define XPC_SCRIPTABLE_WANT_RESOLVE                     (1 <<  5)
     #define XPC_SCRIPTABLE_WANT_FINALIZE                    (1 <<  6)
     #define XPC_SCRIPTABLE_WANT_CALL                        (1 <<  7)
     #define XPC_SCRIPTABLE_WANT_CONSTRUCT                   (1 <<  8)
     #define XPC_SCRIPTABLE_WANT_HASINSTANCE                 (1 <<  9)
     #define XPC_SCRIPTABLE_USE_JSSTUB_FOR_ADDPROPERTY       (1 << 10)
@@ -69,24 +69,16 @@ interface nsIXPCScriptable : nsISupports
     readonly attribute string className;
     [notxpcom,nostdcall] uint32_t getScriptableFlags();
     [notxpcom,nostdcall] jsClassPtr getClass();
     [notxpcom,nostdcall] JSClassPtr getJSClass();
 
     void   preCreate(in nsISupports nativeObj, in JSContextPtr cx,
                      in JSObjectPtr globalObj, out JSObjectPtr parentObj);
 
-    boolean getProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
-                       in JSValPtr vp);
-
-    boolean setProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
-                       in JSValPtr vp);
-
     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);
 
     boolean resolve(in nsIXPConnectWrappedNative wrapper,
@@ -112,18 +104,16 @@ interface nsIXPCScriptable : nsISupports
 
 %{ C++
     #define GET_IT(f_, c_) \
     bool f_() { \
         return 0 != (GetScriptableFlags() & XPC_SCRIPTABLE_##c_); \
     }
 
     GET_IT(WantPreCreate,                WANT_PRECREATE)
-    GET_IT(WantGetProperty,              WANT_GETPROPERTY)
-    GET_IT(WantSetProperty,              WANT_SETPROPERTY)
     GET_IT(WantEnumerate,                WANT_ENUMERATE)
     GET_IT(WantNewEnumerate,             WANT_NEWENUMERATE)
     GET_IT(WantResolve,                  WANT_RESOLVE)
     GET_IT(WantFinalize,                 WANT_FINALIZE)
     GET_IT(WantCall,                     WANT_CALL)
     GET_IT(WantConstruct,                WANT_CONSTRUCT)
     GET_IT(WantHasInstance,              WANT_HASINSTANCE)
     GET_IT(UseJSStubForAddProperty,      USE_JSSTUB_FOR_ADDPROPERTY)
--- a/js/xpconnect/public/xpc_make_class.h
+++ b/js/xpconnect/public/xpc_make_class.h
@@ -24,25 +24,16 @@ bool
 XPC_WN_MaybeResolvingDeletePropertyStub(JSContext* cx, JS::HandleObject obj,
                                         JS::HandleId id,
                                         JS::ObjectOpResult& result);
 bool
 XPC_WN_CannotDeletePropertyStub(JSContext* cx, JS::HandleObject obj,
                                 JS::HandleId id, JS::ObjectOpResult& result);
 
 bool
-XPC_WN_Helper_GetProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
-                          JS::MutableHandleValue vp);
-
-bool
-XPC_WN_Helper_SetProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
-                          JS::MutableHandleValue vp,
-                          JS::ObjectOpResult& result);
-
-bool
 XPC_WN_Helper_Enumerate(JSContext* cx, JS::HandleObject obj);
 bool
 XPC_WN_Shared_Enumerate(JSContext* cx, JS::HandleObject obj);
 
 bool
 XPC_WN_NewEnumerate(JSContext* cx, JS::HandleObject obj, JS::AutoIdVector& properties,
                     bool enumerableOnly);
 
@@ -81,24 +72,20 @@ extern const js::ClassExtension XPC_WN_J
     /* delProperty */ \
     ((_flags) & XPC_SCRIPTABLE_USE_JSSTUB_FOR_DELPROPERTY) \
     ? nullptr \
     : ((_flags) & XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE) \
       ? XPC_WN_MaybeResolvingDeletePropertyStub \
       : XPC_WN_CannotDeletePropertyStub, \
     \
     /* getProperty */ \
-    ((_flags) & XPC_SCRIPTABLE_WANT_GETPROPERTY) \
-    ? XPC_WN_Helper_GetProperty \
-    : nullptr, \
+    nullptr, \
     \
     /* setProperty */ \
-    ((_flags) & XPC_SCRIPTABLE_WANT_SETPROPERTY) \
-    ? XPC_WN_Helper_SetProperty \
-    : nullptr, \
+    nullptr, \
     \
     /* enumerate */ \
     ((_flags) & XPC_SCRIPTABLE_WANT_NEWENUMERATE) \
     ? nullptr /* We will use newEnumerate set below in this case */ \
     : ((_flags) & XPC_SCRIPTABLE_WANT_ENUMERATE) \
       ? XPC_WN_Helper_Enumerate \
       : XPC_WN_Shared_Enumerate, \
     \
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -60,26 +60,16 @@ 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_GETPROPERTY)
-NS_IMETHODIMP XPC_MAP_CLASSNAME::GetProperty(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, jsid id, JS::Value * vp, bool* _retval)
-    {NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
-#endif
-
-#if !((XPC_MAP_FLAGS) & XPC_SCRIPTABLE_WANT_SETPROPERTY)
-NS_IMETHODIMP XPC_MAP_CLASSNAME::SetProperty(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, jsid id, JS::Value * vp, bool* _retval)
-    {NS_WARNING("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_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;}
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -691,39 +691,16 @@ XPC_WN_MaybeResolvingDeletePropertyStub(
     bool retval = true;                                                       \
     nsresult rv = wrapper->GetScriptable()->
 
 #define POST_HELPER_STUB                                                      \
     if (NS_FAILED(rv))                                                        \
         return Throw(rv, cx);                                                 \
     return retval;
 
-#define POST_HELPER_STUB_WITH_OBJECTOPRESULT(failMethod)                      \
-    if (NS_FAILED(rv))                                                        \
-        return Throw(rv, cx);                                                 \
-    return retval ? result.succeed() : result.failMethod();
-
-bool
-XPC_WN_Helper_GetProperty(JSContext* cx, HandleObject obj, HandleId id,
-                          MutableHandleValue vp)
-{
-    PRE_HELPER_STUB
-    GetProperty(wrapper, cx, obj, id, vp.address(), &retval);
-    POST_HELPER_STUB
-}
-
-bool
-XPC_WN_Helper_SetProperty(JSContext* cx, HandleObject obj, HandleId id,
-                          MutableHandleValue vp, ObjectOpResult& result)
-{
-    PRE_HELPER_STUB
-    SetProperty(wrapper, cx, obj, id, vp.address(), &retval);
-    POST_HELPER_STUB_WITH_OBJECTOPRESULT(failReadOnly)
-}
-
 bool
 XPC_WN_Helper_Call(JSContext* cx, unsigned argc, Value* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     // N.B. we want obj to be the callee, not JS_THIS(cx, vp)
     RootedObject obj(cx, &args.callee());
 
     XPCCallContext ccx(cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),