Bug 1080017 - Don't send Geolocation messages during shutdown. r=jdm
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -913,17 +913,19 @@ nsGeolocationService::HighAccuracyReques
void
nsGeolocationService::UpdateAccuracy(bool aForceHigh)
{
bool highRequired = aForceHigh || HighAccuracyRequested();
if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
- cpc->SendSetGeolocationHigherAccuracy(highRequired);
+ if (cpc->IsAlive()) {
+ cpc->SendSetGeolocationHigherAccuracy(highRequired);
+ }
return;
}
if (!mHigherAccuracy && highRequired) {
mProvider->SetHighAccuracy(true);
}
if (mHigherAccuracy && !highRequired) {
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -525,16 +525,17 @@ ReinitTaskTracer(void* /*aUnused*/)
#endif
ContentChild::ContentChild()
: mID(uint64_t(-1))
#ifdef ANDROID
,mScreenSize(0, 0)
#endif
, mCanOverrideProcessName(true)
+ , mIsAlive(true)
{
// This process is a content process, so it's clearly running in
// multiprocess mode!
nsDebugImpl::SetMultiprocessMode("Child");
}
ContentChild::~ContentChild()
{
@@ -663,16 +664,22 @@ ContentChild::SetProcessName(const nsASt
}
void
ContentChild::GetProcessName(nsAString& aName)
{
aName.Assign(mProcessName);
}
+bool
+ContentChild::IsAlive()
+{
+ return mIsAlive;
+}
+
void
ContentChild::GetProcessName(nsACString& aName)
{
aName.Assign(NS_ConvertUTF16toUTF8(mProcessName));
}
/* static */ void
ContentChild::AppendProcessId(nsACString& aName)
@@ -1635,16 +1642,17 @@ ContentChild::ActorDestroy(ActorDestroyR
mIdleObservers.Clear();
nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
if (svc) {
svc->UnregisterListener(mConsoleListener);
mConsoleListener->mChild = nullptr;
}
+ mIsAlive = false;
XRE_ShutdownChildProcess();
}
void
ContentChild::ProcessingError(Result what)
{
switch (what) {
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -82,20 +82,20 @@ public:
static ContentChild* GetSingleton() {
return sSingleton;
}
const AppInfo& GetAppInfo() {
return mAppInfo;
}
-
void SetProcessName(const nsAString& aName, bool aDontOverride = false);
void GetProcessName(nsAString& aName);
void GetProcessName(nsACString& aName);
+ bool IsAlive();
static void AppendProcessId(nsACString& aName);
ContentBridgeParent* GetLastBridge() {
MOZ_ASSERT(mLastBridge);
ContentBridgeParent* parent = mLastBridge;
mLastBridge = nullptr;
return parent;
}
@@ -416,16 +416,17 @@ private:
#ifdef ANDROID
gfxIntSize mScreenSize;
#endif
bool mIsForApp;
bool mIsForBrowser;
bool mCanOverrideProcessName;
+ bool mIsAlive;
nsString mProcessName;
static ContentChild* sSingleton;
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
};
} // namespace dom