Bug 1292930: Allow comparing unresolved URLValueDatas. draft
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Fri, 05 Aug 2016 11:57:31 -0700
changeset 397591 b151ff1f8a825f66d45017d6dd7a06eb7a257c3b
parent 397583 e2108f717e1b79119c9bc589caf89460242c1243
child 397592 926026dc647c51fc6725f16a79f585128590f494
push id25337
push userbmo:ealvarez@mozilla.com
push dateSat, 06 Aug 2016 22:18:29 +0000
bugs1292930
milestone51.0a1
Bug 1292930: Allow comparing unresolved URLValueDatas. This is used by the frame construction to know if it can skip recreating a frame based on the -moz-binding value. Other approach would be doing string comparison for each of the unresolved members or similar. MozReview-Commit-ID: 93A8DXP9ArI
layout/style/nsCSSValue.cpp
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -2569,18 +2569,21 @@ css::URLValueData::operator==(const URLV
             eq)) &&
           (mOriginPrincipal == aOther.mOriginPrincipal ||
            self.mOriginPrincipal.get()->Equals(other.mOriginPrincipal.get()));
 }
 
 bool
 css::URLValueData::URIEquals(const URLValueData& aOther) const
 {
-  MOZ_ASSERT(mURIResolved && aOther.mURIResolved,
-             "How do you know the URIs aren't null?");
+  if (MOZ_UNLIKELY(!mURIResolved || !aOther.mURIResolved)) {
+    NS_WARNING("Comparing unresolved URIs");
+    return false;
+  }
+
   bool eq;
   // Cast away const so we can call nsIPrincipal::Equals.
   auto& self = *const_cast<URLValueData*>(this);
   auto& other = const_cast<URLValueData&>(aOther);
   // Worth comparing GetURI() to aOther.GetURI() and mOriginPrincipal to
   // aOther.mOriginPrincipal, because in the (probably common) case when this
   // value was one of the ones that in fact did not change this will be our
   // fast path to equality