mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 967163. Use nsIChannel instead of nsIHttpChannel to contentLength. r=seth
This will let us get the right length for blob uris and is just better. --HG-- extra : rebase_source : 4d898ab29c5e1d146d7b543bd1afdc6f6815f28c
This commit is contained in:
parent
40db431b9e
commit
5c27c081b4
@ -143,14 +143,12 @@ SaturateToInt32(int64_t val)
|
||||
uint32_t
|
||||
GetContentSize(nsIRequest* aRequest)
|
||||
{
|
||||
// Use content-length as a size hint for http channels.
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
|
||||
if (httpChannel) {
|
||||
nsAutoCString contentLength;
|
||||
nsresult rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-length"),
|
||||
contentLength);
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
|
||||
if (channel) {
|
||||
int64_t size;
|
||||
nsresult rv = channel->GetContentLength(&size);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return std::max(contentLength.ToInteger(&rv), 0);
|
||||
return std::max(SaturateToInt32(size), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user