Bug 1373675 - Add hasListenerFor to nsIWebSocketEventService. r=mcmanus

This makes it possible to check if a Window has 'active' WebSockets.
This commit is contained in:
Andreas Farre 2017-06-16 07:58:00 -04:00
parent 2edc8a2488
commit a288a87eba
2 changed files with 13 additions and 0 deletions

View File

@ -440,6 +440,17 @@ WebSocketEventService::RemoveListener(uint64_t aInnerWindowID,
return NS_OK;
}
NS_IMETHODIMP
WebSocketEventService::HasListenerFor(uint64_t aInnerWindowID,
bool* aResult)
{
MOZ_ASSERT(NS_IsMainThread());
*aResult = mWindows.Get(aInnerWindowID);
return NS_OK;
}
NS_IMETHODIMP
WebSocketEventService::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData)

View File

@ -76,4 +76,6 @@ interface nsIWebSocketEventService : nsISupports
[must_use] void removeListener(in unsigned long long aInnerWindowID,
in nsIWebSocketEventListener aListener);
[must_use] bool hasListenerFor(in unsigned long long aInnerWindowID);
};