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
--- 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