Bug 683275 - Check the testing pref for geolocation first regardless of which process is requesting the prompt. r=dougt
authorJosh Matthews <josh@joshmatthews.net>
Tue, 30 Aug 2011 15:57:04 -0400
changeset 76323 bf95c7aab462cac5d681fee9bac45a9196d0b8a4
parent 76322 256a8799fce7c45e5a6fe2e0eb59fadc70e63e1c
child 76324 93c4018253b1c4e6419cc9fcf38ba7829ecf135f
push id21097
push userbmo@edmorley.co.uk
push dateThu, 01 Sep 2011 07:45:07 +0000
treeherdermozilla-central@7d3d1c2c75f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs683275
milestone9.0a1
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
Bug 683275 - Check the testing pref for geolocation first regardless of which process is requesting the prompt. r=dougt
dom/src/geolocation/nsGeolocation.cpp
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -1039,16 +1039,24 @@ nsGeolocation::WindowOwnerStillExists()
   }
 
   return PR_TRUE;
 }
 
 bool
 nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
 {
+  if (Preferences::GetBool("geo.prompt.testing", PR_FALSE)) {
+    nsCOMPtr<nsIRunnable> ev =
+        new RequestAllowEvent(Preferences::GetBool("geo.prompt.testing.allow",
+                                                   PR_FALSE), request);
+    NS_DispatchToMainThread(ev);
+    return true;
+  }
+
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mOwner);
     if (!window)
       return true;
 
     // because owner implements nsITabChild, we can assume that it is
     // the one and only TabChild.
     TabChild* child = GetTabChildFrom(window->GetDocShell());
@@ -1061,21 +1069,13 @@ nsGeolocation::RegisterRequestWithPrompt
 
     nsCString type = NS_LITERAL_CSTRING("geolocation");
     child->SendPContentPermissionRequestConstructor(request, type, IPC::URI(mURI));
     
     request->Sendprompt();
     return true;
   }
 
-  if (Preferences::GetBool("geo.prompt.testing", PR_FALSE)) {
-    nsCOMPtr<nsIRunnable> ev =
-      new RequestAllowEvent(Preferences::GetBool("geo.prompt.testing.allow",
-                                                 PR_FALSE), request);
-    NS_DispatchToMainThread(ev);
-    return true;
-  }
-
   nsCOMPtr<nsIRunnable> ev  = new RequestPromptEvent(request);
   NS_DispatchToMainThread(ev);
   return true;
 }