Bug 786419 - Part 12: Add getAppOfflineState to nsIIOService r=jduell
--- a/netwerk/base/public/nsIIOService.idl
+++ b/netwerk/base/public/nsIIOService.idl
@@ -101,16 +101,21 @@ interface nsIIOService : nsISupports
/**
* Returns true if given appId is currently not allowed to make network
* connections. It will return true if the app is in the wifi-only state
* and we are currently on a 3G connection.
* The returned value does not depend on the offline state of the browser.
*/
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
* unsafe ports, corresponding to network services that may be easily
* exploitable. If the given port is considered unsafe, then the protocol
* handler (corresponding to aScheme) will be asked whether it wishes to
* override the IO service's decision to block the port. This gives the
* protocol handler ultimate control over its own security policy while
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -1501,16 +1501,32 @@ nsIOService::SetAppOfflineInternal(uint3
break;
default:
break;
}
}
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)
{
NS_ENSURE_ARG(aResult);
*aResult = false;
if (aAppId == NECKO_NO_APP_ID ||
aAppId == NECKO_UNKNOWN_APP_ID) {
return NS_ERROR_NOT_AVAILABLE;