Bug 887334 - Enter a compartment in indexedDB's ThreadLocalJSRuntime. r=bent
authorBobby Holley <bobbyholley@gmail.com>
Wed, 17 Jul 2013 11:53:54 -0700
changeset 138962 85bfca8bc62391d55b65e44f89c9ada313a00d06
parent 138961 9ddf00b075162269022d43ad8ccc77a0c371b79e
child 138963 7c93f74e004db9b6a11ad9b9b4202a893c719114
push id24977
push userryanvm@gmail.com
push dateFri, 19 Jul 2013 00:35:38 +0000
treeherdermozilla-central@0d0263a58f06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs887334
milestone25.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 887334 - Enter a compartment in indexedDB's ThreadLocalJSRuntime. r=bent
dom/indexedDB/IDBObjectStore.cpp
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -555,16 +555,21 @@ class ThreadLocalJSRuntime
     return entry;
   }
 
   JSContext *Context() const
   {
     return mContext;
   }
 
+  JSObject *Global() const
+  {
+    return mGlobal;
+  }
+
   ~ThreadLocalJSRuntime()
   {
     MOZ_COUNT_DTOR(ThreadLocalJSRuntime);
 
     if (mContext) {
       JS_DestroyContext(mContext);
     }
 
@@ -4028,16 +4033,17 @@ CreateIndexHelper::InsertDataFromObjectS
     tlsEntry = ThreadLocalJSRuntime::Create();
     NS_ENSURE_TRUE(tlsEntry, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
     PR_SetThreadPrivate(sTLSIndex, tlsEntry);
   }
 
   JSContext* cx = tlsEntry->Context();
   JSAutoRequest ar(cx);
+  JSAutoCompartment ac(cx, tlsEntry->Global());
 
   do {
     StructuredCloneReadInfo cloneReadInfo;
     rv = IDBObjectStore::GetStructuredCloneReadInfoFromStatement(stmt, 1, 2,
       mDatabase, cloneReadInfo);
     NS_ENSURE_SUCCESS(rv, rv);
 
     JSAutoStructuredCloneBuffer& buffer = cloneReadInfo.mCloneBuffer;