Bug 1619953 - P12 - Blob data is retrieved locally for non-http/https URLs r=baku

Differential Revision: https://phabricator.services.mozilla.com/D85868
This commit is contained in:
ssengupta 2020-08-05 17:05:36 +00:00
parent a53a3bfb23
commit 49786eae4d
3 changed files with 10 additions and 1 deletions

View File

@ -363,7 +363,7 @@ void BlobURLInputStream::RetrieveBlobData(const MutexAutoLock& aProofOfLock) {
return;
}
if (XRE_IsParentProcess()) {
if (XRE_IsParentProcess() || !BlobURLSchemeIsHTTPOrHTTPS(mBlobURLSpec)) {
nsIPrincipal* const dataEntryPrincipal =
BlobURLProtocolHandler::GetDataEntryPrincipal(mBlobURLSpec,
true /* AlsoIfRevoked */);

View File

@ -30,6 +30,7 @@
#include "nsIPrincipal.h"
#include "nsIUUIDGenerator.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#define RELEASING_TIMER 5000
@ -898,6 +899,11 @@ bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) {
bool IsBlobURI(nsIURI* aUri) { return IsType(aUri, DataInfo::eBlobImpl); }
bool BlobURLSchemeIsHTTPOrHTTPS(const nsACString& aUri) {
return (StringBeginsWith(aUri, "blob:http://"_ns) ||
StringBeginsWith(aUri, "blob:https://"_ns));
}
bool IsMediaSourceURI(nsIURI* aUri) {
return IsType(aUri, DataInfo::eMediaSource);
}

View File

@ -99,6 +99,9 @@ class BlobURLProtocolHandler final : public nsIProtocolHandler,
bool IsBlobURI(nsIURI* aUri);
bool IsMediaSourceURI(nsIURI* aUri);
// Return true if inner scheme of blobURL is http or https, false otherwise.
bool BlobURLSchemeIsHTTPOrHTTPS(const nsACString& aUri);
} // namespace dom
} // namespace mozilla