Bug 921454 - Use background-finalize-ity forwarding for all wrappers, not just CCWs. r=jonco
The current setup allows mismatches for same compartment wrappers, which causes
us to assert when transplanting them.
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -169,17 +169,17 @@ CrossCompartmentWrapper::CrossCompartmen
: Wrapper(CROSS_COMPARTMENT | flags, hasPrototype)
{
}
CrossCompartmentWrapper::~CrossCompartmentWrapper()
{
}
-bool CrossCompartmentWrapper::finalizeInBackground(Value priv)
+bool Wrapper::finalizeInBackground(Value priv)
{
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
@@ -61,30 +61,30 @@ class JS_FRIEND_API(Wrapper) : public Di
unsigned flags() const {
return mFlags;
}
explicit Wrapper(unsigned flags, bool hasPrototype = false);
virtual ~Wrapper();
+ virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE;
+
static Wrapper singleton;
static Wrapper singletonWithPrototype;
};
/* Base class for all cross compartment wrapper handlers. */
class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
{
public:
CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false);
virtual ~CrossCompartmentWrapper();
- virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE;
-
/* ES5 Harmony fundamental wrapper traps. */
virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE;
virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
MutableHandle<JSPropertyDescriptor> desc,
unsigned flags) MOZ_OVERRIDE;