Bug 975052. r=smaug
authorKyle Huey <khuey@kylehuey.com>
Wed, 26 Feb 2014 11:00:40 -0800
changeset 171054 36b02f8ee7738ad84a968cafd7fd4e17aa7693f7
parent 171053 953f462e19acb0d48c0d8f5b99ec05fddf219ecd
child 171055 a4c3a2e400b272a3b5d66c502cb37a7b62c76576
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975052
milestone30.0a1
Bug 975052. r=smaug
dom/bindings/BindingUtils.h
dom/workers/WorkerScope.cpp
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -17,17 +17,16 @@
 #include "mozilla/dom/DOMJSClass.h"
 #include "mozilla/dom/DOMJSProxyHandler.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/NonRefcountedDOMObject.h"
 #include "mozilla/dom/Nullable.h"
 #include "mozilla/dom/RootedDictionary.h"
 #include "mozilla/dom/workers/Workers.h"
 #include "mozilla/ErrorResult.h"
-#include "mozilla/HoldDropJSObjects.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
 #include "nsCycleCollector.h"
 #include "nsIXPConnect.h"
 #include "MainThreadUtils.h"
 #include "nsTraceRefcnt.h"
 #include "qsObjectHelper.h"
 #include "xpcpublic.h"
@@ -2422,17 +2421,19 @@ CreateGlobal(JSContext* aCx, T* aObject,
   JS::Handle<JSObject*> proto = ProtoGetter(aCx, global);
   NS_ENSURE_TRUE(proto, nullptr);
 
   if (!JS_SetPrototype(aCx, global, proto)) {
     NS_WARNING("Failed to set proto");
     return nullptr;
   }
 
-  mozilla::HoldJSObjects(aObject);
+  MOZ_ALWAYS_TRUE(TryPreserveWrapper(global));
+
+  MOZ_ASSERT(UnwrapDOMObjectToISupports(global));
 
   return global;
 }
 
 /*
  * Holds a jsid that is initialized to an interned string, with conversion to
  * Handle<jsid>.
  */
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -37,18 +37,17 @@ WorkerGlobalScope::WorkerGlobalScope(Wor
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   SetIsDOMBinding();
 }
 
 WorkerGlobalScope::~WorkerGlobalScope()
 {
-  // Matches the HoldJSObjects in CreateGlobal.
-  mozilla::DropJSObjects(this);
+  mWorkerPrivate->AssertIsOnWorkerThread();
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(WorkerGlobalScope)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WorkerGlobalScope,
                                                   nsDOMEventTargetHelper)
   tmp->mWorkerPrivate->AssertIsOnWorkerThread();
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END