Bug 1404222 Part 3: Define a new imgILoader flag to indicate delay of the load event until decode.
MozReview-Commit-ID: jmUkyh0mM0
--- a/image/imgILoader.idl
+++ b/image/imgILoader.idl
@@ -30,16 +30,22 @@ interface nsISimpleEnumerator;
[scriptable, builtinclass, uuid(e61377d2-910e-4c65-a64b-428d150e1fd1)]
interface imgILoader : nsISupports
{
// Extra flags to pass to loadImage if you want a load to use CORS
// validation.
const unsigned long LOAD_CORS_ANONYMOUS = 1 << 16;
const unsigned long LOAD_CORS_USE_CREDENTIALS = 1 << 17;
+ // Extra flag to pass to loadImage if you want the load event
+ // delayed until the image is fully decoded, treating this image's
+ // contents -- not just its metadata -- as part of its listeners'
+ // "dependent resources".
+ const unsigned long DELAY_LOAD_EVENT_UNTIL_DECODE = 1 << 18;
+
/**
* Start the load and decode of an image.
* @param aURI the URI to load
* @param aInitialDocumentURI the URI that 'initiated' the load -- used for
* 3rd party cookie blocking
* @param aReferrerURI the 'referring' URI
* @param aReferrerPolicy the policy to apply to sending referrers.
* examples: "default", "never", "always", "origin"
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -2262,16 +2262,21 @@ imgLoader::LoadImage(nsIURI* aURI,
requestFlags = (requestFlags & ~LOAD_FLAGS_VALIDATE_MASK) |
(aLoadFlags & LOAD_FLAGS_VALIDATE_MASK);
}
if (aLoadFlags & nsIRequest::LOAD_BACKGROUND) {
// Propagate background loading...
requestFlags |= nsIRequest::LOAD_BACKGROUND;
}
+ if (aLoadFlags & imgILoader::DELAY_LOAD_EVENT_UNTIL_DECODE) {
+ // Propagate delay of the load event...
+ requestFlags |= imgILoader::DELAY_LOAD_EVENT_UNTIL_DECODE;
+ }
+
int32_t corsmode = imgIRequest::CORS_NONE;
if (aLoadFlags & imgILoader::LOAD_CORS_ANONYMOUS) {
corsmode = imgIRequest::CORS_ANONYMOUS;
} else if (aLoadFlags & imgILoader::LOAD_CORS_USE_CREDENTIALS) {
corsmode = imgIRequest::CORS_USE_CREDENTIALS;
}
RefPtr<imgCacheEntry> entry;