Bug 1330018, part 2 - Only strongly root CPOWs in the child when debugging dead CPOWs. r=mrbkap
It looks like this was only added in
bug 1311212 to avoid false
positives in the dead CPOW debugging mode. However, with e10s-multi it
causes windows to be intermittently held alive a little longer, which
causes the Mochitest browser-chrome window leak detector to report
leaks. We avoid this by only doing this rooting when dead CPOW
debugging is enabled.
MozReview-Commit-ID: 4iOZPZtTfcK
--- a/js/ipc/JavaScriptChild.cpp
+++ b/js/ipc/JavaScriptChild.cpp
@@ -31,30 +31,34 @@ TraceChild(JSTracer* trc, void* data)
{
static_cast<JavaScriptChild*>(data)->trace(trc);
}
JavaScriptChild::~JavaScriptChild()
{
JSContext* cx = dom::danger::GetJSContext();
JS_RemoveWeakPointerZoneGroupCallback(cx, UpdateChildWeakPointersBeforeSweepingZoneGroup);
- JS_RemoveExtraGCRootsTracer(cx, TraceChild, this);
+ if (DeadCPOWDebuggingEnabled()) {
+ JS_RemoveExtraGCRootsTracer(cx, TraceChild, this);
+ }
}
bool
JavaScriptChild::init()
{
if (!WrapperOwner::init())
return false;
if (!WrapperAnswer::init())
return false;
JSContext* cx = dom::danger::GetJSContext();
JS_AddWeakPointerZoneGroupCallback(cx, UpdateChildWeakPointersBeforeSweepingZoneGroup, this);
- JS_AddExtraGCRootsTracer(cx, TraceChild, this);
+ if (DeadCPOWDebuggingEnabled()) {
+ JS_AddExtraGCRootsTracer(cx, TraceChild, this);
+ }
return true;
}
void
JavaScriptChild::trace(JSTracer* trc)
{
objects_.trace(trc, strongReferenceObjIdMinimum_);
}