Bug 1130101 - Part 1: Store the value of the Service-Worker-Allowed header in the CompareManager object; r=nsm

This commit is contained in:
Ehsan Akhgari 2015-05-06 01:14:50 -04:00
Родитель b4379aa7b4
Коммит 0053c63b09
2 изменённых файлов: 19 добавлений и 0 удалений

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ServiceWorkerScriptCache.h"
#include "mozilla/unused.h"
#include "mozilla/dom/CacheBinding.h"
#include "mozilla/dom/cache/CacheStorage.h"
#include "mozilla/dom/cache/Cache.h"
@ -321,6 +322,13 @@ public:
return mURL;
}
void
SetMaxScope(const nsACString& aMaxScope)
{
MOZ_ASSERT(!mNetworkFinished);
mMaxScope = aMaxScope;
}
void
NetworkFinished(nsresult aStatus)
{
@ -569,6 +577,8 @@ private:
nsCString mSecurityInfo;
nsCString mMaxScope;
enum {
WaitingForOpen,
WaitingForPut
@ -648,6 +658,14 @@ CompareNetwork::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext
mManager->NetworkFinished(NS_ERROR_FAILURE);
return NS_OK;
}
nsAutoCString maxScope;
// Note: we explicitly don't check for the return value here, because the
// absense of the header is not an error condition.
unused << httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Service-Worker-Allowed"),
maxScope);
mManager->SetMaxScope(maxScope);
}
else {
// The only supported request schemes are http, https, and app.

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

@ -72,6 +72,7 @@ HTTP_ATOM(Range, "Range")
HTTP_ATOM(Referer, "Referer")
HTTP_ATOM(Retry_After, "Retry-After")
HTTP_ATOM(Server, "Server")
HTTP_ATOM(Service_Worker_Allowed, "Service-Worker-Allowed")
HTTP_ATOM(Set_Cookie, "Set-Cookie")
HTTP_ATOM(Set_Cookie2, "Set-Cookie2")
HTTP_ATOM(Status_URI, "Status-URI")