Skip to content

Commit

Permalink
Bug 1438211 P9 Remove nsPIDOMWindowInner::GetServiceWorkerRegistratio…
Browse files Browse the repository at this point in the history
…n() and InvalidateServiceWorkerRegistration(). r=asuth

--HG--
extra : rebase_source : a02d0490415c01f7c3330de17f9040344b4b96d4
  • Loading branch information
wanderview committed Mar 2, 2018
1 parent cfe642a commit 5cf84a8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 42 deletions.
25 changes: 0 additions & 25 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,6 @@ nsGlobalWindowInner::CleanUp()
mIdleTimer = nullptr;
}

mServiceWorkerRegistrationTable.Clear();

mIntlUtils = nullptr;
}

Expand Down Expand Up @@ -1468,8 +1466,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPerformance)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerRegistrationTable)

#ifdef MOZ_WEBSPEECH
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSpeechSynthesis)
#endif
Expand Down Expand Up @@ -1553,7 +1549,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)

NS_IMPL_CYCLE_COLLECTION_UNLINK(mPerformance)

NS_IMPL_CYCLE_COLLECTION_UNLINK(mServiceWorkerRegistrationTable)

#ifdef MOZ_WEBSPEECH
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSpeechSynthesis)
Expand Down Expand Up @@ -5205,26 +5200,6 @@ nsGlobalWindowInner::GetCaches(ErrorResult& aRv)
return ref.forget();
}

already_AddRefed<ServiceWorkerRegistration>
nsPIDOMWindowInner::GetServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
{
NS_ConvertUTF8toUTF16 scope(aDescriptor.Scope());
RefPtr<ServiceWorkerRegistration> registration;
if (!mServiceWorkerRegistrationTable.Get(scope,
getter_AddRefs(registration))) {
registration =
ServiceWorkerRegistration::CreateForMainThread(this, aDescriptor);
mServiceWorkerRegistrationTable.Put(scope, registration);
}
return registration.forget();
}

void
nsPIDOMWindowInner::InvalidateServiceWorkerRegistration(const nsAString& aScope)
{
mServiceWorkerRegistrationTable.Remove(aScope);
}

void
nsGlobalWindowInner::FireOfflineStatusEventIfChanged()
{
Expand Down
11 changes: 0 additions & 11 deletions dom/base/nsPIDOMWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class Navigator;
class Performance;
class ServiceWorker;
class ServiceWorkerDescriptor;
class ServiceWorkerRegistration;
class ServiceWorkerRegistrationDescriptor;
class Timeout;
class TimeoutManager;
class CustomElementRegistry;
Expand Down Expand Up @@ -190,10 +188,6 @@ class nsPIDOMWindowInner : public mozIDOMWindow
bool GetAudioCaptured() const;
nsresult SetAudioCapture(bool aCapture);

already_AddRefed<mozilla::dom::ServiceWorkerRegistration>
GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor);
void InvalidateServiceWorkerRegistration(const nsAString& aScope);

mozilla::dom::Performance* GetPerformance();

bool HasMutationListeners(uint32_t aMutationEventType) const
Expand Down Expand Up @@ -655,11 +649,6 @@ class nsPIDOMWindowInner : public mozIDOMWindow

RefPtr<mozilla::dom::Navigator> mNavigator;

typedef nsRefPtrHashtable<nsStringHashKey,
mozilla::dom::ServiceWorkerRegistration>
ServiceWorkerRegistrationTable;
ServiceWorkerRegistrationTable mServiceWorkerRegistrationTable;

// These variables are only used on inner windows.
uint32_t mMutationBits;

Expand Down
7 changes: 1 addition & 6 deletions dom/serviceworkers/ServiceWorkerRegistrationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ void
ServiceWorkerRegistrationMainThread::RegistrationRemovedInternal()
{
MOZ_ASSERT(NS_IsMainThread());
// If the registration is being removed completely, remove it from the
// window registration hash table so that a new registration would get a new
// wrapper JS object.
if (mOuter && mOuter->GetOwner()) {
mOuter->GetOwner()->InvalidateServiceWorkerRegistration(mScope);
}

StopListeningForEvents();

// Since the registration is effectively dead in the SWM we can break
Expand Down

0 comments on commit 5cf84a8

Please sign in to comment.