Bug 1496629 - use RefPtr rather than nsCOMPtr to avoid data race. r=kmag
authorNathan Froyd <froydnj@mozilla.com>
Fri, 21 Dec 2018 11:03:30 -0500
changeset 451711 c43184f50b7ac431b0c8244af2d712a2a9492971
parent 451710 f711b70e09eeca944f980937988bea94c66dcdb0
child 451712 1442b1bf2d6da08f710dca4e8324ef63b477774b
push id35252
push userccoroiu@mozilla.com
push dateFri, 21 Dec 2018 21:56:22 +0000
treeherdermozilla-central@b23630094b9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1496629
milestone66.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 1496629 - use RefPtr rather than nsCOMPtr to avoid data race. r=kmag
js/xpconnect/loader/ScriptPreloader.h
--- a/js/xpconnect/loader/ScriptPreloader.h
+++ b/js/xpconnect/loader/ScriptPreloader.h
@@ -468,17 +468,20 @@ class ScriptPreloader : public nsIObserv
 
   RefPtr<ScriptPreloader> mChildCache;
   ScriptCacheChild* mChildActor = nullptr;
 
   nsString mBaseName;
   nsCString mContentStartupFinishedTopic;
 
   nsCOMPtr<nsIFile> mProfD;
-  nsCOMPtr<nsIThread> mSaveThread;
+  // Note: We use a RefPtr rather than an nsCOMPtr here because the
+  // AssertNoQueryNeeded checks done by getter_AddRefs happen at a time that
+  // violate data access invariants.
+  RefPtr<nsIThread> mSaveThread;
   nsCOMPtr<nsITimer> mSaveTimer;
 
   // The mmapped cache data from this session's cache file.
   AutoMemMap mCacheData;
 
   Monitor mMonitor;
   Monitor mSaveMonitor;
 };