Skip to content

Commit

Permalink
Bug 939318 - protocolproxy service acts on network interface changes.…
Browse files Browse the repository at this point in the history
… r=mcmanus
  • Loading branch information
bagder committed Aug 25, 2014
1 parent 0d9d99d commit 2cc297e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions netwerk/base/src/nsProtocolProxyService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "mozilla/Mutex.h"
#include "mozilla/CondVar.h"
#include "nsISystemProxySettings.h"
#include "nsINetworkLinkService.h"

//----------------------------------------------------------------------------

Expand Down Expand Up @@ -414,11 +415,15 @@ nsProtocolProxyService::Init()
PrefsChanged(prefBranch, nullptr);
}

// register for shutdown notification so we can clean ourselves up properly.
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs)
if (obs) {
// register for shutdown notification so we can clean ourselves up
// properly.
obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);

obs->AddObserver(this, NS_NETWORK_LINK_TOPIC, false);
}

return NS_OK;
}

Expand All @@ -440,6 +445,13 @@ nsProtocolProxyService::Observe(nsISupports *aSubject,
mPACMan->Shutdown();
mPACMan = nullptr;
}
} else if (strcmp(aTopic, NS_NETWORK_LINK_TOPIC) == 0) {
nsCString converted = NS_ConvertUTF16toUTF8(aData);
const char *state = converted.get();
if (strcmp(state, NS_NETWORK_LINK_DATA_CHANGED) == 0) {
LOG((": received network event: %s, reload PAC", state));
ReloadPAC();
}
}
else {
NS_ASSERTION(strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0,
Expand Down

0 comments on commit 2cc297e

Please sign in to comment.