Bug 1469048 Disable service worker propagation when e10s pref is enabled. r=mrbkap

--HG--
extra : rebase_source : f7a11d459a7f54ecc8b71746ff2810a7bb276692
This commit is contained in:
Ben Kelly 2018-07-09 16:02:41 -07:00
Родитель 87bf0f7f23
Коммит a99ba38721
6 изменённых файлов: 46 добавлений и 5 удалений

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

@ -59,6 +59,7 @@
#include "mozilla/dom/PPresentationParent.h" #include "mozilla/dom/PPresentationParent.h"
#include "mozilla/dom/PushNotifier.h" #include "mozilla/dom/PushNotifier.h"
#include "mozilla/dom/quota/QuotaManagerService.h" #include "mozilla/dom/quota/QuotaManagerService.h"
#include "mozilla/dom/ServiceWorkerUtils.h"
#include "mozilla/dom/URLClassifierParent.h" #include "mozilla/dom/URLClassifierParent.h"
#include "mozilla/embedding/printingui/PrintingParent.h" #include "mozilla/embedding/printingui/PrintingParent.h"
#include "mozilla/extensions/StreamFilterParent.h" #include "mozilla/extensions/StreamFilterParent.h"
@ -2468,7 +2469,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority)
} }
#endif #endif
{ if (!ServiceWorkerParentInterceptEnabled()) {
RefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get(); RefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get();
MOZ_ASSERT(swr); MOZ_ASSERT(swr);

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

@ -168,6 +168,8 @@ ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
, mSkipWaitingFlag(false) , mSkipWaitingFlag(false)
, mHandlesFetch(Unknown) , mHandlesFetch(Unknown)
{ {
MOZ_ASSERT_IF(ServiceWorkerParentInterceptEnabled(),
XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(mPrincipal); MOZ_ASSERT(mPrincipal);
// cache origin attributes so we can use them off main thread // cache origin attributes so we can use them off main thread
mOriginAttributes = mPrincipal->OriginAttributesRef(); mOriginAttributes = mPrincipal->OriginAttributesRef();

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

@ -2318,6 +2318,11 @@ ServiceWorkerManager::SoftUpdate(const OriginAttributes& aOriginAttributes,
return; return;
} }
if (ServiceWorkerParentInterceptEnabled()) {
SoftUpdateInternal(aOriginAttributes, aScope, nullptr);
return;
}
RefPtr<GenericPromise::Private> promise = RefPtr<GenericPromise::Private> promise =
new GenericPromise::Private(__func__); new GenericPromise::Private(__func__);
@ -2379,7 +2384,6 @@ ServiceWorkerManager::SoftUpdateInternal(const OriginAttributes& aOriginAttribut
ServiceWorkerUpdateFinishCallback* aCallback) ServiceWorkerUpdateFinishCallback* aCallback)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aCallback);
if (mShuttingDown) { if (mShuttingDown) {
return; return;
@ -2439,8 +2443,10 @@ ServiceWorkerManager::SoftUpdateInternal(const OriginAttributes& aOriginAttribut
newest->ScriptSpec(), nullptr, newest->ScriptSpec(), nullptr,
registration->GetUpdateViaCache()); registration->GetUpdateViaCache());
RefPtr<UpdateJobCallback> cb = new UpdateJobCallback(aCallback); if (aCallback) {
job->AppendResultCallback(cb); RefPtr<UpdateJobCallback> cb = new UpdateJobCallback(aCallback);
job->AppendResultCallback(cb);
}
queue->ScheduleJob(job); queue->ScheduleJob(job);
} }
@ -2452,6 +2458,11 @@ ServiceWorkerManager::Update(nsIPrincipal* aPrincipal,
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (ServiceWorkerParentInterceptEnabled()) {
UpdateInternal(aPrincipal, aScope, aCallback);
return;
}
RefPtr<GenericPromise::Private> promise = RefPtr<GenericPromise::Private> promise =
new GenericPromise::Private(__func__); new GenericPromise::Private(__func__);

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

@ -91,6 +91,10 @@ ServiceWorkerManagerService::PropagateRegistration(
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
if (ServiceWorkerParentInterceptEnabled()) {
return;
}
DebugOnly<bool> parentFound = false; DebugOnly<bool> parentFound = false;
for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) { for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey(); RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey();
@ -133,6 +137,10 @@ ServiceWorkerManagerService::PropagateSoftUpdate(
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
if (ServiceWorkerParentInterceptEnabled()) {
return;
}
DebugOnly<bool> parentFound = false; DebugOnly<bool> parentFound = false;
for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) { for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey(); RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey();
@ -162,6 +170,10 @@ ServiceWorkerManagerService::PropagateUnregister(
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
if (ServiceWorkerParentInterceptEnabled()) {
return;
}
RefPtr<dom::ServiceWorkerRegistrar> service = RefPtr<dom::ServiceWorkerRegistrar> service =
dom::ServiceWorkerRegistrar::Get(); dom::ServiceWorkerRegistrar::Get();
MOZ_ASSERT(service); MOZ_ASSERT(service);
@ -197,6 +209,10 @@ ServiceWorkerManagerService::PropagateRemove(uint64_t aParentID,
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
if (ServiceWorkerParentInterceptEnabled()) {
return;
}
DebugOnly<bool> parentFound = false; DebugOnly<bool> parentFound = false;
for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) { for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey(); RefPtr<ServiceWorkerManagerParent> parent = iter.Get()->GetKey();
@ -222,6 +238,10 @@ ServiceWorkerManagerService::PropagateRemoveAll(uint64_t aParentID)
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
if (ServiceWorkerParentInterceptEnabled()) {
return;
}
RefPtr<dom::ServiceWorkerRegistrar> service = RefPtr<dom::ServiceWorkerRegistrar> service =
dom::ServiceWorkerRegistrar::Get(); dom::ServiceWorkerRegistrar::Get();
MOZ_ASSERT(service); MOZ_ASSERT(service);
@ -255,6 +275,8 @@ ServiceWorkerManagerService::ProcessUpdaterActor(ServiceWorkerUpdaterParent* aAc
{ {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
MOZ_DIAGNOSTIC_ASSERT(!ServiceWorkerParentInterceptEnabled());
nsAutoCString suffix; nsAutoCString suffix;
aOriginAttributes.CreateSuffix(suffix); aOriginAttributes.CreateSuffix(suffix);

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

@ -108,7 +108,10 @@ ServiceWorkerRegistrationInfo::ServiceWorkerRegistrationInfo(
, mLastUpdateTime(0) , mLastUpdateTime(0)
, mPendingUninstall(false) , mPendingUninstall(false)
, mCorrupt(false) , mCorrupt(false)
{} {
MOZ_ASSERT_IF(ServiceWorkerParentInterceptEnabled(),
XRE_GetProcessType() == GeckoProcessType_Default);
}
ServiceWorkerRegistrationInfo::~ServiceWorkerRegistrationInfo() ServiceWorkerRegistrationInfo::~ServiceWorkerRegistrationInfo()
{ {

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

@ -19,6 +19,8 @@ ServiceWorkerUpdaterChild::ServiceWorkerUpdaterChild(GenericPromise* aPromise,
// TODO: remove the main thread restriction after fixing bug 1364821. // TODO: remove the main thread restriction after fixing bug 1364821.
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!ServiceWorkerParentInterceptEnabled());
MOZ_ASSERT(aPromise); MOZ_ASSERT(aPromise);
MOZ_ASSERT(aSuccessRunnable); MOZ_ASSERT(aSuccessRunnable);
MOZ_ASSERT(aFailureRunnable); MOZ_ASSERT(aFailureRunnable);