зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1406253 - Part 2: Implement nsIImageLoadingContent.currentRequestFinalURI. r=bz
ImageLoadingContent.currentURI returns the "URI" of currentRequest, which is the URI used to start that request. Some consumers need to know the final URI of that request instead. If the image request gets redirected on loading (e.g. an add-on intercepts the request), currentRequestFinalURI will be the redirected URI, while currentURI would be the original URI before redirect. MozReview-Commit-ID: 9lX063uAIp1 --HG-- extra : rebase_source : 91451128abc5c3f29c11d3cabfc98cde6c440ea6
This commit is contained in:
Родитель
326d642792
Коммит
9d2c8ac38e
|
@ -757,6 +757,17 @@ nsImageLoadingContent::GetCurrentURI(nsIURI** aURI)
|
|||
return result.StealNSResult();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
nsImageLoadingContent::GetCurrentRequestFinalURI()
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (mCurrentRequest) {
|
||||
mCurrentRequest->GetFinalURI(getter_AddRefs(uri));
|
||||
}
|
||||
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
|
||||
nsIStreamListener** aListener)
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
int32_t
|
||||
GetRequestType(imgIRequest* aRequest, mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsIURI> GetCurrentURI(mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsIURI> GetCurrentRequestFinalURI();
|
||||
void ForceReload(const mozilla::dom::Optional<bool>& aNotify,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
|
|
|
@ -102,6 +102,10 @@ interface MozImageLoadingContent {
|
|||
long getRequestType(imgIRequest aRequest);
|
||||
[ChromeOnly,Throws]
|
||||
readonly attribute URI? currentURI;
|
||||
// Gets the final URI of the current request, if available.
|
||||
// Otherwise, returns null.
|
||||
[ChromeOnly]
|
||||
readonly attribute URI? currentRequestFinalURI;
|
||||
[ChromeOnly,Throws]
|
||||
void forceReload(optional boolean aNotify);
|
||||
[ChromeOnly]
|
||||
|
|
Загрузка…
Ссылка в новой задаче