зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1534364
- replace OptionalIPCServiceWorkerDescriptor with IPCServiceWorkerDescriptor? in IPDL: r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D23013 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cb3be096ae
Коммит
aad50392d8
|
@ -23,11 +23,5 @@ struct IPCServiceWorkerDescriptor
|
|||
ServiceWorkerState state;
|
||||
};
|
||||
|
||||
union OptionalIPCServiceWorkerDescriptor
|
||||
{
|
||||
IPCServiceWorkerDescriptor;
|
||||
void_t;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -29,9 +29,9 @@ struct IPCServiceWorkerRegistrationDescriptor
|
|||
|
||||
ServiceWorkerUpdateViaCache updateViaCache;
|
||||
|
||||
OptionalIPCServiceWorkerDescriptor installing;
|
||||
OptionalIPCServiceWorkerDescriptor waiting;
|
||||
OptionalIPCServiceWorkerDescriptor active;
|
||||
IPCServiceWorkerDescriptor? installing;
|
||||
IPCServiceWorkerDescriptor? waiting;
|
||||
IPCServiceWorkerDescriptor? active;
|
||||
};
|
||||
|
||||
union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult
|
||||
|
|
|
@ -19,15 +19,12 @@ using mozilla::ipc::PrincipalInfoToPrincipal;
|
|||
Maybe<IPCServiceWorkerDescriptor>
|
||||
ServiceWorkerRegistrationDescriptor::NewestInternal() const {
|
||||
Maybe<IPCServiceWorkerDescriptor> result;
|
||||
if (mData->installing().type() !=
|
||||
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(mData->installing().get_IPCServiceWorkerDescriptor());
|
||||
} else if (mData->waiting().type() !=
|
||||
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(mData->waiting().get_IPCServiceWorkerDescriptor());
|
||||
} else if (mData->active().type() !=
|
||||
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(mData->active().get_IPCServiceWorkerDescriptor());
|
||||
if (mData->installing().isSome()) {
|
||||
result.emplace(mData->installing().ref());
|
||||
} else if (mData->waiting().isSome()) {
|
||||
result.emplace(mData->waiting().ref());
|
||||
} else if (mData->active().isSome()) {
|
||||
result.emplace(mData->active().ref());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -43,9 +40,9 @@ ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
|
|||
mData->version() = aVersion;
|
||||
mData->scope() = aScope;
|
||||
mData->updateViaCache() = aUpdateViaCache;
|
||||
mData->installing() = void_t();
|
||||
mData->waiting() = void_t();
|
||||
mData->active() = void_t();
|
||||
mData->installing() = Nothing();
|
||||
mData->waiting() = Nothing();
|
||||
mData->active() = Nothing();
|
||||
}
|
||||
|
||||
ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
|
||||
|
@ -54,7 +51,7 @@ ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
|
|||
ServiceWorkerUpdateViaCache aUpdateViaCache)
|
||||
: mData(MakeUnique<IPCServiceWorkerRegistrationDescriptor>(
|
||||
aId, aVersion, aPrincipalInfo, nsCString(aScope), aUpdateViaCache,
|
||||
void_t(), void_t(), void_t())) {}
|
||||
Nothing(), Nothing(), Nothing())) {}
|
||||
|
||||
ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
|
||||
const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
|
@ -135,10 +132,8 @@ Maybe<ServiceWorkerDescriptor>
|
|||
ServiceWorkerRegistrationDescriptor::GetInstalling() const {
|
||||
Maybe<ServiceWorkerDescriptor> result;
|
||||
|
||||
if (mData->installing().type() !=
|
||||
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(ServiceWorkerDescriptor(
|
||||
mData->installing().get_IPCServiceWorkerDescriptor()));
|
||||
if (mData->installing().isSome()) {
|
||||
result.emplace(ServiceWorkerDescriptor(mData->installing().ref()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -148,9 +143,8 @@ Maybe<ServiceWorkerDescriptor> ServiceWorkerRegistrationDescriptor::GetWaiting()
|
|||
const {
|
||||
Maybe<ServiceWorkerDescriptor> result;
|
||||
|
||||
if (mData->waiting().type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(ServiceWorkerDescriptor(
|
||||
mData->waiting().get_IPCServiceWorkerDescriptor()));
|
||||
if (mData->waiting().isSome()) {
|
||||
result.emplace(ServiceWorkerDescriptor(mData->waiting().ref()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -160,9 +154,8 @@ Maybe<ServiceWorkerDescriptor> ServiceWorkerRegistrationDescriptor::GetActive()
|
|||
const {
|
||||
Maybe<ServiceWorkerDescriptor> result;
|
||||
|
||||
if (mData->active().type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
result.emplace(ServiceWorkerDescriptor(
|
||||
mData->active().get_IPCServiceWorkerDescriptor()));
|
||||
if (mData->active().isSome()) {
|
||||
result.emplace(ServiceWorkerDescriptor(mData->active().ref()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -191,13 +184,13 @@ bool ServiceWorkerRegistrationDescriptor::HasWorker(
|
|||
namespace {
|
||||
|
||||
bool IsValidWorker(
|
||||
const OptionalIPCServiceWorkerDescriptor& aWorker, const nsACString& aScope,
|
||||
const Maybe<IPCServiceWorkerDescriptor>& aWorker, const nsACString& aScope,
|
||||
const mozilla::ipc::ContentPrincipalInfo& aContentPrincipal) {
|
||||
if (aWorker.type() == OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
if (aWorker.isNothing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto& worker = aWorker.get_IPCServiceWorkerDescriptor();
|
||||
auto& worker = aWorker.ref();
|
||||
if (worker.scope() != aScope) {
|
||||
return false;
|
||||
}
|
||||
|
@ -246,23 +239,23 @@ void ServiceWorkerRegistrationDescriptor::SetWorkers(
|
|||
ServiceWorkerInfo* aActive) {
|
||||
if (aInstalling) {
|
||||
aInstalling->SetRegistrationVersion(Version());
|
||||
mData->installing() = aInstalling->Descriptor().ToIPC();
|
||||
mData->installing() = Some(aInstalling->Descriptor().ToIPC());
|
||||
} else {
|
||||
mData->installing() = void_t();
|
||||
mData->installing() = Nothing();
|
||||
}
|
||||
|
||||
if (aWaiting) {
|
||||
aWaiting->SetRegistrationVersion(Version());
|
||||
mData->waiting() = aWaiting->Descriptor().ToIPC();
|
||||
mData->waiting() = Some(aWaiting->Descriptor().ToIPC());
|
||||
} else {
|
||||
mData->waiting() = void_t();
|
||||
mData->waiting() = Nothing();
|
||||
}
|
||||
|
||||
if (aActive) {
|
||||
aActive->SetRegistrationVersion(Version());
|
||||
mData->active() = aActive->Descriptor().ToIPC();
|
||||
mData->active() = Some(aActive->Descriptor().ToIPC());
|
||||
} else {
|
||||
mData->active() = void_t();
|
||||
mData->active() = Nothing();
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsValid());
|
||||
|
|
|
@ -19,7 +19,6 @@ class PrincipalInfo;
|
|||
namespace dom {
|
||||
|
||||
class IPCServiceWorkerRegistrationDescriptor;
|
||||
class OptionalIPCServiceWorkerDescriptor;
|
||||
class ServiceWorkerInfo;
|
||||
enum class ServiceWorkerUpdateViaCache : uint8_t;
|
||||
|
||||
|
|
|
@ -494,10 +494,10 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
|
|||
ipcInitialClientInfo.emplace(initialClientInfo.ref().ToIPC());
|
||||
}
|
||||
|
||||
OptionalIPCServiceWorkerDescriptor ipcController = mozilla::void_t();
|
||||
Maybe<IPCServiceWorkerDescriptor> ipcController;
|
||||
const Maybe<ServiceWorkerDescriptor>& controller = aLoadInfo->GetController();
|
||||
if (controller.isSome()) {
|
||||
ipcController = controller.ref().ToIPC();
|
||||
ipcController.emplace(controller.ref().ToIPC());
|
||||
}
|
||||
|
||||
nsAutoString cspNonce;
|
||||
|
@ -656,10 +656,9 @@ nsresult LoadInfoArgsToLoadInfo(
|
|||
NS_ERROR_UNEXPECTED);
|
||||
|
||||
Maybe<ServiceWorkerDescriptor> controller;
|
||||
if (loadInfoArgs.controller().type() !=
|
||||
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
controller.emplace(ServiceWorkerDescriptor(
|
||||
loadInfoArgs.controller().get_IPCServiceWorkerDescriptor()));
|
||||
if (loadInfoArgs.controller().isSome()) {
|
||||
controller.emplace(
|
||||
ServiceWorkerDescriptor(loadInfoArgs.controller().ref()));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICookieSettings> cookieSettings;
|
||||
|
@ -709,7 +708,7 @@ void LoadInfoToParentLoadInfoForwarder(
|
|||
nsILoadInfo* aLoadInfo, ParentLoadInfoForwarderArgs* aForwarderArgsOut) {
|
||||
if (!aLoadInfo) {
|
||||
*aForwarderArgsOut = ParentLoadInfoForwarderArgs(
|
||||
false, void_t(), nsILoadInfo::TAINTING_BASIC,
|
||||
false, Nothing(), nsILoadInfo::TAINTING_BASIC,
|
||||
false, // serviceWorkerTaintingSynthesized
|
||||
false, // documentHasUserInteracted
|
||||
false, // documentHasLoaded
|
||||
|
@ -717,10 +716,10 @@ void LoadInfoToParentLoadInfoForwarder(
|
|||
return;
|
||||
}
|
||||
|
||||
OptionalIPCServiceWorkerDescriptor ipcController = void_t();
|
||||
Maybe<IPCServiceWorkerDescriptor> ipcController;
|
||||
Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
|
||||
if (controller.isSome()) {
|
||||
ipcController = controller.ref().ToIPC();
|
||||
ipcController.emplace(controller.ref().ToIPC());
|
||||
}
|
||||
|
||||
uint32_t tainting = nsILoadInfo::TAINTING_BASIC;
|
||||
|
@ -761,9 +760,8 @@ nsresult MergeParentLoadInfoForwarder(
|
|||
|
||||
aLoadInfo->ClearController();
|
||||
auto& controller = aForwarderArgs.controller();
|
||||
if (controller.type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
aLoadInfo->SetController(
|
||||
ServiceWorkerDescriptor(controller.get_IPCServiceWorkerDescriptor()));
|
||||
if (controller.isSome()) {
|
||||
aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref()));
|
||||
}
|
||||
|
||||
if (aForwarderArgs.serviceWorkerTaintingSynthesized()) {
|
||||
|
@ -799,7 +797,7 @@ void LoadInfoToChildLoadInfoForwarder(
|
|||
nsILoadInfo* aLoadInfo, ChildLoadInfoForwarderArgs* aForwarderArgsOut) {
|
||||
if (!aLoadInfo) {
|
||||
*aForwarderArgsOut =
|
||||
ChildLoadInfoForwarderArgs(Nothing(), Nothing(), void_t());
|
||||
ChildLoadInfoForwarderArgs(Nothing(), Nothing(), Nothing());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -815,10 +813,10 @@ void LoadInfoToChildLoadInfoForwarder(
|
|||
ipcInitial.emplace(initial.ref().ToIPC());
|
||||
}
|
||||
|
||||
OptionalIPCServiceWorkerDescriptor ipcController = void_t();
|
||||
Maybe<IPCServiceWorkerDescriptor> ipcController;
|
||||
Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
|
||||
if (controller.isSome()) {
|
||||
ipcController = controller.ref().ToIPC();
|
||||
ipcController.emplace(controller.ref().ToIPC());
|
||||
}
|
||||
|
||||
*aForwarderArgsOut =
|
||||
|
@ -870,9 +868,8 @@ nsresult MergeChildLoadInfoForwarder(
|
|||
|
||||
aLoadInfo->ClearController();
|
||||
auto& controller = aForwarderArgs.controller();
|
||||
if (controller.type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
|
||||
aLoadInfo->SetController(
|
||||
ServiceWorkerDescriptor(controller.get_IPCServiceWorkerDescriptor()));
|
||||
if (controller.isSome()) {
|
||||
aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref()));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -130,7 +130,7 @@ struct LoadInfoArgs
|
|||
* window/worker client. We must send this across IPC to support
|
||||
* performing interception in the parent.
|
||||
*/
|
||||
OptionalIPCServiceWorkerDescriptor controller;
|
||||
IPCServiceWorkerDescriptor? controller;
|
||||
|
||||
nsCString[] corsUnsafeHeaders;
|
||||
bool forcePreflight;
|
||||
|
@ -162,7 +162,7 @@ struct ParentLoadInfoForwarderArgs
|
|||
|
||||
// The ServiceWorker controller that may be set in the parent when
|
||||
// interception occurs.
|
||||
OptionalIPCServiceWorkerDescriptor controller;
|
||||
IPCServiceWorkerDescriptor? controller;
|
||||
|
||||
// The service worker may synthesize a Response with a particular
|
||||
// tainting value.
|
||||
|
@ -200,7 +200,7 @@ struct ChildLoadInfoForwarderArgs
|
|||
|
||||
// The ServiceWorker controller may be cleared in the child during
|
||||
// a redirect.
|
||||
OptionalIPCServiceWorkerDescriptor controller;
|
||||
IPCServiceWorkerDescriptor? controller;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче