Bug 1306397 - Remove B2G event 'network-active-changed' and consumers from non-B2G/Gonk files: netwerk. r?mayhemer
MozReview-Commit-ID: 5YfclnGR0NZ
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -160,17 +160,16 @@ int16_t gBadPortList[] = {
6668, // Alternate IRC [Apple addition]
6669, // Alternate IRC [Apple addition]
0, // This MUST be zero so that we can populating the array
};
static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown";
static const char kProfileChangeNetRestoreTopic[] = "profile-change-net-restore";
static const char kProfileDoChange[] = "profile-do-change";
-static const char kNetworkActiveChanged[] = "network-active-changed";
// Necko buffer defaults
uint32_t nsIOService::gDefaultSegmentSize = 4096;
uint32_t nsIOService::gDefaultSegmentCount = 24;
bool nsIOService::sTelemetryEnabled = false;
NS_IMPL_ISUPPORTS(nsAppOfflineInfo, nsIAppOfflineInfo)
@@ -244,17 +243,16 @@ nsIOService::Init()
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (observerService) {
observerService->AddObserver(this, kProfileChangeNetTeardownTopic, true);
observerService->AddObserver(this, kProfileChangeNetRestoreTopic, true);
observerService->AddObserver(this, kProfileDoChange, true);
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
observerService->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true);
- observerService->AddObserver(this, kNetworkActiveChanged, true);
}
else
NS_WARNING("failed to get observer service");
Preferences::AddBoolVarCache(&sTelemetryEnabled, "toolkit.telemetry.enabled", false);
Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true);
gIOService = this;
@@ -1487,48 +1485,16 @@ nsIOService::Observe(nsISupports *subjec
} else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get());
} else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
// coming back alive from sleep
// this indirection brought to you by:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1152048#c19
nsCOMPtr<nsIRunnable> wakeupNotifier = new nsWakeupNotifier(this);
NS_DispatchToMainThread(wakeupNotifier);
- } else if (!strcmp(topic, kNetworkActiveChanged)) {
-#ifdef MOZ_WIDGET_GONK
- if (IsNeckoChild()) {
- return NS_OK;
- }
- nsCOMPtr<nsINetworkInfo> interface = do_QueryInterface(subject);
- if (!interface) {
- return NS_ERROR_FAILURE;
- }
- int32_t state;
- if (NS_FAILED(interface->GetState(&state))) {
- return NS_ERROR_FAILURE;
- }
-
- bool wifiActive = IsWifiActive();
- int32_t newWifiState = wifiActive ?
- nsINetworkInfo::NETWORK_TYPE_WIFI :
- nsINetworkInfo::NETWORK_TYPE_MOBILE;
- if (mPreviousWifiState != newWifiState) {
- // Notify wifi-only apps of their new status
- int32_t status = wifiActive ?
- nsIAppOfflineInfo::ONLINE : nsIAppOfflineInfo::OFFLINE;
-
- for (auto it = mAppsOfflineStatus.Iter(); !it.Done(); it.Next()) {
- if (it.UserData() == nsIAppOfflineInfo::WIFI_ONLY) {
- NotifyAppOfflineStatus(it.Key(), status);
- }
- }
- }
-
- mPreviousWifiState = newWifiState;
-#endif
}
return NS_OK;
}
// nsINetUtil interface
NS_IMETHODIMP
nsIOService::ParseRequestContentType(const nsACString &aTypeHeader,