Followup for bug 1246091 to fix the rooting hazard, get us closer to reopening the CLOSED TREE, and reduce philor's blood pressure.
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 23 Mar 2016 22:15:05 -0400
changeset 290235 ba45f257a090f833f8bc512cbcff74cd382b14f8
parent 290234 b9520981c35aae7ba1995cb5145899b880fc56f1
child 290236 c7192c4eecd0657907c4a40ac88db34298b6cc10
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1246091
milestone48.0a1
Followup for bug 1246091 to fix the rooting hazard, get us closer to reopening the CLOSED TREE, and reduce philor's blood pressure.
dom/base/Console.cpp
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -1490,16 +1490,18 @@ Console::PopulateConsoleObjectInTheTarge
                                                JSObject* aTargetScope,
                                                JS::MutableHandle<JS::Value> aEventValue,
                                                ConsoleCallData* aData) const
 {
   MOZ_ASSERT(aCx);
   MOZ_ASSERT(aData);
   MOZ_ASSERT(aTargetScope);
 
+  JS::Rooted<JSObject*> targetScope(aCx, aTargetScope);
+
   ConsoleStackEntry frame;
   if (aData->mTopStackFrame) {
     frame = *aData->mTopStackFrame;
   }
 
   ClearException ce(aCx);
   RootedDictionary<ConsoleEvent> event(aCx);
 
@@ -1585,17 +1587,17 @@ Console::PopulateConsoleObjectInTheTarge
                                         aData->mStopTimerStatus);
   }
 
   else if (aData->mMethodName == MethodCount) {
     event.mCounter = CreateCounterValue(aCx, aData->mCountLabel,
                                         aData->mCountValue);
   }
 
-  JSAutoCompartment ac2(aCx, aTargetScope);
+  JSAutoCompartment ac2(aCx, targetScope);
 
   if (NS_WARN_IF(!ToJSValue(aCx, event, aEventValue))) {
     return false;
   }
 
   JS::Rooted<JSObject*> eventObj(aCx, &aEventValue.toObject());
   if (NS_WARN_IF(!JS_DefineProperty(aCx, eventObj, "wrappedJSObject", eventObj,
                                     JSPROP_ENUMERATE))) {