Bug 1210941 P3 Make jar channels use LOAD_BYPASS_SERVICE_WORKER internally. r=jduell

This commit is contained in:
Ben Kelly 2015-10-06 06:37:06 -07:00
Родитель 5f0bbc9218
Коммит bf39f45fae
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -203,7 +203,6 @@ nsJARChannel::nsJARChannel()
, mIsUnsafe(true)
, mOpeningRemote(false)
, mSynthesizedStreamLength(0)
, mForceNoIntercept(false)
, mBlockRemoteFiles(false)
{
if (!gJarProtocolLog)
@ -863,6 +862,12 @@ nsJARChannel::Open2(nsIInputStream** aStream)
return Open(aStream);
}
bool
nsJARChannel::BypassServiceWorker() const
{
return mLoadFlags & LOAD_BYPASS_SERVICE_WORKER;
}
bool
nsJARChannel::ShouldIntercept()
{
@ -877,7 +882,7 @@ nsJARChannel::ShouldIntercept()
NS_GET_IID(nsINetworkInterceptController),
getter_AddRefs(controller));
bool shouldIntercept = false;
if (controller && !mForceNoIntercept && mLoadInfo) {
if (controller && !BypassServiceWorker() && mLoadInfo) {
bool isNavigation = mLoadFlags & LOAD_DOCUMENT_URI;
nsContentPolicyType type = mLoadInfo->InternalContentPolicyType();
nsresult rv = controller->ShouldPrepareForIntercept(mAppURI,
@ -1124,7 +1129,7 @@ nsJARChannel::GetZipEntry(nsIZipEntry **aZipEntry)
NS_IMETHODIMP
nsJARChannel::ForceNoIntercept()
{
mForceNoIntercept = true;
mLoadFlags |= LOAD_BYPASS_SERVICE_WORKER;
return NS_OK;
}

Просмотреть файл

@ -80,6 +80,8 @@ private:
mozilla::net::MemoryDownloader::Data aData)
override;
bool BypassServiceWorker() const;
// Returns true if this channel should intercept the network request and
// prepare for a possible synthesized response instead.
bool ShouldIntercept();
@ -136,9 +138,6 @@ private:
nsRefPtr<nsInputStreamPump> mSynthesizedResponsePump;
int64_t mSynthesizedStreamLength;
// True if this channel should skip any interception checks.
bool mForceNoIntercept;
// True if this channel should not download any remote files.
bool mBlockRemoteFiles;
friend class mozilla::net::InterceptedJARChannel;