Backed out changeset a5beba8cc190 (bug 1534364) for assertion failures

This commit is contained in:
Andreea Pavel 2019-03-14 23:14:31 +02:00
Родитель fc71adb962
Коммит af20d1c10b
6 изменённых файлов: 63 добавлений и 46 удалений

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

@ -23,5 +23,11 @@ struct IPCServiceWorkerDescriptor
ServiceWorkerState state; ServiceWorkerState state;
}; };
union OptionalIPCServiceWorkerDescriptor
{
IPCServiceWorkerDescriptor;
void_t;
};
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

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

@ -29,9 +29,9 @@ struct IPCServiceWorkerRegistrationDescriptor
ServiceWorkerUpdateViaCache updateViaCache; ServiceWorkerUpdateViaCache updateViaCache;
IPCServiceWorkerDescriptor? installing; OptionalIPCServiceWorkerDescriptor installing;
IPCServiceWorkerDescriptor? waiting; OptionalIPCServiceWorkerDescriptor waiting;
IPCServiceWorkerDescriptor? active; OptionalIPCServiceWorkerDescriptor active;
}; };
union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult

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

@ -19,12 +19,15 @@ using mozilla::ipc::PrincipalInfoToPrincipal;
Maybe<IPCServiceWorkerDescriptor> Maybe<IPCServiceWorkerDescriptor>
ServiceWorkerRegistrationDescriptor::NewestInternal() const { ServiceWorkerRegistrationDescriptor::NewestInternal() const {
Maybe<IPCServiceWorkerDescriptor> result; Maybe<IPCServiceWorkerDescriptor> result;
if (mData->installing().isSome()) { if (mData->installing().type() !=
result.emplace(mData->installing().ref()); OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
} else if (mData->waiting().isSome()) { result.emplace(mData->installing().get_IPCServiceWorkerDescriptor());
result.emplace(mData->waiting().ref()); } else if (mData->waiting().type() !=
} else if (mData->active().isSome()) { OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
result.emplace(mData->active().ref()); result.emplace(mData->waiting().get_IPCServiceWorkerDescriptor());
} else if (mData->active().type() !=
OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
result.emplace(mData->active().get_IPCServiceWorkerDescriptor());
} }
return result; return result;
} }
@ -40,9 +43,9 @@ ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
mData->version() = aVersion; mData->version() = aVersion;
mData->scope() = aScope; mData->scope() = aScope;
mData->updateViaCache() = aUpdateViaCache; mData->updateViaCache() = aUpdateViaCache;
mData->installing() = Nothing(); mData->installing() = void_t();
mData->waiting() = Nothing(); mData->waiting() = void_t();
mData->active() = Nothing(); mData->active() = void_t();
} }
ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor( ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
@ -51,7 +54,7 @@ ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
ServiceWorkerUpdateViaCache aUpdateViaCache) ServiceWorkerUpdateViaCache aUpdateViaCache)
: mData(MakeUnique<IPCServiceWorkerRegistrationDescriptor>( : mData(MakeUnique<IPCServiceWorkerRegistrationDescriptor>(
aId, aVersion, aPrincipalInfo, nsCString(aScope), aUpdateViaCache, aId, aVersion, aPrincipalInfo, nsCString(aScope), aUpdateViaCache,
Nothing(), Nothing(), Nothing())) {} void_t(), void_t(), void_t())) {}
ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor( ServiceWorkerRegistrationDescriptor::ServiceWorkerRegistrationDescriptor(
const IPCServiceWorkerRegistrationDescriptor& aDescriptor) const IPCServiceWorkerRegistrationDescriptor& aDescriptor)
@ -132,8 +135,10 @@ Maybe<ServiceWorkerDescriptor>
ServiceWorkerRegistrationDescriptor::GetInstalling() const { ServiceWorkerRegistrationDescriptor::GetInstalling() const {
Maybe<ServiceWorkerDescriptor> result; Maybe<ServiceWorkerDescriptor> result;
if (mData->installing().isSome()) { if (mData->installing().type() !=
result.emplace(ServiceWorkerDescriptor(mData->installing().ref())); OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
result.emplace(ServiceWorkerDescriptor(
mData->installing().get_IPCServiceWorkerDescriptor()));
} }
return result; return result;
@ -143,8 +148,9 @@ Maybe<ServiceWorkerDescriptor> ServiceWorkerRegistrationDescriptor::GetWaiting()
const { const {
Maybe<ServiceWorkerDescriptor> result; Maybe<ServiceWorkerDescriptor> result;
if (mData->waiting().isSome()) { if (mData->waiting().type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
result.emplace(ServiceWorkerDescriptor(mData->waiting().ref())); result.emplace(ServiceWorkerDescriptor(
mData->waiting().get_IPCServiceWorkerDescriptor()));
} }
return result; return result;
@ -154,8 +160,9 @@ Maybe<ServiceWorkerDescriptor> ServiceWorkerRegistrationDescriptor::GetActive()
const { const {
Maybe<ServiceWorkerDescriptor> result; Maybe<ServiceWorkerDescriptor> result;
if (mData->active().isSome()) { if (mData->active().type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
result.emplace(ServiceWorkerDescriptor(mData->active().ref())); result.emplace(ServiceWorkerDescriptor(
mData->active().get_IPCServiceWorkerDescriptor()));
} }
return result; return result;
@ -184,13 +191,13 @@ bool ServiceWorkerRegistrationDescriptor::HasWorker(
namespace { namespace {
bool IsValidWorker( bool IsValidWorker(
const Maybe<IPCServiceWorkerDescriptor>& aWorker, const nsACString& aScope, const OptionalIPCServiceWorkerDescriptor& aWorker, const nsACString& aScope,
const mozilla::ipc::ContentPrincipalInfo& aContentPrincipal) { const mozilla::ipc::ContentPrincipalInfo& aContentPrincipal) {
if (aWorker.isNothing()) { if (aWorker.type() == OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
return true; return true;
} }
auto& worker = aWorker.ref(); auto& worker = aWorker.get_IPCServiceWorkerDescriptor();
if (worker.scope() != aScope) { if (worker.scope() != aScope) {
return false; return false;
} }
@ -239,23 +246,23 @@ void ServiceWorkerRegistrationDescriptor::SetWorkers(
ServiceWorkerInfo* aActive) { ServiceWorkerInfo* aActive) {
if (aInstalling) { if (aInstalling) {
aInstalling->SetRegistrationVersion(Version()); aInstalling->SetRegistrationVersion(Version());
mData->installing().emplace(aInstalling->Descriptor().ToIPC()); mData->installing() = aInstalling->Descriptor().ToIPC();
} else { } else {
mData->installing() = Nothing(); mData->installing() = void_t();
} }
if (aWaiting) { if (aWaiting) {
aWaiting->SetRegistrationVersion(Version()); aWaiting->SetRegistrationVersion(Version());
mData->waiting().emplace(aWaiting->Descriptor().ToIPC()); mData->waiting() = aWaiting->Descriptor().ToIPC();
} else { } else {
mData->waiting() = Nothing(); mData->waiting() = void_t();
} }
if (aActive) { if (aActive) {
aActive->SetRegistrationVersion(Version()); aActive->SetRegistrationVersion(Version());
mData->active().emplace(aActive->Descriptor().ToIPC()); mData->active() = aActive->Descriptor().ToIPC();
} else { } else {
mData->active() = Nothing(); mData->active() = void_t();
} }
MOZ_DIAGNOSTIC_ASSERT(IsValid()); MOZ_DIAGNOSTIC_ASSERT(IsValid());

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

@ -19,6 +19,7 @@ class PrincipalInfo;
namespace dom { namespace dom {
class IPCServiceWorkerRegistrationDescriptor; class IPCServiceWorkerRegistrationDescriptor;
class OptionalIPCServiceWorkerDescriptor;
class ServiceWorkerInfo; class ServiceWorkerInfo;
enum class ServiceWorkerUpdateViaCache : uint8_t; enum class ServiceWorkerUpdateViaCache : uint8_t;

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

@ -494,10 +494,10 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
ipcInitialClientInfo.emplace(initialClientInfo.ref().ToIPC()); ipcInitialClientInfo.emplace(initialClientInfo.ref().ToIPC());
} }
Maybe<IPCServiceWorkerDescriptor> ipcController; OptionalIPCServiceWorkerDescriptor ipcController = mozilla::void_t();
const Maybe<ServiceWorkerDescriptor>& controller = aLoadInfo->GetController(); const Maybe<ServiceWorkerDescriptor>& controller = aLoadInfo->GetController();
if (controller.isSome()) { if (controller.isSome()) {
ipcController.emplace(controller.ref().ToIPC()); ipcController = controller.ref().ToIPC();
} }
nsAutoString cspNonce; nsAutoString cspNonce;
@ -656,9 +656,10 @@ nsresult LoadInfoArgsToLoadInfo(
NS_ERROR_UNEXPECTED); NS_ERROR_UNEXPECTED);
Maybe<ServiceWorkerDescriptor> controller; Maybe<ServiceWorkerDescriptor> controller;
if (loadInfoArgs.controller().isSome()) { if (loadInfoArgs.controller().type() !=
controller.emplace( OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
ServiceWorkerDescriptor(loadInfoArgs.controller().ref())); controller.emplace(ServiceWorkerDescriptor(
loadInfoArgs.controller().get_IPCServiceWorkerDescriptor()));
} }
nsCOMPtr<nsICookieSettings> cookieSettings; nsCOMPtr<nsICookieSettings> cookieSettings;
@ -708,7 +709,7 @@ void LoadInfoToParentLoadInfoForwarder(
nsILoadInfo* aLoadInfo, ParentLoadInfoForwarderArgs* aForwarderArgsOut) { nsILoadInfo* aLoadInfo, ParentLoadInfoForwarderArgs* aForwarderArgsOut) {
if (!aLoadInfo) { if (!aLoadInfo) {
*aForwarderArgsOut = ParentLoadInfoForwarderArgs( *aForwarderArgsOut = ParentLoadInfoForwarderArgs(
false, Nothing(), nsILoadInfo::TAINTING_BASIC, false, void_t(), nsILoadInfo::TAINTING_BASIC,
false, // serviceWorkerTaintingSynthesized false, // serviceWorkerTaintingSynthesized
false, // documentHasUserInteracted false, // documentHasUserInteracted
false, // documentHasLoaded false, // documentHasLoaded
@ -716,10 +717,10 @@ void LoadInfoToParentLoadInfoForwarder(
return; return;
} }
Maybe<IPCServiceWorkerDescriptor> ipcController; OptionalIPCServiceWorkerDescriptor ipcController = void_t();
Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController()); Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
if (controller.isSome()) { if (controller.isSome()) {
ipcController.emplace(controller.ref().ToIPC()); ipcController = controller.ref().ToIPC();
} }
uint32_t tainting = nsILoadInfo::TAINTING_BASIC; uint32_t tainting = nsILoadInfo::TAINTING_BASIC;
@ -760,8 +761,9 @@ nsresult MergeParentLoadInfoForwarder(
aLoadInfo->ClearController(); aLoadInfo->ClearController();
auto& controller = aForwarderArgs.controller(); auto& controller = aForwarderArgs.controller();
if (controller.isSome()) { if (controller.type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref())); aLoadInfo->SetController(
ServiceWorkerDescriptor(controller.get_IPCServiceWorkerDescriptor()));
} }
if (aForwarderArgs.serviceWorkerTaintingSynthesized()) { if (aForwarderArgs.serviceWorkerTaintingSynthesized()) {
@ -797,7 +799,7 @@ void LoadInfoToChildLoadInfoForwarder(
nsILoadInfo* aLoadInfo, ChildLoadInfoForwarderArgs* aForwarderArgsOut) { nsILoadInfo* aLoadInfo, ChildLoadInfoForwarderArgs* aForwarderArgsOut) {
if (!aLoadInfo) { if (!aLoadInfo) {
*aForwarderArgsOut = *aForwarderArgsOut =
ChildLoadInfoForwarderArgs(Nothing(), Nothing(), Nothing()); ChildLoadInfoForwarderArgs(Nothing(), Nothing(), void_t());
return; return;
} }
@ -813,10 +815,10 @@ void LoadInfoToChildLoadInfoForwarder(
ipcInitial.emplace(initial.ref().ToIPC()); ipcInitial.emplace(initial.ref().ToIPC());
} }
Maybe<IPCServiceWorkerDescriptor> ipcController; OptionalIPCServiceWorkerDescriptor ipcController = void_t();
Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController()); Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
if (controller.isSome()) { if (controller.isSome()) {
ipcController.emplace(controller.ref().ToIPC()); ipcController = controller.ref().ToIPC();
} }
*aForwarderArgsOut = *aForwarderArgsOut =
@ -868,8 +870,9 @@ nsresult MergeChildLoadInfoForwarder(
aLoadInfo->ClearController(); aLoadInfo->ClearController();
auto& controller = aForwarderArgs.controller(); auto& controller = aForwarderArgs.controller();
if (controller.isSome()) { if (controller.type() != OptionalIPCServiceWorkerDescriptor::Tvoid_t) {
aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref())); aLoadInfo->SetController(
ServiceWorkerDescriptor(controller.get_IPCServiceWorkerDescriptor()));
} }
return NS_OK; return NS_OK;

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

@ -130,7 +130,7 @@ struct LoadInfoArgs
* window/worker client. We must send this across IPC to support * window/worker client. We must send this across IPC to support
* performing interception in the parent. * performing interception in the parent.
*/ */
IPCServiceWorkerDescriptor? controller; OptionalIPCServiceWorkerDescriptor controller;
nsCString[] corsUnsafeHeaders; nsCString[] corsUnsafeHeaders;
bool forcePreflight; bool forcePreflight;
@ -162,7 +162,7 @@ struct ParentLoadInfoForwarderArgs
// The ServiceWorker controller that may be set in the parent when // The ServiceWorker controller that may be set in the parent when
// interception occurs. // interception occurs.
IPCServiceWorkerDescriptor? controller; OptionalIPCServiceWorkerDescriptor controller;
// The service worker may synthesize a Response with a particular // The service worker may synthesize a Response with a particular
// tainting value. // tainting value.
@ -200,7 +200,7 @@ struct ChildLoadInfoForwarderArgs
// The ServiceWorker controller may be cleared in the child during // The ServiceWorker controller may be cleared in the child during
// a redirect. // a redirect.
IPCServiceWorkerDescriptor? controller; OptionalIPCServiceWorkerDescriptor controller;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------