зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1147699 - Part 2: Set the content policy type on FetchEvent.request based on the content policy type of the channel; r=nsm
Note that InternalRequest::SetContentPolicyType takes care of updating the RequestContext value stored in InternalRequest too.
This commit is contained in:
Родитель
47c59f235a
Коммит
99c8062500
|
@ -2144,6 +2144,7 @@ class FetchEventRunnable : public WorkerRunnable
|
|||
bool mIsReload;
|
||||
RequestMode mRequestMode;
|
||||
RequestCredentials mRequestCredentials;
|
||||
nsContentPolicyType mContentPolicyType;
|
||||
public:
|
||||
FetchEventRunnable(WorkerPrivate* aWorkerPrivate,
|
||||
nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
|
||||
|
@ -2159,6 +2160,7 @@ public:
|
|||
// By default we set it to same-origin since normal HTTP fetches always
|
||||
// send credentials to same-origin websites unless explicitly forbidden.
|
||||
, mRequestCredentials(RequestCredentials::Same_origin)
|
||||
, mContentPolicyType(nsIContentPolicy::TYPE_INVALID)
|
||||
{
|
||||
MOZ_ASSERT(aWorkerPrivate);
|
||||
}
|
||||
|
@ -2231,6 +2233,12 @@ public:
|
|||
rv = httpChannel->VisitRequestHeaders(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
rv = channel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mContentPolicyType = loadInfo->GetContentPolicyType();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2305,6 +2313,8 @@ private:
|
|||
MOZ_ASSERT(internalReq);
|
||||
internalReq->SetCreatedByFetchEvent();
|
||||
|
||||
request->SetContentPolicyType(mContentPolicyType);
|
||||
|
||||
RootedDictionary<FetchEventInit> init(aCx);
|
||||
init.mRequest.Construct();
|
||||
init.mRequest.Value() = request;
|
||||
|
|
Загрузка…
Ссылка в новой задаче