Bug 1213391. Unmark gray things before putting them into function reserved slots in Promise code. r=mccr8 a=lizzard
☠☠ backed out by 6d377ae1c22d ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 09 Oct 2015 16:48:10 -0400
changeset 296402 369aac182bf6dc4a14d0921890e916f8fddee2a6
parent 296401 01e92f8049ccc5abe2de2097688844aff37bb159
child 296403 ca97cca1a50ceaaebcf0773b5a1cdc1236125296
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, lizzard
bugs1213391
milestone43.0a2
Bug 1213391. Unmark gray things before putting them into function reserved slots in Promise code. r=mccr8 a=lizzard
dom/promise/Promise.cpp
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -349,19 +349,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Pro
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mAllocationStack)
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mRejectionStack)
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mFullfillmentStack)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(Promise)
   if (tmp->IsBlack()) {
-    if (tmp->mResult.isObject()) {
-      JS::ExposeObjectToActiveJS(&(tmp->mResult.toObject()));
-    }
+    JS::ExposeValueToActiveJS(tmp->mResult);
     if (tmp->mAllocationStack) {
       JS::ExposeObjectToActiveJS(tmp->mAllocationStack);
     }
     if (tmp->mRejectionStack) {
       JS::ExposeObjectToActiveJS(tmp->mRejectionStack);
     }
     if (tmp->mFullfillmentStack) {
       JS::ExposeObjectToActiveJS(tmp->mFullfillmentStack);
@@ -610,16 +608,17 @@ Promise::CreateFunction(JSContext* aCx, 
 
   JS::Rooted<JSObject*> obj(aCx, JS_GetFunctionObject(func));
 
   JS::Rooted<JS::Value> promiseObj(aCx);
   if (!dom::GetOrCreateDOMReflector(aCx, aPromise, &promiseObj)) {
     return nullptr;
   }
 
+  JS::ExposeValueToActiveJS(promiseObj);
   js::SetFunctionNativeReserved(obj, SLOT_PROMISE, promiseObj);
   js::SetFunctionNativeReserved(obj, SLOT_DATA, JS::Int32Value(aTask));
 
   return obj;
 }
 
 /* static */ JSObject*
 Promise::CreateThenableFunction(JSContext* aCx, Promise* aPromise, uint32_t aTask)
@@ -637,16 +636,17 @@ Promise::CreateThenableFunction(JSContex
 
   JS::Rooted<JSObject*> obj(aCx, JS_GetFunctionObject(func));
 
   JS::Rooted<JS::Value> promiseObj(aCx);
   if (!dom::GetOrCreateDOMReflector(aCx, aPromise, &promiseObj)) {
     return nullptr;
   }
 
+  JS::ExposeValueToActiveJS(promiseObj);
   js::SetFunctionNativeReserved(obj, SLOT_PROMISE, promiseObj);
 
   return obj;
 }
 
 /* static */ already_AddRefed<Promise>
 Promise::Constructor(const GlobalObject& aGlobal, PromiseInit& aInit,
                      ErrorResult& aRv, JS::Handle<JSObject*> aDesiredProto)