Bug 1255840. Get rid of the AutoJSAPI usage in IDBFactory. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 14 Mar 2016 20:47:13 -0400
changeset 288669 3149ea08a83f3bd4041671f14316a946ab542f3c
parent 288668 9b9dde0705bdcd960e78bbab5083ae7a1543e33b
child 288670 007066bf36c62944e2ace4b1ec4e6346a325c3b8
push id30087
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:43:43 +0000
treeherdermozilla-central@5e14887312d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1255840
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1255840. Get rid of the AutoJSAPI usage in IDBFactory. r=khuey
dom/indexedDB/IDBFactory.cpp
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -719,35 +719,27 @@ IDBFactory::OpenInternal(nsIPrincipal* a
       }
       MOZ_ASSERT(threadLocal);
       MOZ_ASSERT(!threadLocal->mIndexedDBThreadLocal);
 
       threadLocal->mIndexedDBThreadLocal = newIDBThreadLocal.forget();
     }
   }
 
-  AutoJSAPI autoJS;
   RefPtr<IDBOpenDBRequest> request;
 
   if (mWindow) {
-    AutoJSContext cx;
-    if (NS_WARN_IF(!autoJS.Init(mWindow, cx))) {
-      IDB_REPORT_INTERNAL_ERR();
-      aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-      return nullptr;
-    }
-
-    JS::Rooted<JSObject*> scriptOwner(cx,
-                                      static_cast<nsGlobalWindow*>(reinterpret_cast<nsPIDOMWindow<nsISupports>*>(mWindow.get()))->FastGetGlobalJSObject());
+    JS::Rooted<JSObject*> scriptOwner(nsContentUtils::RootingCxForThread(),
+                                      nsGlobalWindow::Cast(mWindow.get())->FastGetGlobalJSObject());
     MOZ_ASSERT(scriptOwner);
 
     request = IDBOpenDBRequest::CreateForWindow(this, mWindow, scriptOwner);
   } else {
-    autoJS.Init(mOwningObject.get());
-    JS::Rooted<JSObject*> scriptOwner(autoJS.cx(), mOwningObject);
+    JS::Rooted<JSObject*> scriptOwner(nsContentUtils::RootingCxForThread(),
+                                      mOwningObject);
 
     request = IDBOpenDBRequest::CreateForJS(this, scriptOwner);
     if (!request) {
       MOZ_ASSERT(!NS_IsMainThread());
       aRv.ThrowUncatchableException();
       return nullptr;
     }
   }