Bug 1382964 - Part 2: Assert we're on the main thread in nsCSSValueTokenStream::operator==. r=xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Sat, 22 Jul 2017 10:11:06 +0800
changeset 613889 886f354f9b8e1e1ef303513faebecf8c44a4bfc6
parent 613888 5c61f935a91426078ead5c80a014874cb9723a69
child 613890 e91311c2bb53096bb13d811898f03084cfdf6b36
push id69872
push userbmo:cam@mcc.id.au
push dateSun, 23 Jul 2017 07:51:39 +0000
reviewersxidorn
bugs1382964
milestone56.0a1
Bug 1382964 - Part 2: Assert we're on the main thread in nsCSSValueTokenStream::operator==. r=xidorn This helps the heap write analysis believe that the nsCSSValue comparison that nsStyleUIReset::CalcDifference does (for mSpecifiedWindowTransform, which won't have nsCSSValueTokenStream values in it) is safe. MozReview-Commit-ID: 4JvPC735D7i
layout/style/nsCSSValue.h
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -1750,16 +1750,19 @@ struct nsCSSValueTokenStream final {
 
 private:
   // Private destructor, to discourage deletion outside of Release():
   ~nsCSSValueTokenStream();
 
 public:
   bool operator==(const nsCSSValueTokenStream& aOther) const
   {
+    // This is not safe to call OMT, due to the URI/Principal Equals calls.
+    MOZ_ASSERT(NS_IsMainThread());
+
     bool eq;
     return mPropertyID == aOther.mPropertyID &&
            mShorthandPropertyID == aOther.mShorthandPropertyID &&
            mTokenStream.Equals(aOther.mTokenStream) &&
            mLevel == aOther.mLevel &&
            (mBaseURI == aOther.mBaseURI ||
             (mBaseURI && aOther.mBaseURI &&
              NS_SUCCEEDED(mBaseURI->Equals(aOther.mBaseURI, &eq)) &&