Bug 1260247. In chaos mode randomly decide to start a new image load even if the image is in the image cache when allowed by spec. r=seth

If the image load is from the same document that cached the image we are required to use the cached version. Otherwise we should be free to ignore the cached version.
This commit is contained in:
Timothy Nikkel 2016-04-02 13:53:12 -05:00
parent 1144ba9c95
commit 6aeb6d5d05
2 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Move.h"
#include "mozilla/Preferences.h"
#include "mozilla/ChaosMode.h"
#include "ImageLogging.h"
#include "nsPrintfCString.h"
@ -1772,6 +1773,12 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry,
return false;
}
if (MOZ_UNLIKELY(ChaosMode::isActive(ChaosFeature::ImageCache))) {
if (ChaosMode::randomUint32LessThan(4) < 1) {
return false;
}
}
// Determine whether the cache aEntry must be revalidated...
validateRequest = ShouldRevalidateEntry(aEntry, aLoadFlags, hasExpired);

View File

@ -27,6 +27,8 @@ enum ChaosFeature {
IOAmounts = 0x8,
// Iterate over hash tables in random order.
HashTableIteration = 0x10,
// Randomly refuse to use cached version of image (when allowed by spec).
ImageCache = 0x20,
Any = 0xffffffff,
};