Bug 1351200 - Part 1: stylo: Allow fetching prefs on servo traversal threads; r?froydnj draft
authorManish Goregaokar <manishearth@gmail.com>
Tue, 04 Apr 2017 11:11:27 -0700
changeset 559267 ebf16abe6d6f1ff27888029a221350a29b737e1d
parent 559154 2a3ecdb7d1ea814708021fee6735b3aedcf03e48
child 559268 c6689e36485b1ee6e0ce4ff344cde815369db04f
push id53032
push userbmo:manishearth@gmail.com
push dateSun, 09 Apr 2017 10:30:28 +0000
reviewersfroydnj
bugs1351200
milestone55.0a1
Bug 1351200 - Part 1: stylo: Allow fetching prefs on servo traversal threads; r?froydnj MozReview-Commit-ID: 7MMWyX1t5CR
modules/libpref/prefapi.cpp
--- a/modules/libpref/prefapi.cpp
+++ b/modules/libpref/prefapi.cpp
@@ -21,16 +21,17 @@
 
 #include "plstr.h"
 #include "PLDHashTable.h"
 #include "plbase64.h"
 #include "mozilla/ArenaAllocator.h"
 #include "mozilla/ArenaAllocatorExtensions.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MemoryReporting.h"
+#include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/PContent.h"
 #include "mozilla/dom/ContentPrefs.h"
 #include "nsQuickSort.h"
 #include "nsString.h"
 #include "nsPrintfCString.h"
 #include "prlink.h"
 
 using namespace mozilla;
@@ -757,17 +758,17 @@ inInitArray(const char* key)
     return BinarySearchIf(list, 0, prefsLen,
                           StringComparator(key), &found);
 }
 #endif
 
 PrefHashEntry* pref_HashTableLookup(const char *key)
 {
 #ifndef MOZ_B2G
-    MOZ_ASSERT(NS_IsMainThread());
+    MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal());
 #endif
     MOZ_ASSERT((!XRE_IsContentProcess() || gPhase != START),
                "pref access before commandline prefs set");
     /* If you're hitting this assertion, you've added a pref access to start up.
      * Consider moving it later or add it to the whitelist in ContentPrefs.cpp
      * and get review from a DOM peer
      */
 #ifdef DEBUG