diff --git a/netwerk/base/public/nsIIOService.idl b/netwerk/base/public/nsIIOService.idl index 3e9070ccb4f..d028829f5d6 100644 --- a/netwerk/base/public/nsIIOService.idl +++ b/netwerk/base/public/nsIIOService.idl @@ -106,6 +106,11 @@ interface nsIIOService : nsISupports */ boolean isAppOffline(in uint32_t appId); + /** + * Returns the state of the app with the given appId. + * returns nsIAppOfflineInfo::{ONLINE,OFFLINE,WIFI_ONLY} + */ + long getAppOfflineState(in uint32_t appId); /** * Checks if a port number is banned. This involves consulting a list of diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index e4d27ddb98b..e89e3062244 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -1505,6 +1505,22 @@ nsIOService::SetAppOfflineInternal(uint32_t aAppId, int32_t aState) } +NS_IMETHODIMP +nsIOService::GetAppOfflineState(uint32_t aAppId, int32_t *aResult) +{ + NS_ENSURE_ARG(aResult); + + if (aAppId == NECKO_NO_APP_ID || + aAppId == NECKO_UNKNOWN_APP_ID) { + return NS_ERROR_NOT_AVAILABLE; + } + + *aResult = nsIAppOfflineInfo::ONLINE; + mAppsOfflineStatus.Get(aAppId, aResult); + + return NS_OK; +} + NS_IMETHODIMP nsIOService::IsAppOffline(uint32_t aAppId, bool* aResult) {