Bug 608855 - Make compartment checks fatal in release builds. r=gal

This commit is contained in:
Jeff Walden 2010-11-01 16:54:21 -07:00
parent ca150eab9b
commit db9224e4da

View File

@ -519,7 +519,6 @@ class AutoNamespaceArray : protected AutoGCRooter {
JSXMLArray array;
};
#ifdef DEBUG
class CompartmentChecker
{
private:
@ -538,7 +537,7 @@ class CompartmentChecker
*/
static void fail(JSCompartment *c1, JSCompartment *c2) {
printf("*** Compartment mismatch %p vs. %p\n", (void *) c1, (void *) c2);
JS_NOT_REACHED("compartment mismatched");
JS_Assert("compartment mismatched", __FILE__, __LINE__);
}
void check(JSCompartment *c) {
@ -605,8 +604,6 @@ class CompartmentChecker
void check(JSString *) { /* nothing for now */ }
};
#endif
/*
* Don't perform these checks when called from a finalizer. The checking
* depends on other objects not having been swept yet.
@ -619,56 +616,46 @@ class CompartmentChecker
template <class T1> inline void
assertSameCompartment(JSContext *cx, T1 t1)
{
#ifdef DEBUG
START_ASSERT_SAME_COMPARTMENT();
c.check(t1);
#endif
}
template <class T1, class T2> inline void
assertSameCompartment(JSContext *cx, T1 t1, T2 t2)
{
#ifdef DEBUG
START_ASSERT_SAME_COMPARTMENT();
c.check(t1);
c.check(t2);
#endif
}
template <class T1, class T2, class T3> inline void
assertSameCompartment(JSContext *cx, T1 t1, T2 t2, T3 t3)
{
#ifdef DEBUG
START_ASSERT_SAME_COMPARTMENT();
c.check(t1);
c.check(t2);
c.check(t3);
#endif
}
template <class T1, class T2, class T3, class T4> inline void
assertSameCompartment(JSContext *cx, T1 t1, T2 t2, T3 t3, T4 t4)
{
#ifdef DEBUG
START_ASSERT_SAME_COMPARTMENT();
c.check(t1);
c.check(t2);
c.check(t3);
c.check(t4);
#endif
}
template <class T1, class T2, class T3, class T4, class T5> inline void
assertSameCompartment(JSContext *cx, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
{
#ifdef DEBUG
START_ASSERT_SAME_COMPARTMENT();
c.check(t1);
c.check(t2);
c.check(t3);
c.check(t4);
c.check(t5);
#endif
}
#undef START_ASSERT_SAME_COMPARTMENT