mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Backed out changeset 27d94573975d (bug 1628727) for causing build bustages in imgRequest.cpp CLOSED TREE
This commit is contained in:
parent
28f02fa444
commit
91e2985a09
@ -970,8 +970,8 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
|
|||||||
|
|
||||||
// Do the load.
|
// Do the load.
|
||||||
RefPtr<imgRequestProxy>& req = PrepareNextRequest(eImageLoadType_Normal);
|
RefPtr<imgRequestProxy>& req = PrepareNextRequest(eImageLoadType_Normal);
|
||||||
nsresult rv = loader->LoadImageWithChannel(aChannel, this, doc, aListener,
|
nsresult rv = loader->LoadImageWithChannel(aChannel, this, ToSupports(doc),
|
||||||
getter_AddRefs(req));
|
aListener, getter_AddRefs(req));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
CloneScriptedRequests(req);
|
CloneScriptedRequests(req);
|
||||||
TrackImage(req);
|
TrackImage(req);
|
||||||
|
@ -18,8 +18,6 @@ interface nsIReferrerInfo;
|
|||||||
|
|
||||||
interface nsISimpleEnumerator;
|
interface nsISimpleEnumerator;
|
||||||
|
|
||||||
webidl Document;
|
|
||||||
|
|
||||||
#include "nsIRequest.idl" // for nsLoadFlags
|
#include "nsIRequest.idl" // for nsLoadFlags
|
||||||
#include "nsIContentPolicy.idl" // for nsContentPolicyType
|
#include "nsIContentPolicy.idl" // for nsContentPolicyType
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ interface imgILoader : nsISupports
|
|||||||
* @param aLoadingPrincipal the principal of the loading document
|
* @param aLoadingPrincipal the principal of the loading document
|
||||||
* @param aLoadGroup Loadgroup to put the image load into
|
* @param aLoadGroup Loadgroup to put the image load into
|
||||||
* @param aObserver the observer (may be null)
|
* @param aObserver the observer (may be null)
|
||||||
* @param aLoadingDocument loading document
|
* @param aCX some random data
|
||||||
* @param aLoadFlags Load flags for the request
|
* @param aLoadFlags Load flags for the request
|
||||||
* @param aCacheKey cache key to use for a load if the original
|
* @param aCacheKey cache key to use for a load if the original
|
||||||
* image came from a request that had post data
|
* image came from a request that had post data
|
||||||
@ -67,7 +65,7 @@ interface imgILoader : nsISupports
|
|||||||
in nsIPrincipal aLoadingPrincipal,
|
in nsIPrincipal aLoadingPrincipal,
|
||||||
in nsILoadGroup aLoadGroup,
|
in nsILoadGroup aLoadGroup,
|
||||||
in imgINotificationObserver aObserver,
|
in imgINotificationObserver aObserver,
|
||||||
in Document aLoadingDocument,
|
in nsISupports aCX,
|
||||||
in nsLoadFlags aLoadFlags,
|
in nsLoadFlags aLoadFlags,
|
||||||
in nsISupports cacheKey,
|
in nsISupports cacheKey,
|
||||||
[optional]
|
[optional]
|
||||||
@ -79,7 +77,7 @@ interface imgILoader : nsISupports
|
|||||||
* already be opened before this method is called, and there
|
* already be opened before this method is called, and there
|
||||||
* must have been no OnDataAvailable calls for it yet.
|
* must have been no OnDataAvailable calls for it yet.
|
||||||
* @param aObserver the observer (may be null)
|
* @param aObserver the observer (may be null)
|
||||||
* @param aLoadingDocument loading document
|
* @param cx some random data
|
||||||
* @param aListener [out]
|
* @param aListener [out]
|
||||||
* A listener that you must send the channel's notifications and data
|
* A listener that you must send the channel's notifications and data
|
||||||
* to. Can be null, in which case imagelib has found a cached image
|
* to. Can be null, in which case imagelib has found a cached image
|
||||||
@ -92,6 +90,6 @@ interface imgILoader : nsISupports
|
|||||||
*/
|
*/
|
||||||
imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel,
|
imgIRequest loadImageWithChannelXPCOM(in nsIChannel aChannel,
|
||||||
in imgINotificationObserver aObserver,
|
in imgINotificationObserver aObserver,
|
||||||
in Document aLoadingDocument,
|
in nsISupports cx,
|
||||||
out nsIStreamListener aListener);
|
out nsIStreamListener aListener);
|
||||||
};
|
};
|
||||||
|
@ -663,7 +663,7 @@ static bool ShouldRevalidateEntry(imgCacheEntry* aEntry, nsLoadFlags aFlags,
|
|||||||
|
|
||||||
/* Call content policies on cached images that went through a redirect */
|
/* Call content policies on cached images that went through a redirect */
|
||||||
static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
||||||
Document* aLoadingDocument,
|
nsISupports* aLoadingContext,
|
||||||
nsIPrincipal* aTriggeringPrincipal,
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsContentPolicyType aPolicyType,
|
nsContentPolicyType aPolicyType,
|
||||||
bool aSendCSPViolationReports) {
|
bool aSendCSPViolationReports) {
|
||||||
@ -681,9 +681,9 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
|||||||
aImgRequest->GetFinalURI(getter_AddRefs(contentLocation));
|
aImgRequest->GetFinalURI(getter_AddRefs(contentLocation));
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsINode> requestingNode = do_QueryInterface(aLoadingContext);
|
||||||
nsCOMPtr<nsIPrincipal> loadingPrincipal =
|
nsCOMPtr<nsIPrincipal> loadingPrincipal =
|
||||||
aLoadingDocument ? aLoadingDocument->NodePrincipal()
|
requestingNode ? requestingNode->NodePrincipal() : aTriggeringPrincipal;
|
||||||
: aTriggeringPrincipal;
|
|
||||||
// If there is no context and also no triggeringPrincipal, then we use a fresh
|
// If there is no context and also no triggeringPrincipal, then we use a fresh
|
||||||
// nullPrincipal as the loadingPrincipal because we can not create a loadinfo
|
// nullPrincipal as the loadingPrincipal because we can not create a loadinfo
|
||||||
// without a valid loadingPrincipal.
|
// without a valid loadingPrincipal.
|
||||||
@ -692,7 +692,7 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsILoadInfo> secCheckLoadInfo = new LoadInfo(
|
nsCOMPtr<nsILoadInfo> secCheckLoadInfo = new LoadInfo(
|
||||||
loadingPrincipal, aTriggeringPrincipal, aLoadingDocument,
|
loadingPrincipal, aTriggeringPrincipal, requestingNode,
|
||||||
nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK, aPolicyType);
|
nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK, aPolicyType);
|
||||||
|
|
||||||
secCheckLoadInfo->SetSendCSPViolationEvents(aSendCSPViolationReports);
|
secCheckLoadInfo->SetSendCSPViolationEvents(aSendCSPViolationReports);
|
||||||
@ -715,7 +715,7 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
|||||||
// the doc and the resource load is http: which would result in an incorrect
|
// the doc and the resource load is http: which would result in an incorrect
|
||||||
// mixed content warning.
|
// mixed content warning.
|
||||||
nsCOMPtr<nsIDocShell> docShell =
|
nsCOMPtr<nsIDocShell> docShell =
|
||||||
NS_CP_GetDocShellFromContext(ToSupports(aLoadingDocument));
|
NS_CP_GetDocShellFromContext(aLoadingContext);
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
Document* document = docShell->GetDocument();
|
Document* document = docShell->GetDocument();
|
||||||
if (document && document->GetUpgradeInsecureRequests(false)) {
|
if (document && document->GetUpgradeInsecureRequests(false)) {
|
||||||
@ -728,7 +728,7 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
|||||||
decision = nsIContentPolicy::REJECT_REQUEST;
|
decision = nsIContentPolicy::REJECT_REQUEST;
|
||||||
rv = nsMixedContentBlocker::ShouldLoad(insecureRedirect, aPolicyType,
|
rv = nsMixedContentBlocker::ShouldLoad(insecureRedirect, aPolicyType,
|
||||||
contentLocation, nullptr,
|
contentLocation, nullptr,
|
||||||
ToSupports(aLoadingDocument),
|
aLoadingContext,
|
||||||
EmptyCString(), // mime guess
|
EmptyCString(), // mime guess
|
||||||
aTriggeringPrincipal, &decision);
|
aTriggeringPrincipal, &decision);
|
||||||
if (NS_FAILED(rv) || !NS_CP_ACCEPTED(decision)) {
|
if (NS_FAILED(rv) || !NS_CP_ACCEPTED(decision)) {
|
||||||
@ -747,7 +747,7 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
|
|||||||
static bool ValidateSecurityInfo(imgRequest* request, bool forcePrincipalCheck,
|
static bool ValidateSecurityInfo(imgRequest* request, bool forcePrincipalCheck,
|
||||||
int32_t corsmode,
|
int32_t corsmode,
|
||||||
nsIPrincipal* triggeringPrincipal,
|
nsIPrincipal* triggeringPrincipal,
|
||||||
Document* aLoadingDocument,
|
nsISupports* aCX,
|
||||||
nsContentPolicyType aPolicyType,
|
nsContentPolicyType aPolicyType,
|
||||||
nsIReferrerInfo* aReferrerInfo) {
|
nsIReferrerInfo* aReferrerInfo) {
|
||||||
// If the referrer policy doesn't match, we can't use this request.
|
// If the referrer policy doesn't match, we can't use this request.
|
||||||
@ -796,8 +796,7 @@ static bool ValidateSecurityInfo(imgRequest* request, bool forcePrincipalCheck,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Content Policy Check on Cached Images
|
// Content Policy Check on Cached Images
|
||||||
return ShouldLoadCachedImage(request, aLoadingDocument, triggeringPrincipal,
|
return ShouldLoadCachedImage(request, aCX, triggeringPrincipal, aPolicyType,
|
||||||
aPolicyType,
|
|
||||||
/* aSendCSPViolationReports */ false);
|
/* aSendCSPViolationReports */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,7 +812,7 @@ static nsresult NewImageChannel(
|
|||||||
nsIURI* aInitialDocumentURI, int32_t aCORSMode,
|
nsIURI* aInitialDocumentURI, int32_t aCORSMode,
|
||||||
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
||||||
nsLoadFlags aLoadFlags, nsContentPolicyType aPolicyType,
|
nsLoadFlags aLoadFlags, nsContentPolicyType aPolicyType,
|
||||||
nsIPrincipal* aTriggeringPrincipal, nsINode* aRequestingNode,
|
nsIPrincipal* aTriggeringPrincipal, nsISupports* aRequestingContext,
|
||||||
bool aRespectPrivacy) {
|
bool aRespectPrivacy) {
|
||||||
MOZ_ASSERT(aResult);
|
MOZ_ASSERT(aResult);
|
||||||
|
|
||||||
@ -840,6 +839,8 @@ static nsresult NewImageChannel(
|
|||||||
// canceled too.
|
// canceled too.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
nsCOMPtr<nsINode> requestingNode = do_QueryInterface(aRequestingContext);
|
||||||
|
|
||||||
nsSecurityFlags securityFlags =
|
nsSecurityFlags securityFlags =
|
||||||
aCORSMode == imgIRequest::CORS_NONE
|
aCORSMode == imgIRequest::CORS_NONE
|
||||||
? nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS
|
? nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS
|
||||||
@ -855,8 +856,8 @@ static nsresult NewImageChannel(
|
|||||||
// node and a principal. This is for things like background images that are
|
// node and a principal. This is for things like background images that are
|
||||||
// specified by user stylesheets, where the document is being styled, but
|
// specified by user stylesheets, where the document is being styled, but
|
||||||
// the principal is that of the user stylesheet.
|
// the principal is that of the user stylesheet.
|
||||||
if (aRequestingNode && aTriggeringPrincipal) {
|
if (requestingNode && aTriggeringPrincipal) {
|
||||||
rv = NS_NewChannelWithTriggeringPrincipal(aResult, aURI, aRequestingNode,
|
rv = NS_NewChannelWithTriggeringPrincipal(aResult, aURI, requestingNode,
|
||||||
aTriggeringPrincipal,
|
aTriggeringPrincipal,
|
||||||
securityFlags, aPolicyType,
|
securityFlags, aPolicyType,
|
||||||
nullptr, // PerformanceStorage
|
nullptr, // PerformanceStorage
|
||||||
@ -1666,8 +1667,8 @@ void imgLoader::CheckCacheLimits(imgCacheTable& cache, imgCacheQueue& queue) {
|
|||||||
bool imgLoader::ValidateRequestWithNewChannel(
|
bool imgLoader::ValidateRequestWithNewChannel(
|
||||||
imgRequest* request, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
imgRequest* request, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
||||||
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
||||||
imgINotificationObserver* aObserver, Document* aLoadingDocument,
|
imgINotificationObserver* aObserver, nsISupports* aCX,
|
||||||
uint64_t aInnerWindowId, nsLoadFlags aLoadFlags,
|
Document* aLoadingDocument, uint64_t aInnerWindowId, nsLoadFlags aLoadFlags,
|
||||||
nsContentPolicyType aLoadPolicyType, imgRequestProxy** aProxyRequest,
|
nsContentPolicyType aLoadPolicyType, imgRequestProxy** aProxyRequest,
|
||||||
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode,
|
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode,
|
||||||
bool* aNewChannelCreated) {
|
bool* aNewChannelCreated) {
|
||||||
@ -1709,7 +1710,7 @@ bool imgLoader::ValidateRequestWithNewChannel(
|
|||||||
rv = NewImageChannel(getter_AddRefs(newChannel), &forcePrincipalCheck, aURI,
|
rv = NewImageChannel(getter_AddRefs(newChannel), &forcePrincipalCheck, aURI,
|
||||||
aInitialDocumentURI, aCORSMode, aReferrerInfo,
|
aInitialDocumentURI, aCORSMode, aReferrerInfo,
|
||||||
aLoadGroup, aLoadFlags, aLoadPolicyType,
|
aLoadGroup, aLoadFlags, aLoadPolicyType,
|
||||||
aTriggeringPrincipal, aLoadingDocument, mRespectPrivacy);
|
aTriggeringPrincipal, aCX, mRespectPrivacy);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1732,9 +1733,8 @@ bool imgLoader::ValidateRequestWithNewChannel(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<imgCacheValidator> hvc =
|
RefPtr<imgCacheValidator> hvc = new imgCacheValidator(
|
||||||
new imgCacheValidator(progressproxy, this, request, aLoadingDocument,
|
progressproxy, this, request, aCX, aInnerWindowId, forcePrincipalCheck);
|
||||||
aInnerWindowId, forcePrincipalCheck);
|
|
||||||
|
|
||||||
// Casting needed here to get past multiple inheritance.
|
// Casting needed here to get past multiple inheritance.
|
||||||
nsCOMPtr<nsIStreamListener> listener =
|
nsCOMPtr<nsIStreamListener> listener =
|
||||||
@ -1773,11 +1773,11 @@ bool imgLoader::ValidateRequestWithNewChannel(
|
|||||||
bool imgLoader::ValidateEntry(
|
bool imgLoader::ValidateEntry(
|
||||||
imgCacheEntry* aEntry, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
imgCacheEntry* aEntry, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
||||||
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
||||||
imgINotificationObserver* aObserver, Document* aLoadingDocument,
|
imgINotificationObserver* aObserver, nsISupports* aCX,
|
||||||
nsLoadFlags aLoadFlags, nsContentPolicyType aLoadPolicyType,
|
Document* aLoadingDocument, nsLoadFlags aLoadFlags,
|
||||||
bool aCanMakeNewChannel, bool* aNewChannelCreated,
|
nsContentPolicyType aLoadPolicyType, bool aCanMakeNewChannel,
|
||||||
imgRequestProxy** aProxyRequest, nsIPrincipal* aTriggeringPrincipal,
|
bool* aNewChannelCreated, imgRequestProxy** aProxyRequest,
|
||||||
int32_t aCORSMode) {
|
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode) {
|
||||||
LOG_SCOPE(gImgLog, "imgLoader::ValidateEntry");
|
LOG_SCOPE(gImgLog, "imgLoader::ValidateEntry");
|
||||||
|
|
||||||
// If the expiration time is zero, then the request has not gotten far enough
|
// If the expiration time is zero, then the request has not gotten far enough
|
||||||
@ -1814,10 +1814,9 @@ bool imgLoader::ValidateEntry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidateSecurityInfo(request, aEntry->ForcePrincipalCheck(), aCORSMode,
|
if (!ValidateSecurityInfo(request, aEntry->ForcePrincipalCheck(), aCORSMode,
|
||||||
aTriggeringPrincipal, aLoadingDocument,
|
aTriggeringPrincipal, aCX, aLoadPolicyType,
|
||||||
aLoadPolicyType, aReferrerInfo)) {
|
aReferrerInfo))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// data URIs are immutable and by their nature can't leak data, so we can
|
// data URIs are immutable and by their nature can't leak data, so we can
|
||||||
// just return true in that case. Doing so would mean that shift-reload
|
// just return true in that case. Doing so would mean that shift-reload
|
||||||
@ -1832,17 +1831,17 @@ bool imgLoader::ValidateEntry(
|
|||||||
|
|
||||||
bool validateRequest = false;
|
bool validateRequest = false;
|
||||||
|
|
||||||
// If the request's loadId is the same as the aLoadingDocument, then it is ok
|
// If the request's loadId is the same as the aCX, then it is ok to use
|
||||||
// to use this one because it has already been validated for this context.
|
// this one because it has already been validated for this context.
|
||||||
//
|
//
|
||||||
// XXX: nullptr seems to be a 'special' key value that indicates that NO
|
// XXX: nullptr seems to be a 'special' key value that indicates that NO
|
||||||
// validation is required.
|
// validation is required.
|
||||||
// XXX: we also check the window ID because the loadID() can return a reused
|
// XXX: we also check the window ID because the loadID() can return a reused
|
||||||
// pointer of a document. This can still happen for non-document image
|
// pointer of a document. This can still happen for non-document image
|
||||||
// cache entries.
|
// cache entries.
|
||||||
void* key = (void*)aLoadingDocument;
|
void* key = (void*)aCX;
|
||||||
uint64_t innerWindowID =
|
nsCOMPtr<Document> doc = do_QueryInterface(aCX);
|
||||||
aLoadingDocument ? aLoadingDocument->InnerWindowID() : 0;
|
uint64_t innerWindowID = doc ? doc->InnerWindowID() : 0;
|
||||||
if (request->LoadId() != key || request->InnerWindowID() != innerWindowID) {
|
if (request->LoadId() != key || request->InnerWindowID() != innerWindowID) {
|
||||||
// If we would need to revalidate this entry, but we're being told to
|
// If we would need to revalidate this entry, but we're being told to
|
||||||
// bypass the cache, we don't allow this entry to be used.
|
// bypass the cache, we don't allow this entry to be used.
|
||||||
@ -1895,8 +1894,9 @@ bool imgLoader::ValidateEntry(
|
|||||||
|
|
||||||
return ValidateRequestWithNewChannel(
|
return ValidateRequestWithNewChannel(
|
||||||
request, aURI, aInitialDocumentURI, aReferrerInfo, aLoadGroup,
|
request, aURI, aInitialDocumentURI, aReferrerInfo, aLoadGroup,
|
||||||
aObserver, aLoadingDocument, innerWindowID, aLoadFlags, aLoadPolicyType,
|
aObserver, aCX, aLoadingDocument, innerWindowID, aLoadFlags,
|
||||||
aProxyRequest, aTriggeringPrincipal, aCORSMode, aNewChannelCreated);
|
aLoadPolicyType, aProxyRequest, aTriggeringPrincipal, aCORSMode,
|
||||||
|
aNewChannelCreated);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !validateRequest;
|
return !validateRequest;
|
||||||
@ -2044,21 +2044,25 @@ bool imgLoader::PreferLoadFromCache(nsIURI* aURI) const {
|
|||||||
nsIRequest::VALIDATE_ONCE_PER_SESSION)
|
nsIRequest::VALIDATE_ONCE_PER_SESSION)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgLoader::LoadImageXPCOM(
|
imgLoader::LoadImageXPCOM(nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
||||||
nsIURI* aURI, nsIURI* aInitialDocumentURI, nsIReferrerInfo* aReferrerInfo,
|
nsIReferrerInfo* aReferrerInfo,
|
||||||
nsIPrincipal* aTriggeringPrincipal, nsILoadGroup* aLoadGroup,
|
nsIPrincipal* aTriggeringPrincipal,
|
||||||
imgINotificationObserver* aObserver, Document* aLoadingDocument,
|
nsILoadGroup* aLoadGroup,
|
||||||
nsLoadFlags aLoadFlags, nsISupports* aCacheKey,
|
imgINotificationObserver* aObserver, nsISupports* aCX,
|
||||||
nsContentPolicyType aContentPolicyType, imgIRequest** _retval) {
|
nsLoadFlags aLoadFlags, nsISupports* aCacheKey,
|
||||||
|
nsContentPolicyType aContentPolicyType,
|
||||||
|
imgIRequest** _retval) {
|
||||||
// Optional parameter, so defaults to 0 (== TYPE_INVALID)
|
// Optional parameter, so defaults to 0 (== TYPE_INVALID)
|
||||||
if (!aContentPolicyType) {
|
if (!aContentPolicyType) {
|
||||||
aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE;
|
aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE;
|
||||||
}
|
}
|
||||||
imgRequestProxy* proxy;
|
imgRequestProxy* proxy;
|
||||||
|
nsCOMPtr<nsINode> node = do_QueryInterface(aCX);
|
||||||
|
nsCOMPtr<Document> doc = do_QueryInterface(aCX);
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
LoadImage(aURI, aInitialDocumentURI, aReferrerInfo, aTriggeringPrincipal,
|
LoadImage(aURI, aInitialDocumentURI, aReferrerInfo, aTriggeringPrincipal,
|
||||||
0, aLoadGroup, aObserver, aLoadingDocument, aLoadingDocument,
|
0, aLoadGroup, aObserver, node, doc, aLoadFlags, aCacheKey,
|
||||||
aLoadFlags, aCacheKey, aContentPolicyType, EmptyString(),
|
aContentPolicyType, EmptyString(),
|
||||||
/* aUseUrgentStartForChannel */ false, &proxy);
|
/* aUseUrgentStartForChannel */ false, &proxy);
|
||||||
*_retval = proxy;
|
*_retval = proxy;
|
||||||
return rv;
|
return rv;
|
||||||
@ -2166,9 +2170,10 @@ nsresult imgLoader::LoadImage(
|
|||||||
if (cache.Get(key, getter_AddRefs(entry)) && entry) {
|
if (cache.Get(key, getter_AddRefs(entry)) && entry) {
|
||||||
bool newChannelCreated = false;
|
bool newChannelCreated = false;
|
||||||
if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerInfo,
|
if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerInfo,
|
||||||
aLoadGroup, aObserver, aLoadingDocument, requestFlags,
|
aLoadGroup, aObserver, ToSupports(aLoadingDocument),
|
||||||
aContentPolicyType, true, &newChannelCreated, _retval,
|
aLoadingDocument, requestFlags, aContentPolicyType, true,
|
||||||
aTriggeringPrincipal, corsmode)) {
|
&newChannelCreated, _retval, aTriggeringPrincipal,
|
||||||
|
corsmode)) {
|
||||||
request = entry->GetRequest();
|
request = entry->GetRequest();
|
||||||
|
|
||||||
// If this entry has no proxies, its request has no reference to the
|
// If this entry has no proxies, its request has no reference to the
|
||||||
@ -2194,9 +2199,10 @@ nsresult imgLoader::LoadImage(
|
|||||||
// - we don't have cache. We are not in this if() stmt. A new channel is
|
// - we don't have cache. We are not in this if() stmt. A new channel is
|
||||||
// created and that triggers the CSP checks.
|
// created and that triggers the CSP checks.
|
||||||
// - We have a cache entry and this is blocked by CSP directives.
|
// - We have a cache entry and this is blocked by CSP directives.
|
||||||
DebugOnly<bool> shouldLoad = ShouldLoadCachedImage(
|
DebugOnly<bool> shouldLoad =
|
||||||
request, aLoadingDocument, aTriggeringPrincipal, aContentPolicyType,
|
ShouldLoadCachedImage(request, ToSupports(aLoadingDocument),
|
||||||
/* aSendCSPViolationReports */ true);
|
aTriggeringPrincipal, aContentPolicyType,
|
||||||
|
/* aSendCSPViolationReports */ true);
|
||||||
MOZ_ASSERT(shouldLoad);
|
MOZ_ASSERT(shouldLoad);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2252,8 +2258,9 @@ nsresult imgLoader::LoadImage(
|
|||||||
nsCOMPtr<nsILoadGroup> channelLoadGroup;
|
nsCOMPtr<nsILoadGroup> channelLoadGroup;
|
||||||
newChannel->GetLoadGroup(getter_AddRefs(channelLoadGroup));
|
newChannel->GetLoadGroup(getter_AddRefs(channelLoadGroup));
|
||||||
rv = request->Init(aURI, aURI, /* aHadInsecureRedirect = */ false,
|
rv = request->Init(aURI, aURI, /* aHadInsecureRedirect = */ false,
|
||||||
channelLoadGroup, newChannel, entry, aLoadingDocument,
|
channelLoadGroup, newChannel, entry,
|
||||||
aTriggeringPrincipal, corsmode, aReferrerInfo);
|
ToSupports(aLoadingDocument), aTriggeringPrincipal,
|
||||||
|
corsmode, aReferrerInfo);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -2353,20 +2360,19 @@ nsresult imgLoader::LoadImage(
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgLoader::LoadImageWithChannelXPCOM(nsIChannel* channel,
|
imgLoader::LoadImageWithChannelXPCOM(nsIChannel* channel,
|
||||||
imgINotificationObserver* aObserver,
|
imgINotificationObserver* aObserver,
|
||||||
Document* aLoadingDocument,
|
nsISupports* aCX,
|
||||||
nsIStreamListener** listener,
|
nsIStreamListener** listener,
|
||||||
imgIRequest** _retval) {
|
imgIRequest** _retval) {
|
||||||
nsresult result;
|
nsresult result;
|
||||||
imgRequestProxy* proxy;
|
imgRequestProxy* proxy;
|
||||||
result = LoadImageWithChannel(channel, aObserver, aLoadingDocument, listener,
|
result = LoadImageWithChannel(channel, aObserver, aCX, listener, &proxy);
|
||||||
&proxy);
|
|
||||||
*_retval = proxy;
|
*_retval = proxy;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
||||||
imgINotificationObserver* aObserver,
|
imgINotificationObserver* aObserver,
|
||||||
Document* aLoadingDocument,
|
nsISupports* aCX,
|
||||||
nsIStreamListener** listener,
|
nsIStreamListener** listener,
|
||||||
imgRequestProxy** _retval) {
|
imgRequestProxy** _retval) {
|
||||||
NS_ASSERTION(channel,
|
NS_ASSERTION(channel,
|
||||||
@ -2379,13 +2385,14 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
|
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri;
|
||||||
channel->GetURI(getter_AddRefs(uri));
|
channel->GetURI(getter_AddRefs(uri));
|
||||||
|
nsCOMPtr<Document> doc = do_QueryInterface(aCX);
|
||||||
|
|
||||||
NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(channel, NS_ERROR_FAILURE);
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||||
|
|
||||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||||
|
|
||||||
ImageCacheKey key(uri, attrs, aLoadingDocument);
|
ImageCacheKey key(uri, attrs, doc);
|
||||||
|
|
||||||
nsLoadFlags requestFlags = nsIRequest::LOAD_NORMAL;
|
nsLoadFlags requestFlags = nsIRequest::LOAD_NORMAL;
|
||||||
channel->GetLoadFlags(&requestFlags);
|
channel->GetLoadFlags(&requestFlags);
|
||||||
@ -2421,9 +2428,9 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
// default to the internal image type
|
// default to the internal image type
|
||||||
nsContentPolicyType policyType = loadInfo->InternalContentPolicyType();
|
nsContentPolicyType policyType = loadInfo->InternalContentPolicyType();
|
||||||
|
|
||||||
if (ValidateEntry(entry, uri, nullptr, nullptr, nullptr, aObserver,
|
if (ValidateEntry(entry, uri, nullptr, nullptr, nullptr, aObserver, aCX,
|
||||||
aLoadingDocument, requestFlags, policyType, false,
|
doc, requestFlags, policyType, false, nullptr, nullptr,
|
||||||
nullptr, nullptr, nullptr, imgIRequest::CORS_NONE)) {
|
nullptr, imgIRequest::CORS_NONE)) {
|
||||||
request = entry->GetRequest();
|
request = entry->GetRequest();
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsICacheInfoChannel> cacheChan(do_QueryInterface(channel));
|
nsCOMPtr<nsICacheInfoChannel> cacheChan(do_QueryInterface(channel));
|
||||||
@ -2466,12 +2473,11 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
channel->GetLoadGroup(getter_AddRefs(loadGroup));
|
channel->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (aLoadingDocument) {
|
if (doc) {
|
||||||
// The load group of the channel should always match that of the
|
// The load group of the channel should always match that of the
|
||||||
// document if given. If that isn't the case, then we need to add more
|
// document if given. If that isn't the case, then we need to add more
|
||||||
// plumbing to ensure we block the document as well.
|
// plumbing to ensure we block the document as well.
|
||||||
nsCOMPtr<nsILoadGroup> docLoadGroup =
|
nsCOMPtr<nsILoadGroup> docLoadGroup = doc->GetDocumentLoadGroup();
|
||||||
aLoadingDocument->GetDocumentLoadGroup();
|
|
||||||
MOZ_ASSERT(docLoadGroup == loadGroup);
|
MOZ_ASSERT(docLoadGroup == loadGroup);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2488,8 +2494,8 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
|
|
||||||
*listener = nullptr; // give them back a null nsIStreamListener
|
*listener = nullptr; // give them back a null nsIStreamListener
|
||||||
|
|
||||||
rv = CreateNewProxyForRequest(request, loadGroup, aLoadingDocument,
|
rv = CreateNewProxyForRequest(request, loadGroup, doc, aObserver,
|
||||||
aObserver, requestFlags, _retval);
|
requestFlags, _retval);
|
||||||
static_cast<imgRequestProxy*>(*_retval)->NotifyListener();
|
static_cast<imgRequestProxy*>(*_retval)->NotifyListener();
|
||||||
} else {
|
} else {
|
||||||
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
|
// We use originalURI here to fulfil the imgIRequest contract on GetURI.
|
||||||
@ -2500,7 +2506,7 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
// constructed above with the *current URI* and not the *original URI*. I'm
|
// constructed above with the *current URI* and not the *original URI*. I'm
|
||||||
// pretty sure this is a bug, and it's preventing us from ever getting a
|
// pretty sure this is a bug, and it's preventing us from ever getting a
|
||||||
// cache hit in LoadImageWithChannel when redirects are involved.
|
// cache hit in LoadImageWithChannel when redirects are involved.
|
||||||
ImageCacheKey originalURIKey(originalURI, attrs, aLoadingDocument);
|
ImageCacheKey originalURIKey(originalURI, attrs, doc);
|
||||||
|
|
||||||
// Default to doing a principal check because we don't know who
|
// Default to doing a principal check because we don't know who
|
||||||
// started that load and whether their principal ended up being
|
// started that load and whether their principal ended up being
|
||||||
@ -2518,7 +2524,7 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
// including the redirects will go through content policy). Hence, we
|
// including the redirects will go through content policy). Hence, we
|
||||||
// can set aHadInsecureRedirect to false here.
|
// can set aHadInsecureRedirect to false here.
|
||||||
rv = request->Init(originalURI, uri, /* aHadInsecureRedirect = */ false,
|
rv = request->Init(originalURI, uri, /* aHadInsecureRedirect = */ false,
|
||||||
channel, channel, entry, aLoadingDocument, nullptr,
|
channel, channel, entry, aCX, nullptr,
|
||||||
imgIRequest::CORS_NONE, nullptr);
|
imgIRequest::CORS_NONE, nullptr);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@ -2529,8 +2535,8 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel* channel,
|
|||||||
// Try to add the new request into the cache.
|
// Try to add the new request into the cache.
|
||||||
PutIntoCache(originalURIKey, entry);
|
PutIntoCache(originalURIKey, entry);
|
||||||
|
|
||||||
rv = CreateNewProxyForRequest(request, loadGroup, aLoadingDocument,
|
rv = CreateNewProxyForRequest(request, loadGroup, doc, aObserver,
|
||||||
aObserver, requestFlags, _retval);
|
requestFlags, _retval);
|
||||||
|
|
||||||
// Explicitly don't notify our proxy, because we're loading off the
|
// Explicitly don't notify our proxy, because we're loading off the
|
||||||
// network, and necko (or things called from necko, such as
|
// network, and necko (or things called from necko, such as
|
||||||
@ -2756,12 +2762,12 @@ NS_IMPL_ISUPPORTS(imgCacheValidator, nsIStreamListener, nsIRequestObserver,
|
|||||||
|
|
||||||
imgCacheValidator::imgCacheValidator(nsProgressNotificationProxy* progress,
|
imgCacheValidator::imgCacheValidator(nsProgressNotificationProxy* progress,
|
||||||
imgLoader* loader, imgRequest* request,
|
imgLoader* loader, imgRequest* request,
|
||||||
Document* aDocument,
|
nsISupports* aContext,
|
||||||
uint64_t aInnerWindowId,
|
uint64_t aInnerWindowId,
|
||||||
bool forcePrincipalCheckForCacheEntry)
|
bool forcePrincipalCheckForCacheEntry)
|
||||||
: mProgressProxy(progress),
|
: mProgressProxy(progress),
|
||||||
mRequest(request),
|
mRequest(request),
|
||||||
mDocument(aDocument),
|
mContext(aContext),
|
||||||
mInnerWindowId(aInnerWindowId),
|
mInnerWindowId(aInnerWindowId),
|
||||||
mImgLoader(loader),
|
mImgLoader(loader),
|
||||||
mHadInsecureRedirect(false) {
|
mHadInsecureRedirect(false) {
|
||||||
@ -2850,7 +2856,7 @@ void imgCacheValidator::UpdateProxies(bool aCancelRequest, bool aSyncNotify) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
||||||
// We may be holding on to a document, so ensure that it's released.
|
// We may be holding on to a document, so ensure that it's released.
|
||||||
RefPtr<Document> document = mDocument.forget();
|
nsCOMPtr<nsISupports> context = mContext.forget();
|
||||||
|
|
||||||
// If for some reason we don't still have an existing request (probably
|
// If for some reason we don't still have an existing request (probably
|
||||||
// because OnStartRequest got delivered more than once), just bail.
|
// because OnStartRequest got delivered more than once), just bail.
|
||||||
@ -2887,7 +2893,7 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
|||||||
|
|
||||||
// Clear the validator before updating the proxies. The notifications may
|
// Clear the validator before updating the proxies. The notifications may
|
||||||
// clone an existing request, and its state could be inconsistent.
|
// clone an existing request, and its state could be inconsistent.
|
||||||
mRequest->SetLoadId(document);
|
mRequest->SetLoadId(context);
|
||||||
mRequest->SetInnerWindowID(mInnerWindowId);
|
mRequest->SetInnerWindowID(mInnerWindowId);
|
||||||
UpdateProxies(/* aCancelRequest */ false, /* aSyncNotify */ true);
|
UpdateProxies(/* aCancelRequest */ false, /* aSyncNotify */ true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -2915,7 +2921,7 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
|||||||
nsCOMPtr<nsIURI> originalURI;
|
nsCOMPtr<nsIURI> originalURI;
|
||||||
channel->GetOriginalURI(getter_AddRefs(originalURI));
|
channel->GetOriginalURI(getter_AddRefs(originalURI));
|
||||||
nsresult rv = mNewRequest->Init(originalURI, uri, mHadInsecureRedirect,
|
nsresult rv = mNewRequest->Init(originalURI, uri, mHadInsecureRedirect,
|
||||||
aRequest, channel, mNewEntry, document,
|
aRequest, channel, mNewEntry, context,
|
||||||
triggeringPrincipal, corsmode, referrerInfo);
|
triggeringPrincipal, corsmode, referrerInfo);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
UpdateProxies(/* aCancelRequest */ true, /* aSyncNotify */ true);
|
UpdateProxies(/* aCancelRequest */ true, /* aSyncNotify */ true);
|
||||||
@ -2935,7 +2941,7 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgCacheValidator::OnStopRequest(nsIRequest* aRequest, nsresult status) {
|
imgCacheValidator::OnStopRequest(nsIRequest* aRequest, nsresult status) {
|
||||||
// Be sure we've released the document that we may have been holding on to.
|
// Be sure we've released the document that we may have been holding on to.
|
||||||
mDocument = nullptr;
|
mContext = nullptr;
|
||||||
|
|
||||||
if (!mDestListener) {
|
if (!mDestListener) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -250,7 +250,7 @@ class imgLoader final : public imgILoader,
|
|||||||
|
|
||||||
[[nodiscard]] nsresult LoadImageWithChannel(
|
[[nodiscard]] nsresult LoadImageWithChannel(
|
||||||
nsIChannel* channel, imgINotificationObserver* aObserver,
|
nsIChannel* channel, imgINotificationObserver* aObserver,
|
||||||
mozilla::dom::Document* aLoadingDocument, nsIStreamListener** listener,
|
nsISupports* aCX, nsIStreamListener** listener,
|
||||||
imgRequestProxy** _retval);
|
imgRequestProxy** _retval);
|
||||||
|
|
||||||
static nsresult GetMimeTypeFromContent(const char* aContents,
|
static nsresult GetMimeTypeFromContent(const char* aContents,
|
||||||
@ -346,7 +346,7 @@ class imgLoader final : public imgILoader,
|
|||||||
bool ValidateEntry(imgCacheEntry* aEntry, nsIURI* aKey,
|
bool ValidateEntry(imgCacheEntry* aEntry, nsIURI* aKey,
|
||||||
nsIURI* aInitialDocumentURI,
|
nsIURI* aInitialDocumentURI,
|
||||||
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
||||||
imgINotificationObserver* aObserver,
|
imgINotificationObserver* aObserver, nsISupports* aCX,
|
||||||
mozilla::dom::Document* aLoadingDocument,
|
mozilla::dom::Document* aLoadingDocument,
|
||||||
nsLoadFlags aLoadFlags,
|
nsLoadFlags aLoadFlags,
|
||||||
nsContentPolicyType aContentPolicyType,
|
nsContentPolicyType aContentPolicyType,
|
||||||
@ -357,7 +357,7 @@ class imgLoader final : public imgILoader,
|
|||||||
bool ValidateRequestWithNewChannel(
|
bool ValidateRequestWithNewChannel(
|
||||||
imgRequest* request, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
imgRequest* request, nsIURI* aURI, nsIURI* aInitialDocumentURI,
|
||||||
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
nsIReferrerInfo* aReferrerInfo, nsILoadGroup* aLoadGroup,
|
||||||
imgINotificationObserver* aObserver,
|
imgINotificationObserver* aObserver, nsISupports* aCX,
|
||||||
mozilla::dom::Document* aLoadingDocument, uint64_t aInnerWindowId,
|
mozilla::dom::Document* aLoadingDocument, uint64_t aInnerWindowId,
|
||||||
nsLoadFlags aLoadFlags, nsContentPolicyType aContentPolicyType,
|
nsLoadFlags aLoadFlags, nsContentPolicyType aContentPolicyType,
|
||||||
imgRequestProxy** aProxyRequest, nsIPrincipal* aLoadingPrincipal,
|
imgRequestProxy** aProxyRequest, nsIPrincipal* aLoadingPrincipal,
|
||||||
@ -472,7 +472,7 @@ class imgCacheValidator : public nsIStreamListener,
|
|||||||
public nsIAsyncVerifyRedirectCallback {
|
public nsIAsyncVerifyRedirectCallback {
|
||||||
public:
|
public:
|
||||||
imgCacheValidator(nsProgressNotificationProxy* progress, imgLoader* loader,
|
imgCacheValidator(nsProgressNotificationProxy* progress, imgLoader* loader,
|
||||||
imgRequest* aRequest, mozilla::dom::Document* aDocument,
|
imgRequest* aRequest, nsISupports* aContext,
|
||||||
uint64_t aInnerWindowId,
|
uint64_t aInnerWindowId,
|
||||||
bool forcePrincipalCheckForCacheEntry);
|
bool forcePrincipalCheckForCacheEntry);
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ class imgCacheValidator : public nsIStreamListener,
|
|||||||
RefPtr<imgRequest> mNewRequest;
|
RefPtr<imgRequest> mNewRequest;
|
||||||
RefPtr<imgCacheEntry> mNewEntry;
|
RefPtr<imgCacheEntry> mNewEntry;
|
||||||
|
|
||||||
RefPtr<mozilla::dom::Document> mDocument;
|
nsCOMPtr<nsISupports> mContext;
|
||||||
uint64_t mInnerWindowId;
|
uint64_t mInnerWindowId;
|
||||||
|
|
||||||
imgLoader* mImgLoader;
|
imgLoader* mImgLoader;
|
||||||
|
@ -84,9 +84,8 @@ imgRequest::~imgRequest() {
|
|||||||
nsresult imgRequest::Init(nsIURI* aURI, nsIURI* aFinalURI,
|
nsresult imgRequest::Init(nsIURI* aURI, nsIURI* aFinalURI,
|
||||||
bool aHadInsecureRedirect, nsIRequest* aRequest,
|
bool aHadInsecureRedirect, nsIRequest* aRequest,
|
||||||
nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
|
nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
|
||||||
Document* aLoadingDocument,
|
nsISupports* aCX, nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode,
|
int32_t aCORSMode, nsIReferrerInfo* aReferrerInfo) {
|
||||||
nsIReferrerInfo* aReferrerInfo) {
|
|
||||||
MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!");
|
MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!");
|
||||||
|
|
||||||
LOG_FUNC(gImgLog, "imgRequest::Init");
|
LOG_FUNC(gImgLog, "imgRequest::Init");
|
||||||
@ -135,11 +134,12 @@ nsresult imgRequest::Init(nsIURI* aURI, nsIURI* aFinalURI,
|
|||||||
mCacheEntry = aCacheEntry;
|
mCacheEntry = aCacheEntry;
|
||||||
mCacheEntry->UpdateLoadTime();
|
mCacheEntry->UpdateLoadTime();
|
||||||
|
|
||||||
SetLoadId(aLoadingDocument);
|
SetLoadId(aCX);
|
||||||
|
|
||||||
// Grab the inner window ID of the loading document, if possible.
|
// Grab the inner window ID of the loading document, if possible.
|
||||||
if (aLoadingDocument) {
|
nsCOMPtr<dom::Document> doc = do_QueryInterface(aCX);
|
||||||
mInnerWindowId = aLoadingDocument->InnerWindowID();
|
if (doc) {
|
||||||
|
mInnerWindowId = doc->InnerWindowID();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -65,7 +65,7 @@ class imgRequest final : public nsIStreamListener,
|
|||||||
[[nodiscard]] nsresult
|
[[nodiscard]] nsresult
|
||||||
Init(nsIURI* aURI, nsIURI* aFinalURI, bool aHadInsecureRedirect,
|
Init(nsIURI* aURI, nsIURI* aFinalURI, bool aHadInsecureRedirect,
|
||||||
nsIRequest* aRequest, nsIChannel* aChannel,
|
nsIRequest* aRequest, nsIChannel* aChannel,
|
||||||
imgCacheEntry* aCacheEntry, mozilla::dom::Document* aLoadingDocument,
|
imgCacheEntry* aCacheEntry, nsISupports* aCX,
|
||||||
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode,
|
nsIPrincipal* aTriggeringPrincipal, int32_t aCORSMode,
|
||||||
nsIReferrerInfo* aReferrerInfo);
|
nsIReferrerInfo* aReferrerInfo);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user