Bug 1438211 P1 Add nsIGlobalObject::GetOrCreateServiceWorkerRegistration(). r=asuth

--HG--
extra : rebase_source : 50aca93e94142ee42dc4446164aeec1cb2b06c52
This commit is contained in:
Ben Kelly 2018-03-02 13:02:49 -08:00
parent 2bb80b6666
commit 0c368d6063
2 changed files with 17 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include "nsIGlobalObject.h"
#include "mozilla/dom/ServiceWorker.h"
#include "mozilla/dom/ServiceWorkerRegistration.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "nsHostObjectProtocolHandler.h"
@ -17,6 +18,8 @@ using mozilla::DOMEventTargetHelper;
using mozilla::dom::ClientInfo;
using mozilla::dom::ServiceWorker;
using mozilla::dom::ServiceWorkerDescriptor;
using mozilla::dom::ServiceWorkerRegistration;
using mozilla::dom::ServiceWorkerRegistrationDescriptor;
nsIGlobalObject::~nsIGlobalObject()
{
@ -196,6 +199,13 @@ nsIGlobalObject::GetOrCreateServiceWorker(const ServiceWorkerDescriptor& aDescri
return nullptr;
}
RefPtr<ServiceWorkerRegistration>
nsIGlobalObject::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
{
MOZ_DIAGNOSTIC_ASSERT(false, "this global should not have any service worker registrations");
return nullptr;
}
size_t
nsIGlobalObject::ShallowSizeOfExcludingThis(MallocSizeOf aSizeOf) const
{

View File

@ -30,6 +30,8 @@ namespace mozilla {
class DOMEventTargetHelper;
namespace dom {
class ServiceWorker;
class ServiceWorkerRegistration;
class ServiceWorkerRegistrationDescriptor;
} // namespace dom
} // namespace mozilla
@ -119,6 +121,11 @@ public:
virtual RefPtr<mozilla::dom::ServiceWorker>
GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor);
// Get the DOM object for the given descriptor or attempt to create one.
// Creation can still fail and return nullptr during shutdown, etc.
virtual RefPtr<mozilla::dom::ServiceWorkerRegistration>
GetOrCreateServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor);
protected:
virtual ~nsIGlobalObject();