Bug 1455695 P4 Remove ServiceWorkerRegistration::Inner::GetNotifications(). r=baku

This commit is contained in:
Ben Kelly 2018-04-30 07:55:01 -07:00
Родитель 5ff559131c
Коммит 08c921af9d
4 изменённых файлов: 17 добавлений и 37 удалений

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

@ -334,11 +334,26 @@ already_AddRefed<Promise>
ServiceWorkerRegistration::GetNotifications(const GetNotificationOptions& aOptions,
ErrorResult& aRv)
{
if (!mInner) {
nsIGlobalObject* global = GetParentObject();
if (!global) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
return mInner->GetNotifications(aOptions, aRv);
NS_ConvertUTF8toUTF16 scope(mDescriptor.Scope());
if (NS_IsMainThread()) {
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(global);
if (NS_WARN_IF(!window)) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
return Notification::Get(window, aOptions, scope, aRv);
}
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
worker->AssertIsOnWorkerThread();
return Notification::WorkerGet(worker, aOptions, scope, aRv);
}
} // dom namespace

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

@ -49,10 +49,6 @@ public:
virtual RefPtr<GenericPromise>
Unregister() = 0;
virtual already_AddRefed<Promise>
GetNotifications(const GetNotificationOptions& aOptions,
ErrorResult& aRv) = 0;
};
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_SERVICEWORKERREGISTRATION_IID)

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

@ -8,7 +8,6 @@
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "mozilla/dom/PushManagerBinding.h"
@ -572,20 +571,6 @@ ServiceWorkerRegistrationMainThread::Unregister()
return cb->Promise();
}
already_AddRefed<Promise>
ServiceWorkerRegistrationMainThread::GetNotifications(const GetNotificationOptions& aOptions, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(mOuter);
nsCOMPtr<nsPIDOMWindowInner> window = mOuter->GetOwner();
if (NS_WARN_IF(!window)) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
return Notification::Get(window, aOptions, mScope, aRv);
}
////////////////////////////////////////////////////
// Worker Thread implementation
@ -955,14 +940,6 @@ WorkerListener::RegistrationRemoved()
mRegistration->RegistrationRemoved();
}
already_AddRefed<Promise>
ServiceWorkerRegistrationWorkerThread::GetNotifications(const GetNotificationOptions& aOptions,
ErrorResult& aRv)
{
MOZ_ASSERT(mWorkerRef && mWorkerRef->GetPrivate());
return Notification::WorkerGet(mWorkerRef->GetPrivate(), aOptions, mScope, aRv);
}
void
ServiceWorkerRegistrationWorkerThread::UpdateFound()
{

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

@ -48,10 +48,6 @@ public:
RefPtr<GenericPromise>
Unregister() override;
already_AddRefed<Promise>
GetNotifications(const GetNotificationOptions& aOptions,
ErrorResult& aRv) override;
// ServiceWorkerRegistrationListener
void
UpdateFound() override;
@ -119,10 +115,6 @@ public:
RefPtr<GenericPromise>
Unregister() override;
already_AddRefed<Promise>
GetNotifications(const GetNotificationOptions& aOptions,
ErrorResult& aRv) override;
void
UpdateFound();