mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 1337543 P6 Persist response headers for offlined service worker scripts. r=baku
This commit is contained in:
parent
7529d95c7c
commit
414b756468
@ -671,6 +671,7 @@ private:
|
||||
RefPtr<mozilla::dom::InternalResponse> ir =
|
||||
new mozilla::dom::InternalResponse(200, NS_LITERAL_CSTRING("OK"));
|
||||
ir->SetBody(loadInfo.mCacheReadStream, InternalResponse::UNKNOWN_BODY_SIZE);
|
||||
|
||||
// Drop our reference to the stream now that we've passed it along, so it
|
||||
// doesn't hang around once the cache is done with it and keep data alive.
|
||||
loadInfo.mCacheReadStream = nullptr;
|
||||
@ -699,6 +700,7 @@ private:
|
||||
}
|
||||
|
||||
ir->SetPrincipalInfo(Move(principalInfo));
|
||||
ir->Headers()->FillResponseHeaders(loadInfo.mChannel);
|
||||
|
||||
RefPtr<mozilla::dom::Response> response =
|
||||
new mozilla::dom::Response(mCacheCreator->Global(), ir);
|
||||
|
@ -240,6 +240,7 @@ public:
|
||||
CompareCallback* aCallback)
|
||||
: mRegistration(aRegistration)
|
||||
, mCallback(aCallback)
|
||||
, mInternalHeaders(new InternalHeaders())
|
||||
, mState(WaitingForOpen)
|
||||
, mNetworkFinished(false)
|
||||
, mCacheFinished(false)
|
||||
@ -434,10 +435,19 @@ public:
|
||||
return mCacheStorage;
|
||||
}
|
||||
|
||||
void
|
||||
InitChannelInfo(nsIChannel* aChannel)
|
||||
nsresult
|
||||
OnStartRequest(nsIChannel* aChannel)
|
||||
{
|
||||
nsresult rv = SetPrincipalInfo(aChannel);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mChannelInfo.InitFromChannel(aChannel);
|
||||
|
||||
mInternalHeaders->FillResponseHeaders(aChannel);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -562,6 +572,9 @@ private:
|
||||
ir->SetPrincipalInfo(Move(mPrincipalInfo));
|
||||
}
|
||||
|
||||
IgnoredErrorResult ignored;
|
||||
ir->Headers()->Fill(*mInternalHeaders, ignored);
|
||||
|
||||
RefPtr<Response> response = new Response(aCache->GetGlobalObject(), ir);
|
||||
|
||||
RequestOrUSVString request;
|
||||
@ -594,6 +607,7 @@ private:
|
||||
nsString mNewCacheName;
|
||||
|
||||
ChannelInfo mChannelInfo;
|
||||
RefPtr<InternalHeaders> mInternalHeaders;
|
||||
|
||||
UniquePtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo;
|
||||
|
||||
@ -693,8 +707,7 @@ CompareNetwork::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
MOZ_ASSERT(channel == mChannel);
|
||||
#endif
|
||||
|
||||
mManager->InitChannelInfo(mChannel);
|
||||
nsresult rv = mManager->SetPrincipalInfo(mChannel);
|
||||
nsresult rv = mManager->OnStartRequest(mChannel);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user