diff --git a/image/ImageCacheKey.cpp b/image/ImageCacheKey.cpp index 33ba6ca4cbf4..861c11d3e619 100644 --- a/image/ImageCacheKey.cpp +++ b/image/ImageCacheKey.cpp @@ -86,8 +86,10 @@ bool ImageCacheKey::operator==(const ImageCacheKey& aOther) const { if (mBlobSerial || aOther.mBlobSerial) { - // If at least one of us has a blob serial, just compare those. - return mBlobSerial == aOther.mBlobSerial; + // If at least one of us has a blob serial, just compare the blob serial and + // the ref portion of the URIs. + return mBlobSerial == aOther.mBlobSerial && + mURI->HasSameRef(*aOther.mURI); } // For non-blob URIs, compare the URIs. @@ -109,8 +111,13 @@ ImageCacheKey::ComputeHash(ImageURL* aURI, if (aBlobSerial) { // For blob URIs, we hash the serial number of the underlying blob, so that - // different blob URIs which point to the same blob share a cache entry. - return HashGeneric(*aBlobSerial); + // different blob URIs which point to the same blob share a cache entry. We + // also include the ref portion of the URI to support -moz-samplesize and + // -moz-resolution, which require us to create different Image objects even + // if the source data is the same. + nsAutoCString ref; + aURI->GetRef(ref); + return HashGeneric(*aBlobSerial, HashString(ref)); } // For non-blob URIs, we hash the URI spec. diff --git a/image/ImageURL.h b/image/ImageURL.h index 4e5b34674bb3..dd72690fbd68 100644 --- a/image/ImageURL.h +++ b/image/ImageURL.h @@ -101,6 +101,11 @@ public: return mSpec == aOther.mSpec; } + bool HasSameRef(const ImageURL& aOther) const + { + return mRef == aOther.mRef; + } + private: // Since this is a basic storage class, no duplication of spec parsing is // included in the functionality. Instead, the class depends upon the diff --git a/image/test/reftest/blob/blob-uri-with-ref-param-notref.html b/image/test/reftest/blob/blob-uri-with-ref-param-notref.html new file mode 100644 index 000000000000..b909fd89082d --- /dev/null +++ b/image/test/reftest/blob/blob-uri-with-ref-param-notref.html @@ -0,0 +1,37 @@ + + + + +
+