Bug 1360603 - Mark the save channel as throttleable. r=baku

This commit is contained in:
Amy Chung 2017-09-24 00:38:32 +08:00
parent aa38e1e5c9
commit 9b6f4f8fbc

View File

@ -13,6 +13,7 @@
#include "nsAutoPtr.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIClassOfService.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsILoadContext.h"
#include "nsIPrivateBrowsingChannel.h"
@ -1497,6 +1498,12 @@ nsresult nsWebBrowserPersist::SaveChannelInternal(
return StartUpload(bufferedInputStream, aFile, contentType);
}
// Mark save channel as throttleable.
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(aChannel));
if (cos) {
cos->AddClassFlags(nsIClassOfService::Throttleable);
}
// Read from the input channel
nsresult rv = NS_MaybeOpenChannelUsingAsyncOpen2(aChannel, this);
if (rv == NS_ERROR_NO_CONTENT)