зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153292 - part3: aboutdebugging: expose sw state from registration, notify listeners on statechange;r=bkelly
As it turns out, the workaround used to detect "not activated" service worker registrations works only in e10s pages. In non e10s, service worker registrations are returned even if they are not in activated state. Here we add the currently associated worker to the registration info, which will be used to determine if the service worker is activated by about debugging. MozReview-Commit-ID: ImeZcXQdBtO --HG-- extra : rebase_source : f7e023708f8954b978b189025fd0b06c587d6a8e
This commit is contained in:
Родитель
83f50d7b52
Коммит
9ee4ee975c
|
@ -29,9 +29,19 @@ interface nsIWorkerDebugger;
|
|||
[scriptable, builtinclass, uuid(76e357ed-208d-4e4c-9165-1c4059707879)]
|
||||
interface nsIServiceWorkerInfo : nsISupports
|
||||
{
|
||||
// State values below should match the ServiceWorkerState enumeration.
|
||||
const unsigned short STATE_INSTALLING = 0;
|
||||
const unsigned short STATE_INSTALLED = 1;
|
||||
const unsigned short STATE_ACTIVATING = 2;
|
||||
const unsigned short STATE_ACTIVATED = 3;
|
||||
const unsigned short STATE_REDUNDANT = 4;
|
||||
const unsigned short STATE_UNKNOWN = 5;
|
||||
|
||||
readonly attribute DOMString scriptSpec;
|
||||
readonly attribute DOMString cacheName;
|
||||
|
||||
readonly attribute unsigned short state;
|
||||
|
||||
readonly attribute nsIWorkerDebugger debugger;
|
||||
|
||||
void attachDebugger();
|
||||
|
|
|
@ -10,6 +10,19 @@
|
|||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
static_assert(nsIServiceWorkerInfo::STATE_INSTALLING == static_cast<uint16_t>(ServiceWorkerState::Installing),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
static_assert(nsIServiceWorkerInfo::STATE_INSTALLED == static_cast<uint16_t>(ServiceWorkerState::Installed),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
static_assert(nsIServiceWorkerInfo::STATE_ACTIVATING == static_cast<uint16_t>(ServiceWorkerState::Activating),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
static_assert(nsIServiceWorkerInfo::STATE_ACTIVATED == static_cast<uint16_t>(ServiceWorkerState::Activated),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
static_assert(nsIServiceWorkerInfo::STATE_REDUNDANT == static_cast<uint16_t>(ServiceWorkerState::Redundant),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
static_assert(nsIServiceWorkerInfo::STATE_UNKNOWN == static_cast<uint16_t>(ServiceWorkerState::EndGuard_),
|
||||
"ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
|
||||
|
||||
NS_IMPL_ISUPPORTS(ServiceWorkerInfo, nsIServiceWorkerInfo)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -28,6 +41,15 @@ ServiceWorkerInfo::GetCacheName(nsAString& aCacheName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerInfo::GetState(uint16_t* aState)
|
||||
{
|
||||
MOZ_ASSERT(aState);
|
||||
AssertIsOnMainThread();
|
||||
*aState = static_cast<uint16_t>(mState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceWorkerInfo::GetDebugger(nsIWorkerDebugger** aResult)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче