Bug 1017862 - Remove virtual destructor from BaseProxyHandler. (r=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Thu, 28 Aug 2014 13:30:56 -0700
changeset 223892 0d417381e4872a53e9d28ee188b96887cbc6157c
parent 223891 45065d014c6c56c469c865d9d4dfbaef5189bd1b
child 223893 2692c5ae8581563a8865fb0910042ddbeb3e539f
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1017862
milestone34.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 1017862 - Remove virtual destructor from BaseProxyHandler. (r=jorendorff)
js/ipc/WrapperOwner.cpp
js/src/jsproxy.cpp
js/src/jsproxy.h
js/src/jswrapper.cpp
js/src/jswrapper.h
js/xpconnect/wrappers/AddonWrapper.cpp
js/xpconnect/wrappers/AddonWrapper.h
js/xpconnect/wrappers/FilteringWrapper.cpp
js/xpconnect/wrappers/FilteringWrapper.h
js/xpconnect/wrappers/WaiveXrayWrapper.cpp
js/xpconnect/wrappers/WaiveXrayWrapper.h
js/xpconnect/wrappers/XrayWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.h
--- a/js/ipc/WrapperOwner.cpp
+++ b/js/ipc/WrapperOwner.cpp
@@ -45,17 +45,16 @@ WrapperOwner::idOf(JSObject *obj)
     return objId;
 }
 
 class CPOWProxyHandler : public BaseProxyHandler
 {
   public:
     CPOWProxyHandler()
       : BaseProxyHandler(&family) {}
-    virtual ~CPOWProxyHandler() {}
 
     virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE {
         return false;
     }
 
     virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                        MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -85,20 +85,16 @@ js::assertEnteredPolicy(JSContext *cx, J
 
 BaseProxyHandler::BaseProxyHandler(const void *family, bool hasPrototype, bool hasSecurityPolicy)
   : mFamily(family),
     mHasPrototype(hasPrototype),
     mHasSecurityPolicy(hasSecurityPolicy)
 {
 }
 
-BaseProxyHandler::~BaseProxyHandler()
-{
-}
-
 bool
 BaseProxyHandler::enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act,
                         bool *bp) const
 {
     *bp = true;
     return true;
 }
 
@@ -757,17 +753,16 @@ ArrayToIdVector(JSContext *cx, const Val
 
 namespace {
 
 /* Derived class for all scripted indirect proxy handlers. */
 class ScriptedIndirectProxyHandler : public BaseProxyHandler
 {
   public:
     ScriptedIndirectProxyHandler();
-    virtual ~ScriptedIndirectProxyHandler();
 
     /* ES5 Harmony fundamental proxy traps. */
     virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                        MutableHandle<PropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                           MutableHandle<PropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
@@ -821,20 +816,16 @@ static const Class CallConstructHolder =
 // This variable exists solely to provide a unique address for use as an identifier.
 const char ScriptedIndirectProxyHandler::family = 0;
 
 ScriptedIndirectProxyHandler::ScriptedIndirectProxyHandler()
         : BaseProxyHandler(&family)
 {
 }
 
-ScriptedIndirectProxyHandler::~ScriptedIndirectProxyHandler()
-{
-}
-
 bool
 ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy,
                                            bool *extensible) const
 {
     // Scripted indirect proxies don't support extensibility changes.
     *extensible = true;
     return true;
 }
@@ -1074,17 +1065,16 @@ ScriptedIndirectProxyHandler::fun_toStri
 }
 
 const ScriptedIndirectProxyHandler ScriptedIndirectProxyHandler::singleton;
 
 /* Derived class for all scripted direct proxy handlers. */
 class ScriptedDirectProxyHandler : public DirectProxyHandler {
   public:
     ScriptedDirectProxyHandler();
-    virtual ~ScriptedDirectProxyHandler();
 
     /* ES5 Harmony fundamental proxy traps. */
     virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                        MutableHandle<PropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                           MutableHandle<PropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
@@ -1387,20 +1377,16 @@ ArrayToIdVector(JSContext *cx, HandleObj
     return true;
 }
 
 ScriptedDirectProxyHandler::ScriptedDirectProxyHandler()
         : DirectProxyHandler(&family)
 {
 }
 
-ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler()
-{
-}
-
 // ES6 (22 May, 2014) 9.5.4 Proxy.[[PreventExtensions]]()
 bool
 ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const
 {
     // step 1
     RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
 
     // step 2
--- a/js/src/jsproxy.h
+++ b/js/src/jsproxy.h
@@ -122,17 +122,16 @@ class JS_FRIEND_API(BaseProxyHandler)
      * the object. In the case of wrappers, this distinction is used to
      * determine whether the caller may strip off the wrapper if it so desires.
      */
     bool mHasSecurityPolicy;
 
   public:
     explicit BaseProxyHandler(const void *family, bool hasPrototype = false,
                               bool hasSecurityPolicy = false);
-    virtual ~BaseProxyHandler();
 
     bool hasPrototype() const {
         return mHasPrototype;
     }
 
     bool hasSecurityPolicy() const {
         return mHasSecurityPolicy;
     }
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -129,20 +129,16 @@ js::IsCrossCompartmentWrapper(JSObject *
 }
 
 Wrapper::Wrapper(unsigned flags, bool hasPrototype, bool hasSecurityPolicy)
   : DirectProxyHandler(&family, hasPrototype, hasSecurityPolicy),
     mFlags(flags)
 {
 }
 
-Wrapper::~Wrapper()
-{
-}
-
 const char Wrapper::family = 0;
 const Wrapper Wrapper::singleton((unsigned)0);
 const Wrapper Wrapper::singletonWithPrototype((unsigned)0, true);
 JSObject *Wrapper::defaultProto = TaggedProto::LazyProto;
 
 /* Compartments. */
 
 extern JSObject *
@@ -173,20 +169,16 @@ ErrorCopier::~ErrorCopier()
 /* Cross compartment wrappers. */
 
 CrossCompartmentWrapper::CrossCompartmentWrapper(unsigned flags, bool hasPrototype,
                                                  bool hasSecurityPolicy)
   : Wrapper(CROSS_COMPARTMENT | flags, hasPrototype, hasSecurityPolicy)
 {
 }
 
-CrossCompartmentWrapper::~CrossCompartmentWrapper()
-{
-}
-
 bool Wrapper::finalizeInBackground(Value priv) const
 {
     if (!priv.isObject())
         return true;
 
     /*
      * Make the 'background-finalized-ness' of the wrapper the same as the
      * wrapped object, to allow transplanting between them.
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -78,18 +78,16 @@ class JS_FRIEND_API(Wrapper) : public Di
     static JSObject *wrappedObject(JSObject *wrapper);
 
     unsigned flags() const {
         return mFlags;
     }
 
     explicit Wrapper(unsigned flags, bool hasPrototype = false, bool hasSecurityPolicy = false);
 
-    virtual ~Wrapper();
-
     virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE;
 
     static const char family;
     static const Wrapper singleton;
     static const Wrapper singletonWithPrototype;
 
     static JSObject *defaultProto;
 };
@@ -102,18 +100,16 @@ WrapperOptions::proto() const
 
 /* Base class for all cross compartment wrapper handlers. */
 class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
 {
   public:
     explicit CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false,
                                      bool hasSecurityPolicy = false);
 
-    virtual ~CrossCompartmentWrapper();
-
     /* ES5 Harmony fundamental wrapper traps. */
     virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
                                        MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
                                           MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
                                 MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
--- a/js/xpconnect/wrappers/AddonWrapper.cpp
+++ b/js/xpconnect/wrappers/AddonWrapper.cpp
@@ -67,21 +67,16 @@ Interpose(JSContext *cx, HandleObject ta
 }
 
 template<typename Base>
 AddonWrapper<Base>::AddonWrapper(unsigned flags) : Base(flags)
 {
 }
 
 template<typename Base>
-AddonWrapper<Base>::~AddonWrapper()
-{
-}
-
-template<typename Base>
 bool
 AddonWrapper<Base>::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,
                                           HandleId id, MutableHandle<JSPropertyDescriptor> desc) const
 {
     if (!Interpose(cx, wrapper, nullptr, id, desc))
         return false;
 
     if (desc.object())
--- a/js/xpconnect/wrappers/AddonWrapper.h
+++ b/js/xpconnect/wrappers/AddonWrapper.h
@@ -18,17 +18,16 @@ namespace xpc {
 bool
 Interpose(JSContext *cx, JS::HandleObject target, const nsIID *iid, JS::HandleId id,
           JS::MutableHandle<JSPropertyDescriptor> descriptor);
 
 template<typename Base>
 class AddonWrapper : public Base {
   public:
     AddonWrapper(unsigned flags);
-    virtual ~AddonWrapper();
 
     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                        JS::Handle<jsid> id,
                                        JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                           JS::Handle<jsid> id,
                                           JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
 
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -16,21 +16,16 @@ using namespace js;
 
 namespace xpc {
 
 template <typename Base, typename Policy>
 FilteringWrapper<Base, Policy>::FilteringWrapper(unsigned flags) : Base(flags)
 {
 }
 
-template <typename Base, typename Policy>
-FilteringWrapper<Base, Policy>::~FilteringWrapper()
-{
-}
-
 template <typename Policy>
 static bool
 Filter(JSContext *cx, HandleObject wrapper, AutoIdVector &props)
 {
     size_t w = 0;
     RootedId id(cx);
     for (size_t n = 0; n < props.length(); ++n) {
         id = props[n];
@@ -189,20 +184,16 @@ FilteringWrapper<Base, Policy>::enter(JS
     *bp = true;
     return true;
 }
 
 CrossOriginXrayWrapper::CrossOriginXrayWrapper(unsigned flags) : SecurityXrayDOM(flags)
 {
 }
 
-CrossOriginXrayWrapper::~CrossOriginXrayWrapper()
-{
-}
-
 bool
 CrossOriginXrayWrapper::getPropertyDescriptor(JSContext *cx,
                                               JS::Handle<JSObject*> wrapper,
                                               JS::Handle<jsid> id,
                                               JS::MutableHandle<JSPropertyDescriptor> desc) const
 {
     if (!SecurityXrayDOM::getPropertyDescriptor(cx, wrapper, id, desc))
         return false;
--- a/js/xpconnect/wrappers/FilteringWrapper.h
+++ b/js/xpconnect/wrappers/FilteringWrapper.h
@@ -19,17 +19,16 @@ class AutoIdVector;
 }
 
 namespace xpc {
 
 template <typename Base, typename Policy>
 class FilteringWrapper : public Base {
   public:
     FilteringWrapper(unsigned flags);
-    virtual ~FilteringWrapper();
 
     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                        JS::Handle<jsid> id,
                                        JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                           JS::Handle<jsid> id,
                                           JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject*> wrapper,
@@ -55,17 +54,16 @@ class FilteringWrapper : public Base {
 /*
  * The HTML5 spec mandates very particular object behavior for cross-origin DOM
  * objects (Window and Location), some of which runs contrary to the way that
  * other XrayWrappers behave. We use this class to implement those semantics.
  */
 class CrossOriginXrayWrapper : public SecurityXrayDOM {
   public:
     CrossOriginXrayWrapper(unsigned flags);
-    virtual ~CrossOriginXrayWrapper();
 
     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                        JS::Handle<jsid> id,
                                        JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                           JS::Handle<jsid> id,
                                           JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
 
--- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp
+++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp
@@ -30,20 +30,16 @@ WaiveAccessors(JSContext *cx, JS::Mutabl
     }
     return true;
 }
 
 WaiveXrayWrapper::WaiveXrayWrapper(unsigned flags) : js::CrossCompartmentWrapper(flags)
 {
 }
 
-WaiveXrayWrapper::~WaiveXrayWrapper()
-{
-}
-
 bool
 WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper,
                                         HandleId id, JS::MutableHandle<JSPropertyDescriptor> desc)
                                         const
 {
     return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc) &&
            WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc);
 }
--- a/js/xpconnect/wrappers/WaiveXrayWrapper.h
+++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h
@@ -11,17 +11,16 @@
 
 #include "jswrapper.h"
 
 namespace xpc {
 
 class WaiveXrayWrapper : public js::CrossCompartmentWrapper {
   public:
     WaiveXrayWrapper(unsigned flags);
-    virtual ~WaiveXrayWrapper();
 
     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                        JS::Handle<jsid> id,
                                        JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
                                           JS::Handle<jsid> id,
                                           JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool get(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> receiver,
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -2245,21 +2245,16 @@ DOMXrayTraits::createHolder(JSContext *c
 }
 
 template <typename Base, typename Traits>
 XrayWrapper<Base, Traits>::XrayWrapper(unsigned flags)
   : Base(flags | WrapperFactory::IS_XRAY_WRAPPER_FLAG, /* hasPrototype = */ Traits::HasPrototype)
 {
 }
 
-template <typename Base, typename Traits>
-XrayWrapper<Base, Traits>::~XrayWrapper()
-{
-}
-
 namespace XrayUtils {
 
 JSObject *
 GetNativePropertiesObject(JSContext *cx, JSObject *wrapper)
 {
     MOZ_ASSERT(js::IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper),
                "bad object passed in");
 
--- a/js/xpconnect/wrappers/XrayWrapper.h
+++ b/js/xpconnect/wrappers/XrayWrapper.h
@@ -63,17 +63,16 @@ enum XrayType {
 XrayType GetXrayType(JSObject *obj);
 XrayTraits* GetXrayTraits(JSObject *obj);
 
 // NB: Base *must* derive from JSProxyHandler
 template <typename Base, typename Traits = XPCWrappedNativeXrayTraits >
 class XrayWrapper : public Base {
   public:
     XrayWrapper(unsigned flags);
-    virtual ~XrayWrapper();
 
     /* Fundamental proxy traps. */
     virtual bool isExtensible(JSContext *cx, JS::Handle<JSObject*> wrapper, bool *extensible) const MOZ_OVERRIDE;
     virtual bool preventExtensions(JSContext *cx, JS::Handle<JSObject*> wrapper) const MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
                                        JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
                                           JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;