Bug 1441932 P2 Remove explicit ServiceWorker controller from http OnStartRequest message. r=mayhemer

This commit is contained in:
Ben Kelly 2018-06-04 09:26:51 -07:00
Родитель 5697bd9f89
Коммит 1030889376
4 изменённых файлов: 1 добавлений и 53 удалений

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

@ -441,7 +441,6 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild>
const uint32_t& aCacheKey,
const nsCString& altDataType,
const int64_t& altDataLen,
Maybe<ServiceWorkerDescriptor>&& aController,
const bool& aApplyConversion)
: NeckoTargetChannelEvent<HttpChannelChild>(aChild)
, mChannelStatus(aChannelStatus)
@ -461,7 +460,6 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild>
, mCacheKey(aCacheKey)
, mAltDataType(altDataType)
, mAltDataLen(altDataLen)
, mController(std::move(aController))
, mLoadInfoForwarder(loadInfoForwarder)
{}
@ -475,7 +473,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild>
mCacheExpirationTime, mCachedCharset,
mSecurityInfoSerialization, mSelfAddr, mPeerAddr,
mCacheKey, mAltDataType, mAltDataLen,
mController, mApplyConversion);
mApplyConversion);
}
private:
@ -496,7 +494,6 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild>
uint32_t mCacheKey;
nsCString mAltDataType;
int64_t mAltDataLen;
Maybe<ServiceWorkerDescriptor> mController;
ParentLoadInfoForwarderArgs mLoadInfoForwarder;
};
@ -519,7 +516,6 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
const uint32_t& cacheKey,
const nsCString& altDataType,
const int64_t& altDataLen,
const OptionalIPCServiceWorkerDescriptor& aController,
const bool& aApplyConversion)
{
LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
@ -532,11 +528,6 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
mRedirectCount = redirectCount;
Maybe<ServiceWorkerDescriptor> controller;
if (aController.type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
controller.emplace(ServiceWorkerDescriptor(
aController.get_IPCServiceWorkerDescriptor()));
}
mEventQ->RunOrEnqueue(new StartRequestEvent(this, channelStatus, responseHead,
useResponseHead, requestHeaders,
@ -547,7 +538,6 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
securityInfoSerialization,
selfAddr, peerAddr, cacheKey,
altDataType, altDataLen,
std::move(controller),
aApplyConversion));
{
@ -590,7 +580,6 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
const uint32_t& cacheKey,
const nsCString& altDataType,
const int64_t& altDataLen,
const Maybe<ServiceWorkerDescriptor>& aController,
const bool& aApplyConversion)
{
LOG(("HttpChannelChild::OnStartRequest [this=%p]\n", this));
@ -630,28 +619,6 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
SetApplyConversion(aApplyConversion);
if (ServiceWorkerParentInterceptEnabled()) {
const Maybe<ServiceWorkerDescriptor>& prevController =
mLoadInfo->GetController();
// If we got a service worker controller from the parent, then note
// it on the LoadInfo. This may indicate that a non-subresource request
// was intercepted and the resulting window/worker should be controlled.
if (aController.isSome() && prevController.isNothing()) {
mLoadInfo->SetController(aController.ref());
}
// If we did not set a controller, then verify it was either because:
// 1. Neither the parent or child know about a controlling service worker.
// 2. The parent and child both have the same controlling service worker.
else {
MOZ_DIAGNOSTIC_ASSERT((prevController.isNothing() && aController.isNothing()) ||
(prevController.ref().Id() == aController.ref().Id() &&
prevController.ref().Scope() == aController.ref().Scope() &&
prevController.ref().PrincipalInfo() == aController.ref().PrincipalInfo()));
}
}
mAfterOnStartRequestBegun = true;
AutoEventEnqueuer ensureSerialDispatch(mEventQ);

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

@ -146,7 +146,6 @@ protected:
const uint32_t& cacheKey,
const nsCString& altDataType,
const int64_t& altDataLen,
const OptionalIPCServiceWorkerDescriptor& aController,
const bool& aApplyConversion) override;
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& status) override;
mozilla::ipc::IPCResult RecvRedirect1Begin(const uint32_t& registrarId,
@ -420,7 +419,6 @@ private:
const uint32_t& cacheKey,
const nsCString& altDataType,
const int64_t& altDataLen,
const Maybe<mozilla::dom::ServiceWorkerDescriptor>& aController,
const bool& aApplyConversion);
void MaybeDivertOnData(const nsCString& data,
const uint64_t& offset,

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

@ -1445,21 +1445,6 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
ParentLoadInfoForwarderArgs loadInfoForwarderArg;
mozilla::ipc::LoadInfoToParentLoadInfoForwarder(loadInfo, &loadInfoForwarderArg);
// Maybe pass back the ServiceWorkerDescriptor controller for this channel.
// For subresource loads the controller is already known when the channel
// is first open and comes down to us via the LoadInfo. For non-subresource
// loads, however, the controller is selected based on the URL by the
// ServiceWorkerManager. In these cases we need to communicate the controller
// back to the child process so the resulting window/worker can set its
// navigator.serviceWorker.controller correctly immediately.
OptionalIPCServiceWorkerDescriptor ipcController = void_t();
if (ServiceWorkerParentInterceptEnabled() && loadInfo) {
const Maybe<ServiceWorkerDescriptor>& controller = loadInfo->GetController();
if (controller.isSome()) {
ipcController = controller.ref().ToIPC();
}
}
// !!! We need to lock headers and please don't forget to unlock them !!!
requestHead->Enter();
rv = NS_OK;
@ -1479,7 +1464,6 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
cacheKey,
altDataType,
altDataLen,
ipcController,
applyConversion))
{
rv = NS_ERROR_UNEXPECTED;

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

@ -111,7 +111,6 @@ child:
uint32_t cacheKey,
nsCString altDataType,
int64_t altDataLength,
OptionalIPCServiceWorkerDescriptor controller,
bool applyConversion);
// Used to cancel child channel if we hit errors during creating and