Bug 887334 - Enter a compartment in indexedDB's ThreadLocalJSRuntime. r=bent
☠☠ backed out by b3d0c2498b42 ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Fri, 26 Jul 2013 18:56:57 -0700
changeset 148104 6844870765b114d44bef1e330ac03e99ac9c2e27
parent 148103 ff3db04a7caa15a4170955f8c66ee2832fa4606e
child 148105 5db330103fbe1013d65d21a5843828b83e37cf93
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs887334
milestone24.0a2
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;