Backed out changeset 201d347cda5d (bug 874069) for xpcshell crashes.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 05 Jun 2013 20:39:49 -0400
changeset 145672 b2c600be7e90daca1cd1bbd4d6e99434a64f1b4d
parent 145671 e81bb3951c2491cff014a079392dbb8886f485b5
child 145673 c878e510f42a6cf7a5f6e4ddba1b4f6f8240dafb
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs874069
milestone24.0a1
backs out201d347cda5dd0a4e3f72652e569e62ed19740bd
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 201d347cda5d (bug 874069) for xpcshell crashes.
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1047,18 +1047,16 @@ ContentParent::ContentParent(mozIApplica
     , mIsDestroyed(false)
     , mSendPermissionUpdates(false)
     , mIsForBrowser(aIsForBrowser)
 {
     // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated should
     // be true.
     MOZ_ASSERT(!!aApp + aIsForBrowser + aIsForPreallocated <= 1);
 
-    mGeo = do_CreateInstance("@mozilla.org/geolocation;1");
-
     // Insert ourselves into the global linked list of ContentParent objects.
     sContentParents.insertBack(this);
 
     if (aApp) {
         aApp->GetManifestURL(mAppManifestURL);
         aApp->GetName(mAppName);
     } else if (aIsForPreallocated) {
         mAppManifestURL = MAGIC_PREALLOCATED_APP_MANIFEST_URL;
@@ -2365,27 +2363,28 @@ ContentParent::RecvFilePathUpdateNotify(
     if (!obs) {
         return false;
     }
     obs->NotifyObservers(dsf, "file-watcher-update",
                          NS_ConvertASCIItoUTF16(aReason).get());
     return true;
 }
 
-int32_t
-ContentParent::AddGeolocationListener(bool highAccuracy)
+static int32_t
+AddGeolocationListener(nsIDOMGeoPositionCallback* watcher, bool highAccuracy)
 {
-  if (!mGeo) {
+  nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
+  if (!geo) {
     return -1;
   }
 
   GeoPositionOptions* options = new GeoPositionOptions();
   options->enableHighAccuracy = highAccuracy;
   int32_t retval = 1;
-  mGeo->WatchPosition(this, nullptr, options, &retval);
+  geo->WatchPosition(watcher, nullptr, options, &retval);
   return retval;
 }
 
 bool
 ContentParent::RecvAddGeolocationListener(const IPC::Principal& aPrincipal,
                                           const bool& aHighAccuracy)
 {
 #ifdef MOZ_PERMISSIONS
@@ -2433,41 +2432,42 @@ ContentParent::RecvAddGeolocationListene
       return true;
     }
   }
 #endif
 
   // To ensure no geolocation updates are skipped, we always force the
   // creation of a new listener.
   RecvRemoveGeolocationListener();
-  mGeolocationWatchID = AddGeolocationListener(aHighAccuracy);
+  mGeolocationWatchID = AddGeolocationListener(this, aHighAccuracy);
   return true;
 }
 
 bool
 ContentParent::RecvRemoveGeolocationListener()
 {
   if (mGeolocationWatchID != -1) {
-    if (!mGeo) {
+    nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
+    if (!geo) {
       return true;
     }
-    mGeo->ClearWatch(mGeolocationWatchID);
+    geo->ClearWatch(mGeolocationWatchID);
     mGeolocationWatchID = -1;
   }
   return true;
 }
 
 bool
 ContentParent::RecvSetGeolocationHigherAccuracy(const bool& aEnable)
 {
   // This should never be called without a listener already present,
   // so this check allows us to forgo securing privileges.
   if (mGeolocationWatchID != -1) {
     RecvRemoveGeolocationListener();
-    mGeolocationWatchID = AddGeolocationListener(aEnable);
+    mGeolocationWatchID = AddGeolocationListener(this, aEnable);
   }
   return true;
 }
 
 NS_IMETHODIMP
 ContentParent::HandleEvent(nsIDOMGeoPosition* postion)
 {
   unused << SendGeolocationUpdate(GeoPosition(postion));
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -21,27 +21,25 @@
 #include "nsFrameMessageManager.h"
 #include "nsIObserver.h"
 #include "nsIThreadInternal.h"
 #include "nsNetUtil.h"
 #include "nsIPermissionManager.h"
 #include "nsIDOMGeoPositionCallback.h"
 #include "nsIMemoryReporter.h"
 #include "nsCOMArray.h"
-#include "nsCOMPtr.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "PermissionMessageUtils.h"
 
 #define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
 
 class mozIApplication;
 class nsConsoleService;
 class nsIDOMBlob;
-class nsIDOMGeoGeolocation;
 
 namespace mozilla {
 
 namespace ipc {
 class OptionalURIParams;
 class URIParams;
 class TestShellParent;
 } // namespace ipc
@@ -172,22 +170,20 @@ protected:
     void OnChannelConnected(int32_t pid) MOZ_OVERRIDE;
     virtual void ActorDestroy(ActorDestroyReason why);
 
 private:
     static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
     static nsTArray<ContentParent*>* sNonAppContentParents;
     static nsTArray<ContentParent*>* sPrivateContent;
     static LinkedList<ContentParent> sContentParents;
-    nsCOMPtr<nsIDOMGeoGeolocation> mGeo;
 
     static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
                                       Monitor* aMonitor, bool* aDone);
 
-    int32_t AddGeolocationListener(bool highAccuracy);
     // Take the preallocated process and transform it into a "real" app process,
     // for the specified manifest URL.  If there is no preallocated process (or
     // if it's dead), this returns false.
     static already_AddRefed<ContentParent>
     MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
                                     ChildPrivileges aPrivs,
                                     hal::ProcessPriority aInitialPriority);