Bug 1330018, part 2 - Only strongly root CPOWs in the child when debugging dead CPOWs. r=mrbkap draft
authorAndrew McCreight <continuation@gmail.com>
Thu, 12 Jan 2017 15:33:40 -0800
changeset 460327 1325512d023c68d5d6b70500181a7aa902d5d4a6
parent 460326 37a2d8a9d9c65932fd21b24934841f9c5cf377ed
child 542032 d4d8afb9bc8b1b1b6cf4bfd6a0dd4a58ff0c872c
push id41372
push userbmo:continuation@gmail.com
push dateFri, 13 Jan 2017 00:06:08 +0000
reviewersmrbkap
bugs1330018, 1311212
milestone53.0a1
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
js/ipc/JavaScriptChild.cpp
--- 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_);
 }