Bug 1324330 (part 2) - Make XPC_MAP_FLAGS non-optional when using xpc_map_end.h. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 23 Dec 2016 08:30:22 +1100
changeset 328513 5b05e5a264b4a5e8e8aabdcf7198bf541f618cb4
parent 328512 a8921eeffbb3e0b4fe67041281b5e23f92eab270
child 328514 a193a2da927441688192f9ee07db640e51d0120b
push id31175
push usercbook@mozilla.com
push dateMon, 09 Jan 2017 09:33:22 +0000
treeherdermozilla-central@701868bfddcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1324330
milestone53.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 1324330 (part 2) - Make XPC_MAP_FLAGS non-optional when using xpc_map_end.h. r=mccr8. I'd like to remove XPC_MAP_WANT_* altogether and use XPC_MAP_FLAGS for all the nsIXPCScriptable flag setting, but I haven't worked out how to handle the method definitions in xpc_map_end.h yet. In the meantime, it seems good to make the flag setting more consistent and explicit. In particular, the three "Module" classes have "#define XPC_MAP_WANT_CALL" and "#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL" which both have the same effect. The patch removes the latter, to make them consistent with other classes.
js/xpconnect/public/xpc_map_end.h
js/xpconnect/src/XPCComponents.cpp
toolkit/components/ctypes/ctypes.cpp
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/reflect/reflect.cpp
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -10,16 +10,20 @@
 #ifndef XPC_MAP_CLASSNAME
 #error "Must #define XPC_MAP_CLASSNAME before #including xpc_map_end.h"
 #endif
 
 #ifndef XPC_MAP_QUOTED_CLASSNAME
 #error "Must #define XPC_MAP_QUOTED_CLASSNAME before #including xpc_map_end.h"
 #endif
 
+#ifndef XPC_MAP_FLAGS
+#error "Must #define XPC_MAP_FLAGS before #including xpc_map_end.h"
+#endif
+
 #include "js/Id.h"
 
 /**************************************************************/
 
 NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(char * *aClassName)
 {
     static const char sName[] = XPC_MAP_QUOTED_CLASSNAME;
     *aClassName = (char*) nsMemory::Clone(sName, sizeof(sName));
@@ -176,11 +180,9 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCre
 #ifdef XPC_MAP_WANT_CONSTRUCT
 #undef XPC_MAP_WANT_CONSTRUCT
 #endif
 
 #ifdef XPC_MAP_WANT_HASINSTANCE
 #undef XPC_MAP_WANT_HASINSTANCE
 #endif
 
-#ifdef XPC_MAP_FLAGS
 #undef XPC_MAP_FLAGS
-#endif
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -3539,16 +3539,17 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents)
     NS_IMPL_QUERY_CLASSINFO(nsXPCComponents)
 NS_INTERFACE_MAP_END_INHERITING(nsXPCComponentsBase)
 NS_IMPL_CI_INTERFACE_GETTER(nsXPCComponents, nsIXPCComponents)
 
 // The nsIXPCScriptable map declaration that will generate stubs for us
 #define XPC_MAP_CLASSNAME           ComponentsSH
 #define XPC_MAP_QUOTED_CLASSNAME   "nsXPCComponents"
 #define                             XPC_MAP_WANT_PRECREATE
+#define XPC_MAP_FLAGS               0
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 ComponentsSH::PreCreate(nsISupports* nativeObj, JSContext* cx, JSObject* globalObj, JSObject** parentObj)
 {
   nsXPCComponentsBase* self = static_cast<nsXPCComponentsBase*>(nativeObj);
   // this should never happen
   if (!self->GetScope()) {
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -53,17 +53,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 static bool
 SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
 {
   JS::Rooted<JS::Value> prop(cx);
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -28,17 +28,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 static bool
 SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
 {
   JS::Rooted<JS::Value> prop(cx);
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -26,17 +26,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 NS_IMETHODIMP
 Module::Call(nsIXPConnectWrappedNative* wrapper,
              JSContext* cx,
              JSObject* obj,
              const JS::CallArgs& args,
              bool* _retval)